tcp/sack: Guard against ACK reordering when adding SACK blocks
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 8 May 2012 05:56:07 +0000 (13:56 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 8 May 2012 05:58:29 +0000 (13:58 +0800)
The reordered ACK could carry SACK blocks which are all covered by
tcpcb.snd_una

sys/netinet/tcp_sack.c

index 403185e..ea29afb 100644 (file)
@@ -311,7 +311,11 @@ tcp_sack_add_blocks(struct tcpcb *tp, struct tcpopt *to)
                boolean_t update;
                int error;
 
-               /* don't accept bad SACK blocks */
+               /* Guard against ACK reordering */
+               if (SEQ_LT(newsackblock->rblk_start, tp->snd_una))
+                       continue;
+
+               /* Don't accept bad SACK blocks */
                if (SEQ_GT(newsackblock->rblk_end, tp->snd_max)) {
                        tcpstat.tcps_rcvbadsackopt++;
                        break;          /* skip all other blocks */