diff options
| -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 2ada033406de..eede36e55702 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
| @@ -617,6 +617,8 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
| 617 | read_lock(&ipgre_lock); | 617 | read_lock(&ipgre_lock); |
| 618 | if ((tunnel = ipgre_tunnel_lookup(dev_net(skb->dev), | 618 | if ((tunnel = ipgre_tunnel_lookup(dev_net(skb->dev), |
| 619 | iph->saddr, iph->daddr, key)) != NULL) { | 619 | iph->saddr, iph->daddr, key)) != NULL) { |
| 620 | struct net_device_stats *stats = &tunnel->dev->stats; | ||
| 621 | |||
| 620 | secpath_reset(skb); | 622 | secpath_reset(skb); |
| 621 | 623 | ||
| 622 | skb->protocol = *(__be16*)(h + 2); | 624 | skb->protocol = *(__be16*)(h + 2); |
| @@ -641,28 +643,28 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
| 641 | /* Looped back packet, drop it! */ | 643 | /* Looped back packet, drop it! */ |
| 642 | if (skb->rtable->fl.iif == 0) | 644 | if (skb->rtable->fl.iif == 0) |
| 643 | goto drop; | 645 | goto drop; |
| 644 | tunnel->stat.multicast++; | 646 | stats->multicast++; |
| 645 | skb->pkt_type = PACKET_BROADCAST; | 647 | skb->pkt_type = PACKET_BROADCAST; |
| 646 | } | 648 | } |
| 647 | #endif | 649 | #endif |
| 648 | 650 | ||
| 649 | if (((flags&GRE_CSUM) && csum) || | 651 | if (((flags&GRE_CSUM) && csum) || |
| 650 | (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { | 652 | (!(flags&GRE_CSUM) && tunnel->parms.i_flags&GRE_CSUM)) { |
| 651 | tunnel->stat.rx_crc_errors++; | 653 | stats->rx_crc_errors++; |
| 652 | tunnel->stat.rx_errors++; | 654 | stats->rx_errors++; |
| 653 | goto drop; | 655 | goto drop; |
| 654 | } | 656 | } |
| 655 | if (tunnel->parms.i_flags&GRE_SEQ) { | 657 | if (tunnel->parms.i_flags&GRE_SEQ) { |
| 656 | if (!(flags&GRE_SEQ) || | 658 | if (!(flags&GRE_SEQ) || |
| 657 | (tunnel->i_seqno && (s32)(seqno - tunnel->i_seqno) < 0)) { | 659 | (tunnel->i_seqno && (s32)(seqno - tunnel->i_seqno) < 0)) { |
| 658 | tunnel->stat.rx_fifo_errors++; | 660 | stats->rx_fifo_errors++; |
| 659 | tunnel->stat.rx_errors++; | 661 | stats->rx_errors++; |
| 660 | goto drop; | 662 | goto drop; |
| 661 | } | 663 | } |
| 662 | tunnel->i_seqno = seqno + 1; | 664 | tunnel->i_seqno = seqno + 1; |
| 663 | } | 665 | } |
| 664 | tunnel->stat.rx_packets++; | 666 | stats->rx_packets++; |
| 665 | tunnel->stat.rx_bytes += skb->len; | 667 | stats->rx_bytes += skb->len; |
| 666 | skb->dev = tunnel->dev; | 668 | skb->dev = tunnel->dev; |
| 667 | dst_release(skb->dst); | 669 | dst_release(skb->dst); |
| 668 | skb->dst = NULL; | 670 | skb->dst = NULL; |
| @@ -684,7 +686,7 @@ drop_nolock: | |||
| 684 | static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | 686 | static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) |
| 685 | { | 687 | { |
| 686 | struct ip_tunnel *tunnel = netdev_priv(dev); | 688 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| 687 | struct net_device_stats *stats = &tunnel->stat; | 689 | struct net_device_stats *stats = &tunnel->dev->stats; |
| 688 | struct iphdr *old_iph = ip_hdr(skb); | 690 | struct iphdr *old_iph = ip_hdr(skb); |
| 689 | struct iphdr *tiph; | 691 | struct iphdr *tiph; |
| 690 | u8 tos; | 692 | u8 tos; |
| @@ -698,7 +700,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 698 | int mtu; | 700 | int mtu; |
| 699 | 701 | ||
| 700 | if (tunnel->recursion++) { | 702 | if (tunnel->recursion++) { |
| 701 | tunnel->stat.collisions++; | 703 | stats->collisions++; |
| 702 | goto tx_error; | 704 | goto tx_error; |
| 703 | } | 705 | } |
| 704 | 706 | ||
| @@ -714,7 +716,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 714 | /* NBMA tunnel */ | 716 | /* NBMA tunnel */ |
| 715 | 717 | ||
| 716 | if (skb->dst == NULL) { | 718 | if (skb->dst == NULL) { |
| 717 | tunnel->stat.tx_fifo_errors++; | 719 | stats->tx_fifo_errors++; |
| 718 | goto tx_error; | 720 | goto tx_error; |
| 719 | } | 721 | } |
| 720 | 722 | ||
| @@ -765,7 +767,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 765 | .tos = RT_TOS(tos) } }, | 767 | .tos = RT_TOS(tos) } }, |
| 766 | .proto = IPPROTO_GRE }; | 768 | .proto = IPPROTO_GRE }; |
| 767 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { | 769 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { |
| 768 | tunnel->stat.tx_carrier_errors++; | 770 | stats->tx_carrier_errors++; |
| 769 | goto tx_error; | 771 | goto tx_error; |
| 770 | } | 772 | } |
| 771 | } | 773 | } |
| @@ -773,7 +775,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 773 | 775 | ||
| 774 | if (tdev == dev) { | 776 | if (tdev == dev) { |
| 775 | ip_rt_put(rt); | 777 | ip_rt_put(rt); |
| 776 | tunnel->stat.collisions++; | 778 | stats->collisions++; |
| 777 | goto tx_error; | 779 | goto tx_error; |
| 778 | } | 780 | } |
| 779 | 781 | ||
| @@ -1098,11 +1100,6 @@ done: | |||
| 1098 | return err; | 1100 | return err; |
| 1099 | } | 1101 | } |
| 1100 | 1102 | ||
| 1101 | static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) | ||
| 1102 | { | ||
| 1103 | return &(((struct ip_tunnel*)netdev_priv(dev))->stat); | ||
| 1104 | } | ||
| 1105 | |||
| 1106 | static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) | 1103 | static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) |
| 1107 | { | 1104 | { |
| 1108 | struct ip_tunnel *tunnel = netdev_priv(dev); | 1105 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| @@ -1228,7 +1225,6 @@ static void ipgre_tunnel_setup(struct net_device *dev) | |||
| 1228 | dev->uninit = ipgre_tunnel_uninit; | 1225 | dev->uninit = ipgre_tunnel_uninit; |
| 1229 | dev->destructor = free_netdev; | 1226 | dev->destructor = free_netdev; |
| 1230 | dev->hard_start_xmit = ipgre_tunnel_xmit; | 1227 | dev->hard_start_xmit = ipgre_tunnel_xmit; |
| 1231 | dev->get_stats = ipgre_tunnel_get_stats; | ||
| 1232 | dev->do_ioctl = ipgre_tunnel_ioctl; | 1228 | dev->do_ioctl = ipgre_tunnel_ioctl; |
| 1233 | dev->change_mtu = ipgre_tunnel_change_mtu; | 1229 | dev->change_mtu = ipgre_tunnel_change_mtu; |
| 1234 | 1230 | ||
