diff options
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 4342cba4ff82..2a61158ea722 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -473,6 +473,8 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
473 | read_lock(&ipgre_lock); | 473 | read_lock(&ipgre_lock); |
474 | if ((tunnel = ipgre_tunnel_lookup(dev_net(skb->dev), | 474 | if ((tunnel = ipgre_tunnel_lookup(dev_net(skb->dev), |
475 | iph->saddr, iph->daddr, key)) != NULL) { | 475 | iph->saddr, iph->daddr, key)) != NULL) { |
476 | struct net_device_stats *stats = &tunnel->dev->stats; | ||
477 | |||
476 | secpath_reset(skb); | 478 | secpath_reset(skb); |
477 | 479 | ||
478 | skb->protocol = *(__be16*)(h + 2); | 480 | skb->protocol = *(__be16*)(h + 2); |
@@ -497,28 +499,28 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
497 | /* Looped back packet, drop it! */ | 499 | /* Looped back packet, drop it! */ |
498 | if (skb->rtable->fl.iif == 0) | 500 | if (skb->rtable->fl.iif == 0) |
499 | goto drop; | 501 | goto drop; |
500 | tunnel->stat.multicast++; | 502 | stats->multicast++; |
501 | skb->pkt_type = PACKET_BROADCAST; | 503 | skb->pkt_type = PACKET_BROADCAST; |
502 | } | 504 | } |
503 | #endif | 505 | #endif |
504 | 506 | ||
505 | if (((flags&GRE_CSUM) && csum) || | 507 | if (((flags&GRE_CSUM) && csum) || |
506 | (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { | 508 | (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { |
507 | tunnel->stat.rx_crc_errors++; | 509 | stats->rx_crc_errors++; |
508 | tunnel->stat.rx_errors++; | 510 | stats->rx_errors++; |
509 | goto drop; | 511 | goto drop; |
510 | } | 512 | } |
511 | if (tunnel->parms.i_flags&GRE_SEQ) { | 513 | if (tunnel->parms.i_flags&GRE_SEQ) { |
512 | if (!(flags&GRE_SEQ) || | 514 | if (!(flags&GRE_SEQ) || |
513 | (tunnel->i_seqno && (s32)(seqno - tunnel->i_seqno) < 0)) { | 515 | (tunnel->i_seqno && (s32)(seqno - tunnel->i_seqno) < 0)) { |
514 | tunnel->stat.rx_fifo_errors++; | 516 | stats->rx_fifo_errors++; |
515 | tunnel->stat.rx_errors++; | 517 | stats->rx_errors++; |
516 | goto drop; | 518 | goto drop; |
517 | } | 519 | } |
518 | tunnel->i_seqno = seqno + 1; | 520 | tunnel->i_seqno = seqno + 1; |
519 | } | 521 | } |
520 | tunnel->stat.rx_packets++; | 522 | stats->rx_packets++; |
521 | tunnel->stat.rx_bytes += skb->len; | 523 | stats->rx_bytes += skb->len; |
522 | skb->dev = tunnel->dev; | 524 | skb->dev = tunnel->dev; |
523 | dst_release(skb->dst); | 525 | dst_release(skb->dst); |
524 | skb->dst = NULL; | 526 | skb->dst = NULL; |
@@ -540,7 +542,7 @@ drop_nolock: | |||
540 | static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | 542 | static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) |
541 | { | 543 | { |
542 | struct ip_tunnel *tunnel = netdev_priv(dev); | 544 | struct ip_tunnel *tunnel = netdev_priv(dev); |
543 | struct net_device_stats *stats = &tunnel->stat; | 545 | struct net_device_stats *stats = &tunnel->dev->stats; |
544 | struct iphdr *old_iph = ip_hdr(skb); | 546 | struct iphdr *old_iph = ip_hdr(skb); |
545 | struct iphdr *tiph; | 547 | struct iphdr *tiph; |
546 | u8 tos; | 548 | u8 tos; |
@@ -554,7 +556,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
554 | int mtu; | 556 | int mtu; |
555 | 557 | ||
556 | if (tunnel->recursion++) { | 558 | if (tunnel->recursion++) { |
557 | tunnel->stat.collisions++; | 559 | stats->collisions++; |
558 | goto tx_error; | 560 | goto tx_error; |
559 | } | 561 | } |
560 | 562 | ||
@@ -570,7 +572,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
570 | /* NBMA tunnel */ | 572 | /* NBMA tunnel */ |
571 | 573 | ||
572 | if (skb->dst == NULL) { | 574 | if (skb->dst == NULL) { |
573 | tunnel->stat.tx_fifo_errors++; | 575 | stats->tx_fifo_errors++; |
574 | goto tx_error; | 576 | goto tx_error; |
575 | } | 577 | } |
576 | 578 | ||
@@ -621,7 +623,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
621 | .tos = RT_TOS(tos) } }, | 623 | .tos = RT_TOS(tos) } }, |
622 | .proto = IPPROTO_GRE }; | 624 | .proto = IPPROTO_GRE }; |
623 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { | 625 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { |
624 | tunnel->stat.tx_carrier_errors++; | 626 | stats->tx_carrier_errors++; |
625 | goto tx_error; | 627 | goto tx_error; |
626 | } | 628 | } |
627 | } | 629 | } |
@@ -629,7 +631,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
629 | 631 | ||
630 | if (tdev == dev) { | 632 | if (tdev == dev) { |
631 | ip_rt_put(rt); | 633 | ip_rt_put(rt); |
632 | tunnel->stat.collisions++; | 634 | stats->collisions++; |
633 | goto tx_error; | 635 | goto tx_error; |
634 | } | 636 | } |
635 | 637 | ||
@@ -954,11 +956,6 @@ done: | |||
954 | return err; | 956 | return err; |
955 | } | 957 | } |
956 | 958 | ||
957 | static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) | ||
958 | { | ||
959 | return &(((struct ip_tunnel*)netdev_priv(dev))->stat); | ||
960 | } | ||
961 | |||
962 | static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) | 959 | static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) |
963 | { | 960 | { |
964 | struct ip_tunnel *tunnel = netdev_priv(dev); | 961 | struct ip_tunnel *tunnel = netdev_priv(dev); |
@@ -1084,7 +1081,6 @@ static void ipgre_tunnel_setup(struct net_device *dev) | |||
1084 | dev->uninit = ipgre_tunnel_uninit; | 1081 | dev->uninit = ipgre_tunnel_uninit; |
1085 | dev->destructor = free_netdev; | 1082 | dev->destructor = free_netdev; |
1086 | dev->hard_start_xmit = ipgre_tunnel_xmit; | 1083 | dev->hard_start_xmit = ipgre_tunnel_xmit; |
1087 | dev->get_stats = ipgre_tunnel_get_stats; | ||
1088 | dev->do_ioctl = ipgre_tunnel_ioctl; | 1084 | dev->do_ioctl = ipgre_tunnel_ioctl; |
1089 | dev->change_mtu = ipgre_tunnel_change_mtu; | 1085 | dev->change_mtu = ipgre_tunnel_change_mtu; |
1090 | 1086 | ||