Author: tuexen
Date: Sat Nov 20 19:31:31 2010
New Revision: 215580
URL: http://svn.freebsd.org/changeset/base/215580

Log:
  MFC r214918:
  Not only stop all timers when entering the SHUTDOWN_SENT state,
  but also when entering the SHUTDOWN_ACK_SENT state.

Modified:
  stable/8/sys/netinet/sctp_indata.c
  stable/8/sys/netinet/sctp_input.c
  stable/8/sys/netinet/sctputil.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/sctp_indata.c
==============================================================================
--- stable/8/sys/netinet/sctp_indata.c  Sat Nov 20 19:29:18 2010        
(r215579)
+++ stable/8/sys/netinet/sctp_indata.c  Sat Nov 20 19:31:31 2010        
(r215580)
@@ -4369,7 +4369,7 @@ again:
                        SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
                        sctp_send_shutdown_ack(stcb,
                            stcb->asoc.primary_destination);
-
+                       sctp_stop_timers_for_shutdown(stcb);
                        sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
                            stcb->sctp_ep, stcb, asoc->primary_destination);
                }
@@ -5081,7 +5081,7 @@ done_with_it:
                        SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
                        sctp_send_shutdown_ack(stcb,
                            stcb->asoc.primary_destination);
-
+                       sctp_stop_timers_for_shutdown(stcb);
                        sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
                            stcb->sctp_ep, stcb, asoc->primary_destination);
                        return;

Modified: stable/8/sys/netinet/sctp_input.c
==============================================================================
--- stable/8/sys/netinet/sctp_input.c   Sat Nov 20 19:29:18 2010        
(r215579)
+++ stable/8/sys/netinet/sctp_input.c   Sat Nov 20 19:31:31 2010        
(r215580)
@@ -908,9 +908,7 @@ sctp_handle_shutdown(struct sctp_shutdow
                }
                SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
                SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
-               sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net,
-                   SCTP_FROM_SCTP_INPUT + SCTP_LOC_7);
-               /* start SHUTDOWN timer */
+               sctp_stop_timers_for_shutdown(stcb);
                sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep,
                    stcb, net);
        }

Modified: stable/8/sys/netinet/sctputil.c
==============================================================================
--- stable/8/sys/netinet/sctputil.c     Sat Nov 20 19:29:18 2010        
(r215579)
+++ stable/8/sys/netinet/sctputil.c     Sat Nov 20 19:31:31 2010        
(r215580)
@@ -725,6 +725,31 @@ sctp_audit_log(uint8_t ev, uint8_t fd)
 #endif
 
 /*
+ * sctp_stop_timers_for_shutdown() should be called
+ * when entering the SHUTDOWN_SENT or SHUTDOWN_ACK_SENT
+ * state to make sure that all timers are stopped.
+ */
+void
+sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
+{
+       struct sctp_association *asoc;
+       struct sctp_nets *net;
+
+       asoc = &stcb->asoc;
+
+       (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
+       (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
+       (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
+       (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
+       (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
+       (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
+       TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
+               (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
+               (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
+       }
+}
+
+/*
  * a list of sizes based on typical mtu's, used only if next hop size not
  * returned.
  */
@@ -749,26 +774,6 @@ static int sctp_mtu_sizes[] = {
        65535
 };
 
-void
-sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
-{
-       struct sctp_association *asoc;
-       struct sctp_nets *net;
-
-       asoc = &stcb->asoc;
-
-       (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
-       (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
-       (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
-       (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
-       (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
-       (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
-       TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
-               (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
-               (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
-       }
-}
-
 int
 find_next_best_mtu(int totsz)
 {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to