Author: tuexen
Date: Sun Nov  7 14:39:40 2010
New Revision: 214918
URL: http://svn.freebsd.org/changeset/base/214918

Log:
  Not only stop all timers when entering the SHUTDOWN_SENT state,
  but also when entering the SHUTDOWN_ACK_SEND state.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c      Sun Nov  7 14:28:01 2010        
(r214917)
+++ head/sys/netinet/sctp_indata.c      Sun Nov  7 14:39:40 2010        
(r214918)
@@ -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: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c       Sun Nov  7 14:28:01 2010        
(r214917)
+++ head/sys/netinet/sctp_input.c       Sun Nov  7 14:39:40 2010        
(r214918)
@@ -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: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Sun Nov  7 14:28:01 2010        (r214917)
+++ head/sys/netinet/sctputil.c Sun Nov  7 14:39:40 2010        (r214918)
@@ -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-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to