]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/tcp_timer.c
xnu-792.25.20.tar.gz
[apple/xnu.git] / bsd / netinet / tcp_timer.c
index b3c5388b92a5c8cc54b1e5f4b243dea97fc363a3..effeffde5292a482eae0a71a37509d71d20f4307 100644 (file)
@@ -275,10 +275,14 @@ tcp_slowtimo()
        for (inp = tcb.lh_first; inp != NULL; inp = inpnxt) {
                inpnxt = inp->inp_list.le_next;
 
+               so = inp->inp_socket;
+
+               if (so == &tcbinfo.nat_dummy_socket)
+                               continue;
+
                if (in_pcb_checkstate(inp, WNT_ACQUIRE,0) == WNT_STOPUSING) 
                        continue;
 
-               so = inp->inp_socket;
                tcp_lock(so, 1, 0);
 
                if ((in_pcb_checkstate(inp, WNT_RELEASE,1) == WNT_STOPUSING)  && so->so_usecount == 1) {
@@ -290,15 +294,6 @@ tcp_slowtimo()
                        tcp_unlock(so, 1, 0);
                        continue; 
                }
-               /*
-                * Bogus state when port owned by SharedIP with loopback as the
-                * only configured interface: BlueBox does not filters loopback
-                */
-               if (tp->t_state == TCP_NSTATES) {
-                       tcp_unlock(so, 1, 0);
-                       continue; 
-               }
-
 
                for (i = 0; i < TCPT_NTIMERS; i++) {
                        if (tp->t_timer[i] && --tp->t_timer[i] == 0) {
@@ -490,6 +485,7 @@ tcp_timers(tp, timer)
         * control block.  Otherwise, check again in a bit.
         */
        case TCPT_2MSL:
+               tcp_free_sackholes(tp);
                if (tp->t_state != TCPS_TIME_WAIT &&
                    tp->t_rcvtime <= tcp_maxidle) {
                        tp->t_timer[TCPT_2MSL] = (unsigned long)tcp_keepintvl;
@@ -507,6 +503,7 @@ tcp_timers(tp, timer)
         * to a longer retransmit interval and retransmit one segment.
         */
        case TCPT_REXMT:
+               tcp_free_sackholes(tp);
                if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
                        tp->t_rxtshift = TCP_MAXRXTSHIFT;
                        tcpstat.tcps_timeoutdrop++;
@@ -528,6 +525,11 @@ tcp_timers(tp, timer)
                         */
                        tp->snd_cwnd_prev = tp->snd_cwnd;
                        tp->snd_ssthresh_prev = tp->snd_ssthresh;
+                       tp->snd_recover_prev = tp->snd_recover;
+                       if (IN_FASTRECOVERY(tp))
+                                 tp->t_flags |= TF_WASFRECOVERY;
+                       else
+                                 tp->t_flags &= ~TF_WASFRECOVERY;
                        tp->t_badrxtwin = tcp_now + (tp->t_srtt >> (TCP_RTT_SHIFT + 1));
                }
                tcpstat.tcps_rexmttimeo++;
@@ -612,6 +614,7 @@ tcp_timers(tp, timer)
                tp->snd_ssthresh = win * tp->t_maxseg;
                tp->t_dupacks = 0;
                }
+               EXIT_FASTRECOVERY(tp);
                (void) tcp_output(tp);
                break;
 
@@ -653,7 +656,7 @@ tcp_timers(tp, timer)
                        goto dropit;
                if ((always_keepalive ||
                    tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) &&
-                   tp->t_state <= TCPS_CLOSING) {
+                   tp->t_state <= TCPS_CLOSING || tp->t_state == TCPS_FIN_WAIT_2) {
                        if (tp->t_rcvtime >= TCP_KEEPIDLE(tp) + (unsigned long)tcp_maxidle)
                                goto dropit;
                        /*