ip6_tunnel: Clear IP6CB(skb)->frag_max_size in ip4ip6_tnl_xmit()
Subsystems (3)
PATCH 1/1 ip6_tunnel: Clear IP6CB(skb)->frag_max_size in ip4ip6_tnl_xmit()
skb->cb may contain data from previous layers, as shown in 5146d1f1511 ("tunnel: Clear IPCB(skb)->opt before dst_link_failure called"). However, for ipip6 tunnels, clearing IPCB(skb)->opt alone is not enough, because skb->cb is later misinterpreted as IP6CB(skb)->frag_max_size.
In the observed scenario, the garbage data made the max fragment size so so small that packets sent through the tunnel are mistakenly fragmented.
This patch clears IP6CB(skb)->frag_max_size for ipip6 tunnels.
--- net/ipv6/ip6_tunnel.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/ip6_tunnel.c +1 -0
@@ -1205,6 +1205,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)int err;memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt)); +IP6CB (skb)->frag_max_size =0 ; tproto =ACCESS_ONCE (t->parms.proto);if (tproto !=IPPROTO_IPIP && tproto !=0 )
Signature · 1 line
2.10.1
David Miller
maintainerFrom: Eli Cooper <[email protected]>
Date: Mon, 24 Oct 2016 23:07:12 +0800
net/ipv6/ip6_tunnel.c ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) · line 1211
Quoted 12 lines
net/ipv6/ip6_tunnel.c +1
-0@@ -1205,6 +1205,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)int err;memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt)); +IP6CB (skb)->frag_max_size =0 ; tproto =ACCESS_ONCE (t->parms.proto);if (tproto !=IPPROTO_IPIP && tproto !=0 )
This doesn't look right at all.
Either skb->cb is interpreted as IPCB() past this point, or it is interpreted as IP6CB().
So pick which structure is used, and simply clear that specific structure.