]> Pileus Git - ~andy/linux/blobdiff - net/ipv6/ip6_gre.c
tunnels: harmonize cleanup done on skb on rx path
[~andy/linux] / net / ipv6 / ip6_gre.c
index ecd60733e5e24afdb28a52c95686fec28e2e4d73..db992a373011241afcbc3094a683474b67742290 100644 (file)
@@ -335,6 +335,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
        dev->rtnl_link_ops = &ip6gre_link_ops;
 
        nt->dev = dev;
+       nt->net = dev_net(dev);
        ip6gre_tnl_link_config(nt, 1);
 
        if (register_netdevice(dev) < 0)
@@ -508,8 +509,6 @@ static int ip6gre_rcv(struct sk_buff *skb)
                        goto drop;
                }
 
-               secpath_reset(skb);
-
                skb->protocol = gre_proto;
                /* WCCP version 1 and 2 protocol decoding.
                 * - Change protocol to IP
@@ -524,7 +523,6 @@ static int ip6gre_rcv(struct sk_buff *skb)
                skb->mac_header = skb->network_header;
                __pskb_pull(skb, offset);
                skb_postpull_rcsum(skb, skb_transport_header(skb), offset);
-               skb->pkt_type = PACKET_HOST;
 
                if (((flags&GRE_CSUM) && csum) ||
                    (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) {
@@ -556,7 +554,7 @@ static int ip6gre_rcv(struct sk_buff *skb)
                        skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
                }
 
-               __skb_tunnel_rx(skb, tunnel->dev);
+               __skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
 
                skb_reset_network_header(skb);
 
@@ -693,6 +691,8 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
                        tunnel->err_count = 0;
        }
 
+       skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev)));
+
        max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + dst->header_len;
 
        if (skb_headroom(skb) < max_headroom || skb_shared(skb) ||
@@ -709,8 +709,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
                skb = new_skb;
        }
 
-       skb_dst_drop(skb);
-
        if (fl6->flowi6_mark) {
                skb_dst_set(skb, dst);
                ndst = NULL;
@@ -1255,6 +1253,7 @@ static int ip6gre_tunnel_init(struct net_device *dev)
        tunnel = netdev_priv(dev);
 
        tunnel->dev = dev;
+       tunnel->net = dev_net(dev);
        strcpy(tunnel->parms.name, dev->name);
 
        memcpy(dev->dev_addr, &tunnel->parms.laddr, sizeof(struct in6_addr));
@@ -1275,6 +1274,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
        struct ip6_tnl *tunnel = netdev_priv(dev);
 
        tunnel->dev = dev;
+       tunnel->net = dev_net(dev);
        strcpy(tunnel->parms.name, dev->name);
 
        tunnel->hlen            = sizeof(struct ipv6hdr) + 4;
@@ -1450,6 +1450,7 @@ static int ip6gre_tap_init(struct net_device *dev)
        tunnel = netdev_priv(dev);
 
        tunnel->dev = dev;
+       tunnel->net = dev_net(dev);
        strcpy(tunnel->parms.name, dev->name);
 
        ip6gre_tnl_link_config(tunnel, 1);
@@ -1501,6 +1502,7 @@ static int ip6gre_newlink(struct net *src_net, struct net_device *dev,
                eth_hw_addr_random(dev);
 
        nt->dev = dev;
+       nt->net = dev_net(dev);
        ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]);
 
        /* Can use a lockless transmit, unless we generate output sequences */