diff options
author | Florian Westphal <fw@strlen.de> | 2014-05-04 23:24:31 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-06-09 13:28:58 +0100 |
commit | 59d9f389df3cdf72833d5ee17c3fe959b6bdc792 (patch) | |
tree | e00d56fab7728b26a6321d2f3da58051bed269ef | |
parent | 1773b01be8aefeba20d2590e976f82292cf24b10 (diff) | |
download | lwn-59d9f389df3cdf72833d5ee17c3fe959b6bdc792.tar.gz lwn-59d9f389df3cdf72833d5ee17c3fe959b6bdc792.zip |
net: ipv4: ip_forward: fix inverted local_df test
[ Upstream commit ca6c5d4ad216d5942ae544bbf02503041bd802aa ]
local_df means 'ignore DF bit if set', so if its set we're
allowed to perform ip fragmentation.
This wasn't noticed earlier because the output path also drops such skbs
(and emits needed icmp error) and because netfilter ip defrag did not
set local_df until couple of days ago.
Only difference is that DF-packets-larger-than MTU now discarded
earlier (f.e. we avoid pointless netfilter postrouting trip).
While at it, drop the repeated test ip_exceeds_mtu, checking it once
is enough...
Fixes: fe6cc55f3a9 ("net: ip, ipv6: handle gso skbs in forwarding path")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | net/ipv4/ip_forward.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index e0d9f02fec11..7593f3a46035 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c @@ -42,12 +42,12 @@ static bool ip_may_fragment(const struct sk_buff *skb) { return unlikely((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0) || - !skb->local_df; + skb->local_df; } static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu) { - if (skb->len <= mtu || skb->local_df) + if (skb->len <= mtu) return false; if (skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu) |