]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[TCP]: Check num sacks in SACK fast path
authorBaruch Even <baruch@ev-en.org>
Mon, 5 Feb 2007 07:37:41 +0000 (23:37 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 8 Feb 2007 20:38:50 +0000 (12:38 -0800)
We clear the unused parts of the SACK cache, This prevents us from mistakenly
taking the cache data if the old data in the SACK cache is the same as the data
in the SACK block. This assumes that we never receive an empty SACK block with
start and end both at zero.

Signed-off-by: Baruch Even <baruch@ev-en.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c

index 870f53afd3634f7d0384255bf5b2a6e56116443b..c6109895bb5e305f3d794d55b1c13b17c99a80fd 100644 (file)
@@ -998,6 +998,11 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                tp->recv_sack_cache[i].start_seq = start_seq;
                tp->recv_sack_cache[i].end_seq = end_seq;
        }
+       /* Clear the rest of the cache sack blocks so they won't match mistakenly. */
+       for (; i < ARRAY_SIZE(tp->recv_sack_cache); i++) {
+               tp->recv_sack_cache[i].start_seq = 0;
+               tp->recv_sack_cache[i].end_seq = 0;
+       }
 
        first_sack_index = 0;
        if (flag)