svn commit: r294141 - stable/10/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sat Jan 16 12:20:49 UTC 2016


Author: tuexen
Date: Sat Jan 16 12:20:47 2016
New Revision: 294141
URL: https://svnweb.freebsd.org/changeset/base/294141

Log:
  MFC r285837, r285838
  Fix an issue with MAC OS locking and also optimize the case
  where we are sending back a stream-reset and a sack timer is running, in
  that case we should just send the SACK.
  Fix silly syntax error emacs chugged in for me.. gesh.

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

Modified: stable/10/sys/netinet/sctp_input.c
==============================================================================
--- stable/10/sys/netinet/sctp_input.c	Sat Jan 16 12:15:07 2016	(r294140)
+++ stable/10/sys/netinet/sctp_input.c	Sat Jan 16 12:20:47 2016	(r294141)
@@ -3764,7 +3764,7 @@ sctp_handle_stream_reset_response(struct
 		}
 	}
 	if (asoc->stream_reset_outstanding == 0) {
-		sctp_send_stream_reset_out_if_possible(stcb);
+		sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED);
 	}
 	return (0);
 }
@@ -3832,7 +3832,7 @@ bad_boy:
 	} else {
 		sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO);
 	}
-	sctp_send_stream_reset_out_if_possible(stcb);
+	sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED);
 }
 
 static int

Modified: stable/10/sys/netinet/sctp_output.c
==============================================================================
--- stable/10/sys/netinet/sctp_output.c	Sat Jan 16 12:15:07 2016	(r294140)
+++ stable/10/sys/netinet/sctp_output.c	Sat Jan 16 12:20:47 2016	(r294141)
@@ -10120,7 +10120,7 @@ do_it_again:
 		sctp_fix_ecn_echo(asoc);
 
 	if (stcb->asoc.trigger_reset) {
-		if (sctp_send_stream_reset_out_if_possible(stcb) == 0) {
+		if (sctp_send_stream_reset_out_if_possible(stcb, so_locked) == 0) {
 			goto do_it_again;
 		}
 	}
@@ -11855,7 +11855,7 @@ sctp_add_an_in_stream(struct sctp_tmit_c
 }
 
 int
-sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb)
+sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb, int so_locked)
 {
 	struct sctp_association *asoc;
 	struct sctp_tmit_chunk *chk;
@@ -11881,7 +11881,7 @@ sctp_send_stream_reset_out_if_possible(s
 	chk->book_size_scale = 0;
 	chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA);
 	if (chk->data == NULL) {
-		sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED);
+		sctp_free_a_chunk(stcb, chk, so_locked);
 		SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
 		return (ENOMEM);
 	}
@@ -11908,7 +11908,7 @@ sctp_send_stream_reset_out_if_possible(s
 	} else {
 		m_freem(chk->data);
 		chk->data = NULL;
-		sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED);
+		sctp_free_a_chunk(stcb, chk, so_locked);
 		return (ENOENT);
 	}
 	asoc->str_reset = chk;
@@ -11917,6 +11917,10 @@ sctp_send_stream_reset_out_if_possible(s
 	    chk,
 	    sctp_next);
 	asoc->ctrl_queue_cnt++;
+
+	if (stcb->asoc.send_sack) {
+		sctp_send_sack(stcb, so_locked);
+	}
 	sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
 	return (0);
 }
@@ -12117,6 +12121,9 @@ skip_stuff:
 	    chk,
 	    sctp_next);
 	asoc->ctrl_queue_cnt++;
+	if (stcb->asoc.send_sack) {
+		sctp_send_sack(stcb, SCTP_SO_LOCKED);
+	}
 	sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
 	return (0);
 }

Modified: stable/10/sys/netinet/sctp_output.h
==============================================================================
--- stable/10/sys/netinet/sctp_output.h	Sat Jan 16 12:15:07 2016	(r294140)
+++ stable/10/sys/netinet/sctp_output.h	Sat Jan 16 12:20:47 2016	(r294141)
@@ -181,7 +181,7 @@ void
 sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *,
     uint32_t, uint32_t, uint32_t, uint32_t);
 int
-    sctp_send_stream_reset_out_if_possible(struct sctp_tcb *);
+    sctp_send_stream_reset_out_if_possible(struct sctp_tcb *, int);
 
 int
 sctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *,

Modified: stable/10/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/10/sys/netinet/sctp_usrreq.c	Sat Jan 16 12:15:07 2016	(r294140)
+++ stable/10/sys/netinet/sctp_usrreq.c	Sat Jan 16 12:20:47 2016	(r294141)
@@ -4689,8 +4689,7 @@ sctp_setopt(struct socket *so, int optna
 				    strrst->srs_stream_list,
 				    send_in, 0, 0, 0, 0, 0);
 			} else
-				error = sctp_send_stream_reset_out_if_possible(stcb);
-
+				error = sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_LOCKED);
 			if (!error)
 				sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
 


More information about the svn-src-all mailing list