diff options
author | Eric Dumazet <edumazet@google.com> | 2016-01-26 19:59:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-29 15:14:20 -0500 |
commit | 63e51b6a24f1bee5363056b7aee3a468b12c546b (patch) | |
tree | 899fb9c04578375e57616076654ab4dd528b4cc4 /net | |
parent | b64438853f4c29f2235124a1c879b5e242d1ae19 (diff) |
ipv4: early demux should be aware of fragments
We should not assume a valid protocol header is present,
as this is not the case for IPv4 fragments.
Lets avoid extra cache line misses and potential bugs
if we actually find a socket and incorrectly uses its dst.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ip_input.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index b1209b63381f..d77eb0c3b684 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -316,7 +316,10 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
316 | const struct iphdr *iph = ip_hdr(skb); | 316 | const struct iphdr *iph = ip_hdr(skb); |
317 | struct rtable *rt; | 317 | struct rtable *rt; |
318 | 318 | ||
319 | if (sysctl_ip_early_demux && !skb_dst(skb) && !skb->sk) { | 319 | if (sysctl_ip_early_demux && |
320 | !skb_dst(skb) && | ||
321 | !skb->sk && | ||
322 | !ip_is_fragment(iph)) { | ||
320 | const struct net_protocol *ipprot; | 323 | const struct net_protocol *ipprot; |
321 | int protocol = iph->protocol; | 324 | int protocol = iph->protocol; |
322 | 325 | ||