aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-10-09 15:03:17 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-09 15:03:17 -0400
commit64194c31a0b6f5d84703b772113aafc400eeaad6 (patch)
tree68ade9b285112f8430ba29772f8318f0cb0553ed /net
parente1a8000228e16212c93b23cfbed4d622e2ec7a6b (diff)
inet: Make tunnel RX/TX byte counters more consistent
This patch makes the RX/TX byte counters for IPIP, GRE and SIT more consistent. Previously we included the external IP headers on the way out but not when the packet is inbound. The new scheme is to count payload only in both directions. For IPIP and SIT this simply means the exclusion of the external IP header. For GRE this means that we exclude the GRE header as well. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_gre.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 44ed9487fa15..0d5e35b0ed54 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -477,6 +477,7 @@ static int ipgre_rcv(struct sk_buff *skb)
477 struct ip_tunnel *tunnel; 477 struct ip_tunnel *tunnel;
478 int offset = 4; 478 int offset = 4;
479 __be16 gre_proto; 479 __be16 gre_proto;
480 unsigned int len;
480 481
481 if (!pskb_may_pull(skb, 16)) 482 if (!pskb_may_pull(skb, 16))
482 goto drop_nolock; 483 goto drop_nolock;
@@ -567,6 +568,8 @@ static int ipgre_rcv(struct sk_buff *skb)
567 tunnel->i_seqno = seqno + 1; 568 tunnel->i_seqno = seqno + 1;
568 } 569 }
569 570
571 len = skb->len;
572
570 /* Warning: All skb pointers will be invalidated! */ 573 /* Warning: All skb pointers will be invalidated! */
571 if (tunnel->dev->type == ARPHRD_ETHER) { 574 if (tunnel->dev->type == ARPHRD_ETHER) {
572 if (!pskb_may_pull(skb, ETH_HLEN)) { 575 if (!pskb_may_pull(skb, ETH_HLEN)) {
@@ -581,7 +584,7 @@ static int ipgre_rcv(struct sk_buff *skb)
581 } 584 }
582 585
583 stats->rx_packets++; 586 stats->rx_packets++;
584 stats->rx_bytes += skb->len; 587 stats->rx_bytes += len;
585 skb->dev = tunnel->dev; 588 skb->dev = tunnel->dev;
586 dst_release(skb->dst); 589 dst_release(skb->dst);
587 skb->dst = NULL; 590 skb->dst = NULL;
@@ -770,7 +773,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
770 old_iph = ip_hdr(skb); 773 old_iph = ip_hdr(skb);
771 } 774 }
772 775
773 skb->transport_header = skb->network_header; 776 skb_reset_transport_header(skb);
774 skb_push(skb, gre_hlen); 777 skb_push(skb, gre_hlen);
775 skb_reset_network_header(skb); 778 skb_reset_network_header(skb);
776 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 779 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));