ip_tunnel: Account for secondary encapsulation header in max_headroom
authorTom Herbert <therbert@google.com>
Fri, 3 Oct 2014 22:48:07 +0000 (15:48 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Oct 2014 23:53:32 +0000 (16:53 -0700)
When adjusting max_header for the tunnel interface based on egress
device we need to account for any extra bytes in secondary encapsulation
(e.g. FOU).

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_tunnel.c

index 2272de9..d9c9dc4 100644 (file)
@@ -759,7 +759,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
                df |= (inner_iph->frag_off&htons(IP_DF));
 
        max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr)
-                       + rt->dst.header_len;
+                       + rt->dst.header_len + ip_encap_hlen(&tunnel->encap);
        if (max_headroom > dev->needed_headroom)
                dev->needed_headroom = max_headroom;