Author: tuexen
Date: Fri May  4 15:49:08 2012
New Revision: 235009
URL: http://svn.freebsd.org/changeset/base/235009

Log:
  Add support for SCTP_STREAM_CHANGE_EVENT, SCTP_ASSOC_RESET_EVENT as
  required by RFC 6525. This also fixes SCTP_STREAM_RESET_EVENT.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp.h
==============================================================================
--- head/sys/netinet/sctp.h     Fri May  4 15:39:41 2012        (r235008)
+++ head/sys/netinet/sctp.h     Fri May  4 15:49:08 2012        (r235009)
@@ -511,35 +511,37 @@ struct sctp_error_unrecognized_chunk {
 /*
  * PCB Features (in sctp_features bitmask)
  */
-#define SCTP_PCB_FLAGS_DO_NOT_PMTUD     0x00000001
-#define SCTP_PCB_FLAGS_EXT_RCVINFO      0x00000002     /* deprecated */
-#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT  0x00000004
-#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE  0x00000008
-#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS        0x00000010
-#define SCTP_PCB_FLAGS_DO_ASCONF       0x00000020
-#define SCTP_PCB_FLAGS_AUTO_ASCONF     0x00000040
-#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080
+#define SCTP_PCB_FLAGS_DO_NOT_PMTUD      0x00000001
+#define SCTP_PCB_FLAGS_EXT_RCVINFO       0x00000002    /* deprecated */
+#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT   0x00000004
+#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE   0x00000008
+#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS  0x00000010
+#define SCTP_PCB_FLAGS_DO_ASCONF         0x00000020
+#define SCTP_PCB_FLAGS_AUTO_ASCONF       0x00000040
+#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE  0x00000080
 /* socket options */
-#define SCTP_PCB_FLAGS_NODELAY         0x00000100
-#define SCTP_PCB_FLAGS_AUTOCLOSE       0x00000200
-#define SCTP_PCB_FLAGS_RECVDATAIOEVNT  0x00000400      /* deprecated */
-#define SCTP_PCB_FLAGS_RECVASSOCEVNT   0x00000800
-#define SCTP_PCB_FLAGS_RECVPADDREVNT   0x00001000
-#define SCTP_PCB_FLAGS_RECVPEERERR     0x00002000
-#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT        0x00004000
-#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT        0x00008000
-#define SCTP_PCB_FLAGS_ADAPTATIONEVNT  0x00010000
-#define SCTP_PCB_FLAGS_PDAPIEVNT       0x00020000
-#define SCTP_PCB_FLAGS_AUTHEVNT                0x00040000
-#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000
-#define SCTP_PCB_FLAGS_NO_FRAGMENT     0x00100000
-#define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000
-#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000
-#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS        0x01000000
-#define SCTP_PCB_FLAGS_PORTREUSE        0x02000000
-#define SCTP_PCB_FLAGS_DRYEVNT          0x04000000
-#define SCTP_PCB_FLAGS_RECVRCVINFO      0x08000000
-#define SCTP_PCB_FLAGS_RECVNXTINFO      0x10000000
+#define SCTP_PCB_FLAGS_NODELAY           0x00000100
+#define SCTP_PCB_FLAGS_AUTOCLOSE         0x00000200
+#define SCTP_PCB_FLAGS_RECVDATAIOEVNT    0x00000400    /* deprecated */
+#define SCTP_PCB_FLAGS_RECVASSOCEVNT     0x00000800
+#define SCTP_PCB_FLAGS_RECVPADDREVNT     0x00001000
+#define SCTP_PCB_FLAGS_RECVPEERERR       0x00002000
+#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT  0x00004000
+#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT  0x00008000
+#define SCTP_PCB_FLAGS_ADAPTATIONEVNT    0x00010000
+#define SCTP_PCB_FLAGS_PDAPIEVNT         0x00020000
+#define SCTP_PCB_FLAGS_AUTHEVNT          0x00040000
+#define SCTP_PCB_FLAGS_STREAM_RESETEVNT  0x00080000
+#define SCTP_PCB_FLAGS_NO_FRAGMENT       0x00100000
+#define SCTP_PCB_FLAGS_EXPLICIT_EOR      0x00400000
+#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4   0x00800000
+#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS  0x01000000
+#define SCTP_PCB_FLAGS_PORTREUSE         0x02000000
+#define SCTP_PCB_FLAGS_DRYEVNT           0x04000000
+#define SCTP_PCB_FLAGS_RECVRCVINFO       0x08000000
+#define SCTP_PCB_FLAGS_RECVNXTINFO       0x10000000
+#define SCTP_PCB_FLAGS_ASSOC_RESETEVNT   0x20000000
+#define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x40000000
 
 /*-
  * mobility_features parameters (by micchie).Note
@@ -547,9 +549,9 @@ struct sctp_error_unrecognized_chunk {
  * sctp_mobility_features flags.. not the sctp_features
  * flags.
  */
-#define SCTP_MOBILITY_BASE             0x00000001
-#define SCTP_MOBILITY_FASTHANDOFF      0x00000002
-#define SCTP_MOBILITY_PRIM_DELETED     0x00000004
+#define SCTP_MOBILITY_BASE               0x00000001
+#define SCTP_MOBILITY_FASTHANDOFF        0x00000002
+#define SCTP_MOBILITY_PRIM_DELETED       0x00000004
 
 
 #define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c      Fri May  4 15:39:41 2012        
(r235008)
+++ head/sys/netinet/sctp_usrreq.c      Fri May  4 15:49:08 2012        
(r235009)
@@ -2983,6 +2983,12 @@ flags_out:
                                SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, ENOTSUP);
                                error = ENOTSUP;
                                break;
+                       case SCTP_ASSOC_RESET_EVENT:
+                               event_type = SCTP_PCB_FLAGS_ASSOC_RESETEVNT;
+                               break;
+                       case SCTP_STREAM_CHANGE_EVENT:
+                               event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT;
+                               break;
                        default:
                                event_type = 0;
                                SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
@@ -5379,6 +5385,12 @@ sctp_setopt(struct socket *so, int optna
                                SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, ENOTSUP);
                                error = ENOTSUP;
                                break;
+                       case SCTP_ASSOC_RESET_EVENT:
+                               event_type = SCTP_PCB_FLAGS_ASSOC_RESETEVNT;
+                               break;
+                       case SCTP_STREAM_CHANGE_EVENT:
+                               event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT;
+                               break;
                        default:
                                event_type = 0;
                                SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Fri May  4 15:39:41 2012        (r235008)
+++ head/sys/netinet/sctputil.c Fri May  4 15:49:08 2012        (r235009)
@@ -3214,7 +3214,7 @@ sctp_notify_stream_reset_add(struct sctp
        struct sctp_stream_change_event *stradd;
        int len;
 
-       if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_STREAM_RESETEVNT)) {
+       if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_STREAM_CHANGEEVNT)) {
                /* event not enabled */
                return;
        }
@@ -3275,7 +3275,7 @@ sctp_notify_stream_reset_tsn(struct sctp
        struct sctp_assoc_reset_event *strasoc;
        int len;
 
-       if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_STREAM_RESETEVNT)) {
+       if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_ASSOC_RESETEVNT)) {
                /* event not enabled */
                return;
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to