]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/tcp_timer.c
xnu-3789.51.2.tar.gz
[apple/xnu.git] / bsd / netinet / tcp_timer.c
index e50bab301fe92f87640ac9a145875b4be8a98940..5c87a2d1871bb68297b015016978072008ef5b11 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -539,6 +539,7 @@ tcp_garbage_collect(struct inpcb *inp, int istimewait)
 #endif /* INET6 */
                                in_pcbdetach(inp);
                }
 #endif /* INET6 */
                                in_pcbdetach(inp);
                }
+               VERIFY(so->so_usecount > 0);
                so->so_usecount--;
                if (inp->inp_wantcnt == WNT_STOPUSING)
                        active = TRUE;
                so->so_usecount--;
                if (inp->inp_wantcnt == WNT_STOPUSING)
                        active = TRUE;
@@ -948,7 +949,7 @@ tcp_timers(struct tcpcb *tp, int timer)
                        tp->t_stat.synrxtshift = tp->t_rxtshift;
 
                        /* When retransmitting, disable TFO */
                        tp->t_stat.synrxtshift = tp->t_rxtshift;
 
                        /* When retransmitting, disable TFO */
-                       if (tfo_enabled(tp)) {
+                       if (tfo_enabled(tp) && !(so->so_flags & SOF1_DATA_AUTHENTICATED)) {
                                tp->t_flagsext &= ~TF_FASTOPEN;
                                tp->t_tfo_flags |= TFO_F_SYN_LOSS;
                        }
                                tp->t_flagsext &= ~TF_FASTOPEN;
                                tp->t_tfo_flags |= TFO_F_SYN_LOSS;
                        }
@@ -1865,19 +1866,20 @@ tcp_sched_timers(struct tcpcb *tp)
                        list_locked = TRUE;
                }
 
                        list_locked = TRUE;
                }
 
-               LIST_INSERT_HEAD(&listp->lhead, te, le);
-               tp->t_flags |= TF_TIMER_ONLIST;
+               if (!TIMER_IS_ON_LIST(tp)) {
+                       LIST_INSERT_HEAD(&listp->lhead, te, le);
+                       tp->t_flags |= TF_TIMER_ONLIST;
 
 
-               listp->entries++;
-               if (listp->entries > listp->maxentries)
-                       listp->maxentries = listp->entries;
+                       listp->entries++;
+                       if (listp->entries > listp->maxentries)
+                               listp->maxentries = listp->entries;
 
 
-               /* if the list is not scheduled, just schedule it */
-               if (!listp->scheduled)
-                       goto schedule;
+                       /* if the list is not scheduled, just schedule it */
+                       if (!listp->scheduled)
+                               goto schedule;
+               }
        }
 
        }
 
-
        /*
         * Timer entry is currently on the list, check if the list needs
         * to be rescheduled.
        /*
         * Timer entry is currently on the list, check if the list needs
         * to be rescheduled.