Author: rrs
Date: Thu Jan 20 12:40:09 2011
New Revision: 217635
URL: http://svn.freebsd.org/changeset/base/217635

Log:
  Fix it so we align with new socket API draft for
  state's in destination (i.e. ACTIVE/INACTIVE/UNCONFIRMED)
  
  MFC after:    1 week

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h   Thu Jan 20 09:46:18 2011        
(r217634)
+++ head/sys/netinet/sctp_constants.h   Thu Jan 20 12:40:09 2011        
(r217635)
@@ -506,8 +506,7 @@ __FBSDID("$FreeBSD$");
 #define SCTP_ADDR_UNCONFIRMED          0x200
 #define SCTP_ADDR_REQ_PRIMARY           0x400
 /* JRS 5/13/07 - Added potentially failed state for CMT PF */
-#define SCTP_ADDR_PF            0x800
-#define SCTP_REACHABLE_MASK            0x203
+#define SCTP_ADDR_PF                    0x800
 
 /* bound address types (e.g. valid address types to allow) */
 #define SCTP_BOUND_V6          0x01

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h Thu Jan 20 09:46:18 2011        (r217634)
+++ head/sys/netinet/sctp_uio.h Thu Jan 20 12:40:09 2011        (r217635)
@@ -233,31 +233,10 @@ struct sctp_paddr_change {
 #define SCTP_ADDR_MADE_PRIM    0x0005
 #define SCTP_ADDR_CONFIRMED    0x0006
 
-/*
- * CAUTION: these are user exposed SCTP addr reachability states must be
- * compatible with SCTP_ADDR states in sctp_constants.h
- */
-#ifdef SCTP_ACTIVE
-#undef SCTP_ACTIVE
-#endif
 #define SCTP_ACTIVE            0x0001  /* SCTP_ADDR_REACHABLE */
-
-#ifdef SCTP_INACTIVE
-#undef SCTP_INACTIVE
-#endif
 #define SCTP_INACTIVE          0x0002  /* SCTP_ADDR_NOT_REACHABLE */
-
-#ifdef SCTP_UNCONFIRMED
-#undef SCTP_UNCONFIRMED
-#endif
 #define SCTP_UNCONFIRMED       0x0200  /* SCTP_ADDR_UNCONFIRMED */
 
-#ifdef SCTP_NOHEARTBEAT
-#undef SCTP_NOHEARTBEAT
-#endif
-#define SCTP_NOHEARTBEAT       0x0040  /* SCTP_ADDR_NOHB */
-
-
 /* remote error events */
 struct sctp_remote_error {
        uint16_t sre_type;

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c      Thu Jan 20 09:46:18 2011        
(r217634)
+++ head/sys/netinet/sctp_usrreq.c      Thu Jan 20 12:40:09 2011        
(r217635)
@@ -2341,7 +2341,16 @@ flags_out:
                        }
 
                        if ((stcb) && (net)) {
-                               paddri->spinfo_state = net->dest_state & 
(SCTP_REACHABLE_MASK | SCTP_ADDR_NOHB);
+                               if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
+                                       /* Its unconfirmed */
+                                       paddri->spinfo_state = SCTP_UNCONFIRMED;
+                               } else if (net->dest_state & 
SCTP_ADDR_REACHABLE) {
+                                       /* The Active */
+                                       paddri->spinfo_state = SCTP_ACTIVE;
+                               } else {
+                                       /* It's Inactive */
+                                       paddri->spinfo_state = SCTP_INACTIVE;
+                               }
                                paddri->spinfo_cwnd = net->cwnd;
                                paddri->spinfo_srtt = ((net->lastsa >> 2) + 
net->lastsv) >> 1;
                                paddri->spinfo_rto = net->RTO;
@@ -2409,7 +2418,16 @@ flags_out:
                         * Again the user can get info from sctp_constants.h
                         * for what the state of the network is.
                         */
-                       sstat->sstat_primary.spinfo_state = net->dest_state & 
SCTP_REACHABLE_MASK;
+                       if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
+                               /* It's unconfirmed */
+                               sstat->sstat_primary.spinfo_state = 
SCTP_UNCONFIRMED;
+                       } else if (net->dest_state & SCTP_ADDR_REACHABLE) {
+                               /* Its active */
+                               sstat->sstat_primary.spinfo_state = SCTP_ACTIVE;
+                       } else {
+                               /* It's Inactive */
+                               sstat->sstat_primary.spinfo_state = 
SCTP_INACTIVE;
+                       }
                        sstat->sstat_primary.spinfo_cwnd = net->cwnd;
                        sstat->sstat_primary.spinfo_srtt = net->lastsa;
                        sstat->sstat_primary.spinfo_rto = net->RTO;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to