Skip to contentSkip to conversation

net: ipv6: send pkttoobig immediately if orig frag size > mtu

PATCH In review Florian Westphal 2 participants 2 messages May 4, 2014 – May 7, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ipv6: send pkttoobig immediately if orig frag size > mtu

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")
---
 net/ipv6/ip6_output.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv6/ip6_output.c +5 -1
index 40e7581..31a38bd 100644
@@ -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;
 
Signature · 1 line
1.8.1.5
maintainer
#1 lore raw

From: Florian Westphal <[email protected]>
Date: Mon, 5 May 2014 00:03:34 +0200

Quoted 6 lines

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.

Quoted 8 lines

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

Also applied and queued up for -stable, thanks Florian.