]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
netfilter: ipv6: expand skb head in ip6_route_me_harder after oif change
authorPatrick McHardy <kaber@trash.net>
Sun, 26 Aug 2012 17:14:08 +0000 (19:14 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 30 Aug 2012 01:00:15 +0000 (03:00 +0200)
Expand the skb headroom if the oif changed due to rerouting similar to
how IPv4 packets are handled.

Signed-off-by: Patrick McHardy <kaber@trash.net>
net/ipv6/netfilter.c

index db31561cc8df31afbf7f18fd4dd849811be5a8dd..429089cb073dd1ae4f565a6b5382d6b12b9354ce 100644 (file)
@@ -15,6 +15,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
 {
        struct net *net = dev_net(skb_dst(skb)->dev);
        const struct ipv6hdr *iph = ipv6_hdr(skb);
+       unsigned int hh_len;
        struct dst_entry *dst;
        struct flowi6 fl6 = {
                .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
@@ -47,6 +48,13 @@ int ip6_route_me_harder(struct sk_buff *skb)
        }
 #endif
 
+       /* Change in oif may mean change in hh_len. */
+       hh_len = skb_dst(skb)->dev->hard_header_len;
+       if (skb_headroom(skb) < hh_len &&
+           pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)),
+                            0, GFP_ATOMIC))
+               return -1;
+
        return 0;
 }
 EXPORT_SYMBOL(ip6_route_me_harder);