netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipv6: send pkttoobig immediately if orig frag size > mtu
@ 2014-05-04 22:03 Florian Westphal
  2014-05-07 19:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2014-05-04 22:03 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

If conntrack defragments incoming ipv6 frags it stores largest original
frag size in ip6cb and sets ->local_df.

We must thus first test the largest original frag size vs. mtu, and not
vice versa.

Without this patch PKTTOOBIG is still generated in ip6_fragment() later
in the stack, but

1) IPSTATS_MIB_INTOOBIGERRORS won't increment
2) packet did (needlessly) traverse netfilter postrouting hook.

Fixes: fe6cc55f3a9 ("net: ip, ipv6: handle gso skbs in forwarding path")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/ipv6/ip6_output.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 40e7581..31a38bd 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -344,12 +344,16 @@ static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
 
 static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
 {
-	if (skb->len <= mtu || skb->local_df)
+	if (skb->len <= mtu)
 		return false;
 
+	/* ipv6 conntrack defrag sets max_frag_size + local_df */
 	if (IP6CB(skb)->frag_max_size && IP6CB(skb)->frag_max_size > mtu)
 		return true;
 
+	if (skb->local_df)
+		return false;
+
 	if (skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu)
 		return false;
 
-- 
1.8.1.5

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

* Re: [PATCH] net: ipv6: send pkttoobig immediately if orig frag size > mtu
  2014-05-04 22:03 [PATCH] net: ipv6: send pkttoobig immediately if orig frag size > mtu Florian Westphal
@ 2014-05-07 19:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-07 19:28 UTC (permalink / raw)
  To: fw; +Cc: netdev

From: Florian Westphal <fw@strlen.de>
Date: Mon,  5 May 2014 00:03:34 +0200

> If conntrack defragments incoming ipv6 frags it stores largest original
> frag size in ip6cb and sets ->local_df.
> 
> We must thus first test the largest original frag size vs. mtu, and not
> vice versa.
> 
> Without this patch PKTTOOBIG is still generated in ip6_fragment() later
> in the stack, but
> 
> 1) IPSTATS_MIB_INTOOBIGERRORS won't increment
> 2) packet did (needlessly) traverse netfilter postrouting hook.
> 
> Fixes: fe6cc55f3a9 ("net: ip, ipv6: handle gso skbs in forwarding path")
> Signed-off-by: Florian Westphal <fw@strlen.de>

Also 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:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-04 22:03 [PATCH] net: ipv6: send pkttoobig immediately if orig frag size > mtu Florian Westphal
2014-05-07 19:28 ` 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).