Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 21:57:24 +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-12@freebsd.org
Subject:   svn commit: r364559 - stable/12/sys/netinet
Message-ID:  <202008232157.07NLvOKi079565@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sun Aug 23 21:57:24 2020
New Revision: 364559
URL: https://svnweb.freebsd.org/changeset/base/364559

Log:
  MFC r359151::
  Cleanup the stream reset and asconf timer.

Modified:
  stable/12/sys/netinet/sctp_timer.c
  stable/12/sys/netinet/sctp_timer.h
  stable/12/sys/netinet/sctputil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_timer.c
==============================================================================
--- stable/12/sys/netinet/sctp_timer.c	Sun Aug 23 21:55:34 2020	(r364558)
+++ stable/12/sys/netinet/sctp_timer.c	Sun Aug 23 21:57:24 2020	(r364559)
@@ -1103,10 +1103,9 @@ sctp_cookie_timer(struct sctp_inpcb *inp,
 }
 
 int
-sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
-    struct sctp_nets *net)
+sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
 {
-	struct sctp_nets *alt;
+	struct sctp_nets *alt, *net;
 	struct sctp_tmit_chunk *strrst = NULL, *chk = NULL;
 
 	if (stcb->asoc.stream_reset_outstanding == 0) {
@@ -1117,9 +1116,9 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct
 	if (strrst == NULL) {
 		return (0);
 	}
+	net = strrst->whoTo;
 	/* do threshold management */
-	if (sctp_threshold_management(inp, stcb, strrst->whoTo,
-	    stcb->asoc.max_send_times)) {
+	if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
 		/* Assoc is over */
 		return (1);
 	}
@@ -1127,9 +1126,8 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct
 	 * Cleared threshold management, now lets backoff the address and
 	 * select an alternate
 	 */
-	sctp_backoff_on_timeout(stcb, strrst->whoTo, 1, 0, 0);
-	alt = sctp_find_alternate_net(stcb, strrst->whoTo, 0);
-	sctp_free_remote_addr(strrst->whoTo);
+	sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
+	alt = sctp_find_alternate_net(stcb, net, 0);
 	strrst->whoTo = alt;
 	atomic_add_int(&alt->ref_count, 1);
 
@@ -1154,6 +1152,8 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct
 		 */
 		sctp_move_chunks_from_net(stcb, net);
 	}
+	sctp_free_remote_addr(net);
+
 	/* mark the retran info */
 	if (strrst->sent != SCTP_DATAGRAM_RESEND)
 		sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
@@ -1161,7 +1161,7 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct
 	strrst->flags |= CHUNK_FLAGS_FRAGMENT_OK;
 
 	/* restart the timer */
-	sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, strrst->whoTo);
+	sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, alt);
 	return (0);
 }
 
@@ -1186,8 +1186,9 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_
 		if (asconf == NULL) {
 			return (0);
 		}
+		net = asconf->whoTo;
 		/* do threshold management */
-		if (sctp_threshold_management(inp, stcb, asconf->whoTo,
+		if (sctp_threshold_management(inp, stcb, net,
 		    stcb->asoc.max_send_times)) {
 			/* Assoc is over */
 			return (1);
@@ -1208,10 +1209,9 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_
 		 * cleared threshold management, so now backoff the net and
 		 * select an alternate
 		 */
-		sctp_backoff_on_timeout(stcb, asconf->whoTo, 1, 0, 0);
-		alt = sctp_find_alternate_net(stcb, asconf->whoTo, 0);
+		sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
+		alt = sctp_find_alternate_net(stcb, net, 0);
 		if (asconf->whoTo != alt) {
-			sctp_free_remote_addr(asconf->whoTo);
 			asconf->whoTo = alt;
 			atomic_add_int(&alt->ref_count, 1);
 		}
@@ -1248,6 +1248,8 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_
 			 */
 			sctp_move_chunks_from_net(stcb, net);
 		}
+		sctp_free_remote_addr(net);
+
 		/* mark the retran info */
 		if (asconf->sent != SCTP_DATAGRAM_RESEND)
 			sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);

Modified: stable/12/sys/netinet/sctp_timer.h
==============================================================================
--- stable/12/sys/netinet/sctp_timer.h	Sun Aug 23 21:55:34 2020	(r364558)
+++ stable/12/sys/netinet/sctp_timer.h	Sun Aug 23 21:57:24 2020	(r364559)
@@ -50,12 +50,15 @@ sctp_find_alternate_net(struct sctp_tcb *,
 int
 sctp_t3rxt_timer(struct sctp_inpcb *, struct sctp_tcb *,
     struct sctp_nets *);
+
 int
 sctp_t1init_timer(struct sctp_inpcb *, struct sctp_tcb *,
     struct sctp_nets *);
+
 int
 sctp_shutdown_timer(struct sctp_inpcb *, struct sctp_tcb *,
     struct sctp_nets *);
+
 int
 sctp_heartbeat_timer(struct sctp_inpcb *, struct sctp_tcb *,
     struct sctp_nets *);
@@ -72,8 +75,7 @@ int
 sctp_shutdownack_timer(struct sctp_inpcb *, struct sctp_tcb *,
     struct sctp_nets *);
 int
-sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
-    struct sctp_nets *net);
+    sctp_strreset_timer(struct sctp_inpcb *, struct sctp_tcb *);
 
 int
 sctp_asconf_timer(struct sctp_inpcb *, struct sctp_tcb *,

Modified: stable/12/sys/netinet/sctputil.c
==============================================================================
--- stable/12/sys/netinet/sctputil.c	Sun Aug 23 21:55:34 2020	(r364558)
+++ stable/12/sys/netinet/sctputil.c	Sun Aug 23 21:57:24 2020	(r364559)
@@ -1935,7 +1935,7 @@ sctp_timeout_handler(void *t)
 		if ((stcb == NULL) || (inp == NULL)) {
 			break;
 		}
-		if (sctp_strreset_timer(inp, stcb, net)) {
+		if (sctp_strreset_timer(inp, stcb)) {
 			/* no need to unlock on tcb its gone */
 			goto out_decr;
 		}



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