Skip to content

Commit 418a315

Browse files
Florian Westphaldavem330
authored andcommitted
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: fe6cc55 ("net: ip, ipv6: handle gso skbs in forwarding path") Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ca6c5d4 commit 418a315

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/ipv6/ip6_output.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,16 @@ static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
344344

345345
static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
346346
{
347-
if (skb->len <= mtu || skb->local_df)
347+
if (skb->len <= mtu)
348348
return false;
349349

350+
/* ipv6 conntrack defrag sets max_frag_size + local_df */
350351
if (IP6CB(skb)->frag_max_size && IP6CB(skb)->frag_max_size > mtu)
351352
return true;
352353

354+
if (skb->local_df)
355+
return false;
356+
353357
if (skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu)
354358
return false;
355359

0 commit comments

Comments
 (0)