aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/dst.h12
-rw-r--r--net/ipv4/ip_tunnel.c3
-rw-r--r--net/ipv4/ipmr.c3
-rw-r--r--net/ipv6/ip6_gre.c5
-rw-r--r--net/ipv6/ip6_tunnel.c7
-rw-r--r--net/ipv6/ip6mr.c3
-rw-r--r--net/ipv6/sit.c6
7 files changed, 13 insertions, 26 deletions
diff --git a/include/net/dst.h b/include/net/dst.h
index 1f8fd109e225..3bc4865f8267 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -311,11 +311,13 @@ static inline void skb_dst_force(struct sk_buff *skb)
311 * __skb_tunnel_rx - prepare skb for rx reinsert 311 * __skb_tunnel_rx - prepare skb for rx reinsert
312 * @skb: buffer 312 * @skb: buffer
313 * @dev: tunnel device 313 * @dev: tunnel device
314 * @net: netns for packet i/o
314 * 315 *
315 * After decapsulation, packet is going to re-enter (netif_rx()) our stack, 316 * After decapsulation, packet is going to re-enter (netif_rx()) our stack,
316 * so make some cleanups. (no accounting done) 317 * so make some cleanups. (no accounting done)
317 */ 318 */
318static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) 319static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev,
320 struct net *net)
319{ 321{
320 skb->dev = dev; 322 skb->dev = dev;
321 323
@@ -327,8 +329,7 @@ static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
327 if (!skb->l4_rxhash) 329 if (!skb->l4_rxhash)
328 skb->rxhash = 0; 330 skb->rxhash = 0;
329 skb_set_queue_mapping(skb, 0); 331 skb_set_queue_mapping(skb, 0);
330 skb_dst_drop(skb); 332 skb_scrub_packet(skb, !net_eq(net, dev_net(dev)));
331 nf_reset(skb);
332} 333}
333 334
334/** 335/**
@@ -340,12 +341,13 @@ static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
340 * so make some cleanups, and perform accounting. 341 * so make some cleanups, and perform accounting.
341 * Note: this accounting is not SMP safe. 342 * Note: this accounting is not SMP safe.
342 */ 343 */
343static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) 344static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev,
345 struct net *net)
344{ 346{
345 /* TODO : stats should be SMP safe */ 347 /* TODO : stats should be SMP safe */
346 dev->stats.rx_packets++; 348 dev->stats.rx_packets++;
347 dev->stats.rx_bytes += skb->len; 349 dev->stats.rx_bytes += skb->len;
348 __skb_tunnel_rx(skb, dev); 350 __skb_tunnel_rx(skb, dev, net);
349} 351}
350 352
351/* Children define the path of the packet through the 353/* Children define the path of the packet through the
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 88d7d7d1eccb..ac9fabe0300f 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -461,8 +461,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
461 skb->dev = tunnel->dev; 461 skb->dev = tunnel->dev;
462 } 462 }
463 463
464 if (!net_eq(tunnel->net, dev_net(tunnel->dev))) 464 skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev)));
465 skb_scrub_packet(skb, true);
466 465
467 gro_cells_receive(&tunnel->gro_cells, skb); 466 gro_cells_receive(&tunnel->gro_cells, skb);
468 return 0; 467 return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index bacc0bcf48ce..9ae54b09254f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2067,9 +2067,8 @@ static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb,
2067 skb_reset_network_header(skb); 2067 skb_reset_network_header(skb);
2068 skb->protocol = htons(ETH_P_IP); 2068 skb->protocol = htons(ETH_P_IP);
2069 skb->ip_summed = CHECKSUM_NONE; 2069 skb->ip_summed = CHECKSUM_NONE;
2070 skb->pkt_type = PACKET_HOST;
2071 2070
2072 skb_tunnel_rx(skb, reg_dev); 2071 skb_tunnel_rx(skb, reg_dev, dev_net(reg_dev));
2073 2072
2074 netif_rx(skb); 2073 netif_rx(skb);
2075 2074
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index f179ff1f56ec..db992a373011 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -509,8 +509,6 @@ static int ip6gre_rcv(struct sk_buff *skb)
509 goto drop; 509 goto drop;
510 } 510 }
511 511
512 secpath_reset(skb);
513
514 skb->protocol = gre_proto; 512 skb->protocol = gre_proto;
515 /* WCCP version 1 and 2 protocol decoding. 513 /* WCCP version 1 and 2 protocol decoding.
516 * - Change protocol to IP 514 * - Change protocol to IP
@@ -525,7 +523,6 @@ static int ip6gre_rcv(struct sk_buff *skb)
525 skb->mac_header = skb->network_header; 523 skb->mac_header = skb->network_header;
526 __pskb_pull(skb, offset); 524 __pskb_pull(skb, offset);
527 skb_postpull_rcsum(skb, skb_transport_header(skb), offset); 525 skb_postpull_rcsum(skb, skb_transport_header(skb), offset);
528 skb->pkt_type = PACKET_HOST;
529 526
530 if (((flags&GRE_CSUM) && csum) || 527 if (((flags&GRE_CSUM) && csum) ||
531 (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { 528 (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) {
@@ -557,7 +554,7 @@ static int ip6gre_rcv(struct sk_buff *skb)
557 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); 554 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
558 } 555 }
559 556
560 __skb_tunnel_rx(skb, tunnel->dev); 557 __skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
561 558
562 skb_reset_network_header(skb); 559 skb_reset_network_header(skb);
563 560
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ecbcdbd4bc4f..55999d923f26 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -802,14 +802,12 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
802 rcu_read_unlock(); 802 rcu_read_unlock();
803 goto discard; 803 goto discard;
804 } 804 }
805 secpath_reset(skb);
806 skb->mac_header = skb->network_header; 805 skb->mac_header = skb->network_header;
807 skb_reset_network_header(skb); 806 skb_reset_network_header(skb);
808 skb->protocol = htons(protocol); 807 skb->protocol = htons(protocol);
809 skb->pkt_type = PACKET_HOST;
810 memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); 808 memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
811 809
812 __skb_tunnel_rx(skb, t->dev); 810 __skb_tunnel_rx(skb, t->dev, t->net);
813 811
814 err = dscp_ecn_decapsulate(t, ipv6h, skb); 812 err = dscp_ecn_decapsulate(t, ipv6h, skb);
815 if (unlikely(err)) { 813 if (unlikely(err)) {
@@ -829,9 +827,6 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
829 tstats->rx_packets++; 827 tstats->rx_packets++;
830 tstats->rx_bytes += skb->len; 828 tstats->rx_bytes += skb->len;
831 829
832 if (!net_eq(t->net, dev_net(t->dev)))
833 skb_scrub_packet(skb, true);
834
835 netif_rx(skb); 830 netif_rx(skb);
836 831
837 rcu_read_unlock(); 832 rcu_read_unlock();
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index a60a84ef04f7..f365310bfcca 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -672,9 +672,8 @@ static int pim6_rcv(struct sk_buff *skb)
672 skb_reset_network_header(skb); 672 skb_reset_network_header(skb);
673 skb->protocol = htons(ETH_P_IPV6); 673 skb->protocol = htons(ETH_P_IPV6);
674 skb->ip_summed = CHECKSUM_NONE; 674 skb->ip_summed = CHECKSUM_NONE;
675 skb->pkt_type = PACKET_HOST;
676 675
677 skb_tunnel_rx(skb, reg_dev); 676 skb_tunnel_rx(skb, reg_dev, dev_net(reg_dev));
678 677
679 netif_rx(skb); 678 netif_rx(skb);
680 679
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 82b425b9b7d2..19abcc9d6a1a 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -581,12 +581,10 @@ static int ipip6_rcv(struct sk_buff *skb)
581 tunnel->parms.iph.protocol != 0) 581 tunnel->parms.iph.protocol != 0)
582 goto out; 582 goto out;
583 583
584 secpath_reset(skb);
585 skb->mac_header = skb->network_header; 584 skb->mac_header = skb->network_header;
586 skb_reset_network_header(skb); 585 skb_reset_network_header(skb);
587 IPCB(skb)->flags = 0; 586 IPCB(skb)->flags = 0;
588 skb->protocol = htons(ETH_P_IPV6); 587 skb->protocol = htons(ETH_P_IPV6);
589 skb->pkt_type = PACKET_HOST;
590 588
591 if (tunnel->dev->priv_flags & IFF_ISATAP) { 589 if (tunnel->dev->priv_flags & IFF_ISATAP) {
592 if (!isatap_chksrc(skb, iph, tunnel)) { 590 if (!isatap_chksrc(skb, iph, tunnel)) {
@@ -603,7 +601,7 @@ static int ipip6_rcv(struct sk_buff *skb)
603 } 601 }
604 } 602 }
605 603
606 __skb_tunnel_rx(skb, tunnel->dev); 604 __skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
607 605
608 err = IP_ECN_decapsulate(iph, skb); 606 err = IP_ECN_decapsulate(iph, skb);
609 if (unlikely(err)) { 607 if (unlikely(err)) {
@@ -621,8 +619,6 @@ static int ipip6_rcv(struct sk_buff *skb)
621 tstats->rx_packets++; 619 tstats->rx_packets++;
622 tstats->rx_bytes += skb->len; 620 tstats->rx_bytes += skb->len;
623 621
624 if (!net_eq(tunnel->net, dev_net(tunnel->dev)))
625 skb_scrub_packet(skb, true);
626 netif_rx(skb); 622 netif_rx(skb);
627 623
628 return 0; 624 return 0;