Author: tuexen
Date: Sun May  6 13:09:13 2012
New Revision: 235081
URL: http://svn.freebsd.org/changeset/base/235081

Log:
  Add support for the sac_info field in struct sctp_assoc_change
  as required by RFC 6458.
  
  MFC after: 3 days

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

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h Sun May  6 12:55:20 2012        (r235080)
+++ head/sys/netinet/sctp_uio.h Sun May  6 13:09:13 2012        (r235081)
@@ -296,16 +296,23 @@ struct sctp_assoc_change {
        uint16_t sac_outbound_streams;
        uint16_t sac_inbound_streams;
        sctp_assoc_t sac_assoc_id;
+       uint8_t sac_info[];
 };
 
 /* sac_state values */
-#define SCTP_COMM_UP           0x0001
-#define SCTP_COMM_LOST         0x0002
-#define SCTP_RESTART           0x0003
-#define SCTP_SHUTDOWN_COMP     0x0004
-#define SCTP_CANT_STR_ASSOC    0x0005
-
-
+#define SCTP_COMM_UP            0x0001
+#define SCTP_COMM_LOST          0x0002
+#define SCTP_RESTART            0x0003
+#define SCTP_SHUTDOWN_COMP      0x0004
+#define SCTP_CANT_STR_ASSOC     0x0005
+
+/* sac_info values */
+#define SCTP_ASSOC_SUPPORTS_PR        0x01
+#define SCTP_ASSOC_SUPPORTS_AUTH      0x02
+#define SCTP_ASSOC_SUPPORTS_ASCONF    0x03
+#define SCTP_ASSOC_SUPPORTS_MULTIBUF  0x04
+#define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05
+#define SCTP_ASSOC_SUPPORTS_MAX       0x05
 /*
  * Address event
  */

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Sun May  6 12:55:20 2012        (r235080)
+++ head/sys/netinet/sctputil.c Sun May  6 13:09:13 2012        (r235081)
@@ -2602,6 +2602,7 @@ sctp_notify_assoc_change(uint32_t event,
        struct mbuf *m_notify;
        struct sctp_assoc_change *sac;
        struct sctp_queued_to_read *control;
+       unsigned int i;
 
 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
        struct socket *so;
@@ -2666,7 +2667,22 @@ sctp_notify_assoc_change(uint32_t event,
        sac->sac_outbound_streams = stcb->asoc.streamoutcnt;
        sac->sac_inbound_streams = stcb->asoc.streamincnt;
        sac->sac_assoc_id = sctp_get_associd(stcb);
-       SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_assoc_change);
+       i = 0;
+       if (stcb->asoc.peer_supports_prsctp) {
+               sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR;
+       }
+       if (stcb->asoc.peer_supports_auth) {
+               sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH;
+       }
+       if (stcb->asoc.peer_supports_asconf) {
+               sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF;
+       }
+       sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF;
+       if (stcb->asoc.peer_supports_strreset) {
+               sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG;
+       }
+       sac->sac_length += i;
+       SCTP_BUF_LEN(m_notify) = sac->sac_length;
        SCTP_BUF_NEXT(m_notify) = NULL;
        control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
            0, 0, stcb->asoc.context, 0, 0, 0,
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to