Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jan 2016 12:15:41 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294215 - in stable/10/sys: netinet netinet6
Message-ID:  <201601171215.u0HCFfQM080757@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sun Jan 17 12:15:41 2016
New Revision: 294215
URL: https://svnweb.freebsd.org/changeset/base/294215

Log:
  MFC r291904:
  Fix the allocation of outgoing streams:
  * When processing a cookie, use the number of
    streams announced in the INIT-ACK.
  * When sending an INIT-ACK for an existing
    association, use the value from the association,
    not from the end-point.

Modified:
  stable/10/sys/netinet/sctp_input.c
  stable/10/sys/netinet/sctp_output.c
  stable/10/sys/netinet/sctp_pcb.c
  stable/10/sys/netinet/sctp_pcb.h
  stable/10/sys/netinet/sctp_usrreq.c
  stable/10/sys/netinet/sctputil.c
  stable/10/sys/netinet/sctputil.h
  stable/10/sys/netinet6/sctp6_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/sctp_input.c
==============================================================================
--- stable/10/sys/netinet/sctp_input.c	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctp_input.c	Sun Jan 17 12:15:41 2016	(r294215)
@@ -2103,6 +2103,7 @@ sctp_process_cookie_new(struct mbuf *m, 
 	 */
 	stcb = sctp_aloc_assoc(inp, init_src, &error,
 	    ntohl(initack_cp->init.initiate_tag), vrf_id,
+	    ntohs(initack_cp->init.num_outbound_streams),
 	    (struct thread *)NULL
 	    );
 	if (stcb == NULL) {

Modified: stable/10/sys/netinet/sctp_output.c
==============================================================================
--- stable/10/sys/netinet/sctp_output.c	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctp_output.c	Sun Jan 17 12:15:41 2016	(r294215)
@@ -3652,6 +3652,7 @@ sctp_process_cmsgs_for_init(struct sctp_
 #endif
 						stcb->asoc.strmout[i].stream_no = i;
 						stcb->asoc.strmout[i].last_msg_incomplete = 0;
+						stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING;
 						stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
 					}
 				}
@@ -5841,10 +5842,10 @@ do_a_abort:
 	his_limit = ntohs(init_chk->init.num_inbound_streams);
 	/* choose what I want */
 	if (asoc != NULL) {
-		if (asoc->streamoutcnt > inp->sctp_ep.pre_open_stream_count) {
+		if (asoc->streamoutcnt > asoc->pre_open_streams) {
 			i_want = asoc->streamoutcnt;
 		} else {
-			i_want = inp->sctp_ep.pre_open_stream_count;
+			i_want = asoc->pre_open_streams;
 		}
 	} else {
 		i_want = inp->sctp_ep.pre_open_stream_count;
@@ -12617,6 +12618,7 @@ sctp_lower_sosend(struct socket *so,
 			}
 #endif
 			stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
+			    inp->sctp_ep.pre_open_stream_count,
 			    p
 			    );
 			if (stcb == NULL) {

Modified: stable/10/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/10/sys/netinet/sctp_pcb.c	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctp_pcb.c	Sun Jan 17 12:15:41 2016	(r294215)
@@ -4164,6 +4164,7 @@ try_again:
 struct sctp_tcb *
 sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
     int *error, uint32_t override_tag, uint32_t vrf_id,
+    uint16_t o_streams,
     struct thread *p
 )
 {
@@ -4322,7 +4323,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, 
 	/* setup back pointer's */
 	stcb->sctp_ep = inp;
 	stcb->sctp_socket = inp->sctp_socket;
-	if ((err = sctp_init_asoc(inp, stcb, override_tag, vrf_id))) {
+	if ((err = sctp_init_asoc(inp, stcb, override_tag, vrf_id, o_streams))) {
 		/* failed */
 		SCTP_TCB_LOCK_DESTROY(stcb);
 		SCTP_TCB_SEND_LOCK_DESTROY(stcb);

Modified: stable/10/sys/netinet/sctp_pcb.h
==============================================================================
--- stable/10/sys/netinet/sctp_pcb.h	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctp_pcb.h	Sun Jan 17 12:15:41 2016	(r294215)
@@ -584,7 +584,7 @@ void sctp_inpcb_free(struct sctp_inpcb *
 
 struct sctp_tcb *
 sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
-    int *, uint32_t, uint32_t, struct thread *);
+    int *, uint32_t, uint32_t, uint16_t, struct thread *);
 
 int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
 

Modified: stable/10/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/10/sys/netinet/sctp_usrreq.c	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctp_usrreq.c	Sun Jan 17 12:15:41 2016	(r294215)
@@ -1501,6 +1501,7 @@ sctp_do_connect_x(struct socket *so, str
 
 	/* We are GOOD to go */
 	stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id,
+	    inp->sctp_ep.pre_open_stream_count,
 	    (struct thread *)p
 	    );
 	if (stcb == NULL) {
@@ -6929,7 +6930,7 @@ sctp_connect(struct socket *so, struct s
 	}
 	vrf_id = inp->def_vrf_id;
 	/* We are GOOD to go */
-	stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, p);
+	stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, p);
 	if (stcb == NULL) {
 		/* Gak! no memory */
 		goto out_now;

Modified: stable/10/sys/netinet/sctputil.c
==============================================================================
--- stable/10/sys/netinet/sctputil.c	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctputil.c	Sun Jan 17 12:15:41 2016	(r294215)
@@ -938,7 +938,7 @@ sctp_map_assoc_state(int kernel_state)
 
 int
 sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
-    uint32_t override_tag, uint32_t vrf_id)
+    uint32_t override_tag, uint32_t vrf_id, uint16_t o_strms)
 {
 	struct sctp_association *asoc;
 
@@ -1100,7 +1100,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, s
 	 * that we request by default.
 	 */
 	asoc->strm_realoutsize = asoc->streamoutcnt = asoc->pre_open_streams =
-	    inp->sctp_ep.pre_open_stream_count;
+	    o_strms;
 	SCTP_MALLOC(asoc->strmout, struct sctp_stream_out *,
 	    asoc->streamoutcnt * sizeof(struct sctp_stream_out),
 	    SCTP_M_STRMO);

Modified: stable/10/sys/netinet/sctputil.h
==============================================================================
--- stable/10/sys/netinet/sctputil.h	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet/sctputil.h	Sun Jan 17 12:15:41 2016	(r294215)
@@ -83,7 +83,7 @@ uint32_t sctp_select_initial_TSN(struct 
 
 uint32_t sctp_select_a_tag(struct sctp_inpcb *, uint16_t lport, uint16_t rport, int);
 
-int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t);
+int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint16_t);
 
 void sctp_fill_random_store(struct sctp_pcb *);
 

Modified: stable/10/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- stable/10/sys/netinet6/sctp6_usrreq.c	Sun Jan 17 12:13:40 2016	(r294214)
+++ stable/10/sys/netinet6/sctp6_usrreq.c	Sun Jan 17 12:15:41 2016	(r294215)
@@ -953,7 +953,7 @@ sctp6_connect(struct socket *so, struct 
 		return (EALREADY);
 	}
 	/* We are GOOD to go */
-	stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, p);
+	stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, p);
 	SCTP_ASOC_CREATE_UNLOCK(inp);
 	if (stcb == NULL) {
 		/* Gak! no memory */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601171215.u0HCFfQM080757>