aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2013-09-02 09:34:58 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-04 00:27:26 -0400
commitea23192e8e577dfc51e0f4fc5ca113af334edff9 (patch)
tree3568561a6128c5395dc0cf1b0f105e313d848d9b /net
parent963a88b31ddbbe99f38502239b1a46601773d217 (diff)
tunnels: harmonize cleanup done on skb on rx path
The goal of this patch is to harmonize cleanup done on a skbuff on rx path. Before this patch, behaviors were different depending of the tunnel type. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-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
6 files changed, 6 insertions, 21 deletions
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;