]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/tcp_input.c
xnu-2422.115.4.tar.gz
[apple/xnu.git] / bsd / netinet / tcp_input.c
index 005d449c24cf7a08716bfa64cdb5842e7ab0fbfb..95b5b703efb94995a2347a3ec23d6157a72dc168 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -3367,6 +3367,19 @@ trimthenstep6:
                 */ 
                if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
                        if (tlen == 0 && tiwin == tp->snd_wnd) {
+                               /*
+                                * If both ends send FIN at the same time,
+                                * then the ack will be a duplicate ack
+                                * but we have to process the FIN. Check
+                                * for this condition and process the FIN
+                                * instead of the dupack
+                                */ 
+                               if ((thflags & TH_FIN) &&
+                                       (tp->t_flags & TF_SENTFIN) &&
+                                       !TCPS_HAVERCVDFIN(tp->t_state) &&
+                                       (th->th_ack + 1) == tp->snd_max) {
+                                       break;
+                               }
 process_dupack:
 #if MPTCP
                                /*