netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipv4: ip_forward: fix inverted local_df test
@ 2014-05-04 21:24 Florian Westphal
  2014-05-07 19:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2014-05-04 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

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>
---
 net/ipv4/ip_forward.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 85af3d9..6f111e4 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)
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ipv4: ip_forward: fix inverted local_df test
  2014-05-04 21:24 [PATCH] net: ipv4: ip_forward: fix inverted local_df test Florian Westphal
@ 2014-05-07 19:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-07 19:26 UTC (permalink / raw)
  To: fw; +Cc: netdev

From: Florian Westphal <fw@strlen.de>
Date: Sun,  4 May 2014 23:24:31 +0200

> 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>

Applied and queued up for -stable, thanks Florian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-07 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-04 21:24 [PATCH] net: ipv4: ip_forward: fix inverted local_df test Florian Westphal
2014-05-07 19:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).