net: ipv4: ip_forward: fix inverted local_df test
Subsystems (3)
PATCH 1/1 net: ipv4: ip_forward: fix inverted local_df test
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...
--- net/ipv4/ip_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ip_forward.c +2 -2
@@ -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)
Signature · 1 line
1.8.1.5
David Miller
maintainerFrom: Florian Westphal <[email protected]>
Date: Sun, 4 May 2014 23:24:31 +0200
Quoted 7 lines
local_dfmeans '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_dfuntil couple of days ago.
Quoted 8 lines
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 <[email protected]>
Applied and queued up for -stable, thanks Florian.