aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-05-25 19:15:56 +0000
committerFlorin Coras <florin.coras@gmail.com>2020-05-25 20:34:17 +0000
commit89c12dbe239dc6d8bde1a99f970d05556db6bd98 (patch)
tree2c6a8eaf9192e3bee8677e318eeccfcb1b3c7ff8 /src
parent11974e5f5a8e11429e69fbd3c6058c70f30ef697 (diff)
tcp: fix sack block validation on wrap
Type: fix Fixes: 487507f Ticket: VPP-1879 Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia9813ae09d14111dc8edac0fa6ab082e13ab6e2e (cherry picked from commit 3b9540966f877ae67d374cab334c31bd6e3f8c8b)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/unittest/tcp_test.c26
-rw-r--r--src/vnet/tcp/tcp_sack.c4
2 files changed, 29 insertions, 1 deletions
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index 535f0552b10..b98d360ca51 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -637,6 +637,32 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input)
TCP_TEST ((sb->rxt_sacked == 300), "last rxt sacked bytes %d",
sb->rxt_sacked);
+ /*
+ * Restart
+ */
+ scoreboard_clear (sb);
+ vec_reset_length (tc->rcv_opts.sacks);
+
+ /*
+ * Broken sacks:
+ * block.start > snd_nxt
+ * && block.start < blk.end
+ * && block.end <= snd_nxt
+ */
+ tc->flags = 0;
+ block.start = 2147483647;
+ block.end = 4294967295;
+ vec_add1 (tc->rcv_opts.sacks, block);
+ tc->snd_una = tc->snd_nxt = 1969067947;
+
+ tcp_rcv_sacks (tc, tc->snd_una);
+
+ /*
+ * Clear
+ */
+ scoreboard_clear (sb);
+ vec_reset_length (tc->rcv_opts.sacks);
+
return 0;
}
diff --git a/src/vnet/tcp/tcp_sack.c b/src/vnet/tcp/tcp_sack.c
index 589c7f35227..b9e1166d779 100644
--- a/src/vnet/tcp/tcp_sack.c
+++ b/src/vnet/tcp/tcp_sack.c
@@ -326,7 +326,9 @@ tcp_rcv_sacks (tcp_connection_t * tc, u32 ack)
{
if (seq_lt (blk->start, blk->end)
&& seq_gt (blk->start, tc->snd_una)
- && seq_gt (blk->start, ack) && seq_leq (blk->end, tc->snd_nxt))
+ && seq_gt (blk->start, ack)
+ && seq_lt (blk->start, tc->snd_nxt)
+ && seq_leq (blk->end, tc->snd_nxt))
{
blk++;
continue;