Author: tuexen
Date: Sat May  5 21:41:16 2012
New Revision: 235066
URL: http://svn.freebsd.org/changeset/base/235066

Log:
  Provide the flags in the SCTP stream reconfig related notification
  as specified in RFC 6525.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h   Sat May  5 21:40:32 2012        
(r235065)
+++ head/sys/netinet/sctp_constants.h   Sat May  5 21:41:16 2012        
(r235066)
@@ -779,10 +779,9 @@ __FBSDID("$FreeBSD$");
 #define SCTP_NOTIFY_SPECIAL_SP_FAIL             27
 #define SCTP_NOTIFY_NO_PEER_AUTH                28
 #define SCTP_NOTIFY_SENDER_DRY                  29
-#define SCTP_NOTIFY_STR_RESET_ADD_OK            30
-#define SCTP_NOTIFY_STR_RESET_ADD_FAIL          31
-#define SCTP_NOTIFY_STR_RESET_INSTREAM_ADD_OK   32
-#define SCTP_NOTIFY_MAX                         32
+#define SCTP_NOTIFY_STR_RESET_DENIED_OUT        30
+#define SCTP_NOTIFY_STR_RESET_DENIED_IN         31
+#define SCTP_NOTIFY_MAX                         31
 
 
 /* This is the value for messages that are NOT completely

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c       Sat May  5 21:40:32 2012        
(r235065)
+++ head/sys/netinet/sctp_input.c       Sat May  5 21:41:16 2012        
(r235066)
@@ -3602,6 +3602,8 @@ sctp_handle_stream_reset_response(struct
                                if (action == 
SCTP_STREAM_RESET_RESULT_PERFORMED) {
                                        /* do it */
                                        sctp_reset_out_streams(stcb, 
number_entries, srparam->list_of_streams);
+                               } else if (action == 
SCTP_STREAM_RESET_RESULT_DENIED) {
+                                       
sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, 
srparam->list_of_streams, SCTP_SO_NOT_LOCKED);
                                } else {
                                        
sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, 
srparam->list_of_streams, SCTP_SO_NOT_LOCKED);
                                }
@@ -3610,7 +3612,10 @@ sctp_handle_stream_reset_response(struct
                                number_entries = (lparm_len - sizeof(struct 
sctp_stream_reset_in_request)) / sizeof(uint16_t);
                                if (asoc->stream_reset_outstanding)
                                        asoc->stream_reset_outstanding--;
-                               if (action != 
SCTP_STREAM_RESET_RESULT_PERFORMED) {
+                               if (action == SCTP_STREAM_RESET_RESULT_DENIED) {
+                                       
sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb,
+                                           number_entries, 
srparam->list_of_streams, SCTP_SO_NOT_LOCKED);
+                               } else if (action != 
SCTP_STREAM_RESET_RESULT_PERFORMED) {
                                        
sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb,
                                            number_entries, 
srparam->list_of_streams, SCTP_SO_NOT_LOCKED);
                                }
@@ -3630,16 +3635,22 @@ sctp_handle_stream_reset_response(struct
                                        /* Put the new streams into effect */
                                        stcb->asoc.streamoutcnt += num_stream;
                                        sctp_notify_stream_reset_add(stcb, 
stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0);
+                               } else if (action == 
SCTP_STREAM_RESET_RESULT_DENIED) {
+                                       sctp_notify_stream_reset_add(stcb, 
stcb->asoc.streamincnt, stcb->asoc.streamoutcnt,
+                                           SCTP_STREAM_CHANGE_DENIED);
                                } else {
                                        sctp_notify_stream_reset_add(stcb, 
stcb->asoc.streamincnt, stcb->asoc.streamoutcnt,
-                                           SCTP_STREAM_CHANGED_DENIED);
+                                           SCTP_STREAM_CHANGE_FAILED);
                                }
                        } else if (type == SCTP_STR_RESET_ADD_IN_STREAMS) {
                                if (asoc->stream_reset_outstanding)
                                        asoc->stream_reset_outstanding--;
-                               if (action != 
SCTP_STREAM_RESET_RESULT_PERFORMED) {
+                               if (action == SCTP_STREAM_RESET_RESULT_DENIED) {
                                        sctp_notify_stream_reset_add(stcb, 
stcb->asoc.streamincnt, stcb->asoc.streamoutcnt,
-                                           SCTP_STREAM_CHANGED_DENIED);
+                                           SCTP_STREAM_CHANGE_DENIED);
+                               } else if (action != 
SCTP_STREAM_RESET_RESULT_PERFORMED) {
+                                       sctp_notify_stream_reset_add(stcb, 
stcb->asoc.streamincnt, stcb->asoc.streamoutcnt,
+                                           SCTP_STREAM_CHANGE_FAILED);
                                }
                        } else if (type == SCTP_STR_RESET_TSN_REQUEST) {
                                /**
@@ -3682,9 +3693,12 @@ sctp_handle_stream_reset_response(struct
                                        sctp_reset_out_streams(stcb, 0, 
(uint16_t *) NULL);
                                        sctp_reset_in_stream(stcb, 0, (uint16_t 
*) NULL);
                                        sctp_notify_stream_reset_tsn(stcb, 
stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0);
+                               } else if (action == 
SCTP_STREAM_RESET_RESULT_DENIED) {
+                                       sctp_notify_stream_reset_tsn(stcb, 
stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1),
+                                           SCTP_ASSOC_RESET_DENIED);
                                } else {
                                        sctp_notify_stream_reset_tsn(stcb, 
stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1),
-                                           SCTP_STREAM_RESET_FAILED);
+                                           SCTP_ASSOC_RESET_FAILED);
                                }
                        }
                        /* get rid of the request and get the request flags */

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h Sat May  5 21:40:32 2012        (r235065)
+++ head/sys/netinet/sctp_uio.h Sat May  5 21:41:16 2012        (r235066)
@@ -454,7 +454,6 @@ struct sctp_stream_reset_event {
 #define SCTP_STREAM_RESET_OUTGOING_SSN  0x0002
 #define SCTP_STREAM_RESET_DENIED        0x0004
 #define SCTP_STREAM_RESET_FAILED        0x0008
-#define SCTP_STREAM_CHANGED_DENIED      0x0010
 
 /*
  * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Sat May  5 21:40:32 2012        (r235065)
+++ head/sys/netinet/sctputil.c Sat May  5 21:41:16 2012        (r235066)
@@ -3507,10 +3507,18 @@ sctp_ulp_notify(uint32_t notification, s
                sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
                    (SCTP_STREAM_RESET_OUTGOING_SSN | 
SCTP_STREAM_RESET_FAILED));
                break;
+       case SCTP_NOTIFY_STR_RESET_DENIED_OUT:
+               sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
+                   (SCTP_STREAM_RESET_OUTGOING_SSN | 
SCTP_STREAM_RESET_DENIED));
+               break;
        case SCTP_NOTIFY_STR_RESET_FAILED_IN:
                sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
                    (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_FAILED));
                break;
+       case SCTP_NOTIFY_STR_RESET_DENIED_IN:
+               sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
+                   (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_DENIED));
+               break;
        case SCTP_NOTIFY_ASCONF_ADD_IP:
                sctp_notify_peer_addr_change(stcb, SCTP_ADDR_ADDED, data,
                    error);
_______________________________________________
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