net: tcp: Handle reseqs of length 0
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 21 Nov 2017 20:24:13 +0000 (15:24 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 21 Nov 2017 20:24:13 +0000 (15:24 -0500)
The SACK code was panicking, but it is possible to have length = 0 (on a
SYN or FIN).  We can just ignore any potential SACK updates in those
cases.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/net/tcp.c

index 887057c..898eb87 100644 (file)
@@ -2129,6 +2129,8 @@ static void track_rcv_sack(Tcpctl *tcb, uint32_t left, uint32_t right)
 
        if (!tcb->sack_ok)
                return;
+       if (left == right)
+               return;
        assert(seq_lt(left, right));
        sack->left = left;
        sack->right = right;