Author: tuexen
Date: Thu Mar 19 18:55:54 2020
New Revision: 359151
URL: https://svnweb.freebsd.org/changeset/base/359151

Log:
  Cleanup the stream reset and asconf timer.
  
  MFC after:            1 week

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

Modified: head/sys/netinet/sctp_timer.c
==============================================================================
--- head/sys/netinet/sctp_timer.c       Thu Mar 19 18:17:43 2020        
(r359150)
+++ head/sys/netinet/sctp_timer.c       Thu Mar 19 18:55:54 2020        
(r359151)
@@ -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: head/sys/netinet/sctp_timer.h
==============================================================================
--- head/sys/netinet/sctp_timer.h       Thu Mar 19 18:17:43 2020        
(r359150)
+++ head/sys/netinet/sctp_timer.h       Thu Mar 19 18:55:54 2020        
(r359151)
@@ -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: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Thu Mar 19 18:17:43 2020        (r359150)
+++ head/sys/netinet/sctputil.c Thu Mar 19 18:55:54 2020        (r359151)
@@ -1939,7 +1939,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;
                }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to