]> Pileus Git - ~andy/linux/blobdiff - net/ipv6/sit.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[~andy/linux] / net / ipv6 / sit.c
index f18f842ac8931a7702ebe0e250e3d595f5d187bb..7ee5cb96db348ab5c75946e77d3068c3c447ba17 100644 (file)
@@ -581,12 +581,10 @@ static int ipip6_rcv(struct sk_buff *skb)
                    tunnel->parms.iph.protocol != 0)
                        goto out;
 
-               secpath_reset(skb);
                skb->mac_header = skb->network_header;
                skb_reset_network_header(skb);
                IPCB(skb)->flags = 0;
                skb->protocol = htons(ETH_P_IPV6);
-               skb->pkt_type = PACKET_HOST;
 
                if (tunnel->dev->priv_flags & IFF_ISATAP) {
                        if (!isatap_chksrc(skb, iph, tunnel)) {
@@ -603,7 +601,7 @@ static int ipip6_rcv(struct sk_buff *skb)
                        }
                }
 
-               __skb_tunnel_rx(skb, tunnel->dev);
+               __skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
 
                err = IP_ECN_decapsulate(iph, skb);
                if (unlikely(err)) {
@@ -621,8 +619,6 @@ static int ipip6_rcv(struct sk_buff *skb)
                tstats->rx_packets++;
                tstats->rx_bytes += skb->len;
 
-               if (!net_eq(tunnel->net, dev_net(tunnel->dev)))
-                       skb_scrub_packet(skb);
                netif_rx(skb);
 
                return 0;
@@ -645,11 +641,7 @@ static int ipip_rcv(struct sk_buff *skb)
        const struct iphdr *iph;
        struct ip_tunnel *tunnel;
 
-       if (iptunnel_pull_header(skb, 0, tpi.proto))
-               goto drop;
-
        iph = ip_hdr(skb);
-
        tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
                                     iph->saddr, iph->daddr);
        if (tunnel != NULL) {
@@ -659,6 +651,8 @@ static int ipip_rcv(struct sk_buff *skb)
 
                if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
                        goto drop;
+               if (iptunnel_pull_header(skb, 0, tpi.proto))
+                       goto drop;
                return ip_tunnel_rcv(tunnel, skb, &tpi, log_ecn_error);
        }
 
@@ -860,9 +854,6 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
                        tunnel->err_count = 0;
        }
 
-       if (!net_eq(tunnel->net, dev_net(dev)))
-               skb_scrub_packet(skb);
-
        /*
         * Okay, now see if we can stuff it in the buffer as-is.
         */
@@ -888,8 +879,13 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
                ttl = iph6->hop_limit;
        tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6));
 
-       err = iptunnel_xmit(dev_net(dev), rt, skb, fl4.saddr, fl4.daddr,
-                           IPPROTO_IPV6, tos, ttl, df);
+       if (likely(!skb->encapsulation)) {
+               skb_reset_inner_headers(skb);
+               skb->encapsulation = 1;
+       }
+
+       err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos,
+                           ttl, df, !net_eq(tunnel->net, dev_net(dev)));
        iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
        return NETDEV_TX_OK;