diff options
Diffstat (limited to 'net/ipv4/icmp.c')
-rw-r--r-- | net/ipv4/icmp.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 87397351ddac..860558633b2c 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Alan Cox, <alan@redhat.com> | 4 | * Alan Cox, <alan@redhat.com> |
5 | * | 5 | * |
6 | * Version: $Id: icmp.c,v 1.85 2002/02/01 22:01:03 davem Exp $ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * as published by the Free Software Foundation; either version | 8 | * as published by the Free Software Foundation; either version |
@@ -113,12 +111,6 @@ struct icmp_bxm { | |||
113 | unsigned char optbuf[40]; | 111 | unsigned char optbuf[40]; |
114 | }; | 112 | }; |
115 | 113 | ||
116 | /* | ||
117 | * Statistics | ||
118 | */ | ||
119 | DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics) __read_mostly; | ||
120 | DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics) __read_mostly; | ||
121 | |||
122 | /* An array of errno for error messages from dest unreach. */ | 114 | /* An array of errno for error messages from dest unreach. */ |
123 | /* RFC 1122: 3.2.2.1 States that NET_UNREACH, HOST_UNREACH and SR_FAILED MUST be considered 'transient errs'. */ | 115 | /* RFC 1122: 3.2.2.1 States that NET_UNREACH, HOST_UNREACH and SR_FAILED MUST be considered 'transient errs'. */ |
124 | 116 | ||
@@ -298,10 +290,10 @@ out: | |||
298 | /* | 290 | /* |
299 | * Maintain the counters used in the SNMP statistics for outgoing ICMP | 291 | * Maintain the counters used in the SNMP statistics for outgoing ICMP |
300 | */ | 292 | */ |
301 | void icmp_out_count(unsigned char type) | 293 | void icmp_out_count(struct net *net, unsigned char type) |
302 | { | 294 | { |
303 | ICMPMSGOUT_INC_STATS(type); | 295 | ICMPMSGOUT_INC_STATS(net, type); |
304 | ICMP_INC_STATS(ICMP_MIB_OUTMSGS); | 296 | ICMP_INC_STATS(net, ICMP_MIB_OUTMSGS); |
305 | } | 297 | } |
306 | 298 | ||
307 | /* | 299 | /* |
@@ -765,7 +757,7 @@ static void icmp_unreach(struct sk_buff *skb) | |||
765 | out: | 757 | out: |
766 | return; | 758 | return; |
767 | out_err: | 759 | out_err: |
768 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 760 | ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); |
769 | goto out; | 761 | goto out; |
770 | } | 762 | } |
771 | 763 | ||
@@ -805,7 +797,7 @@ static void icmp_redirect(struct sk_buff *skb) | |||
805 | out: | 797 | out: |
806 | return; | 798 | return; |
807 | out_err: | 799 | out_err: |
808 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 800 | ICMP_INC_STATS_BH(dev_net(skb->dev), ICMP_MIB_INERRORS); |
809 | goto out; | 801 | goto out; |
810 | } | 802 | } |
811 | 803 | ||
@@ -876,7 +868,7 @@ static void icmp_timestamp(struct sk_buff *skb) | |||
876 | out: | 868 | out: |
877 | return; | 869 | return; |
878 | out_err: | 870 | out_err: |
879 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 871 | ICMP_INC_STATS_BH(dev_net(skb->dst->dev), ICMP_MIB_INERRORS); |
880 | goto out; | 872 | goto out; |
881 | } | 873 | } |
882 | 874 | ||
@@ -975,6 +967,7 @@ int icmp_rcv(struct sk_buff *skb) | |||
975 | { | 967 | { |
976 | struct icmphdr *icmph; | 968 | struct icmphdr *icmph; |
977 | struct rtable *rt = skb->rtable; | 969 | struct rtable *rt = skb->rtable; |
970 | struct net *net = dev_net(rt->u.dst.dev); | ||
978 | 971 | ||
979 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 972 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
980 | int nh; | 973 | int nh; |
@@ -995,7 +988,7 @@ int icmp_rcv(struct sk_buff *skb) | |||
995 | skb_set_network_header(skb, nh); | 988 | skb_set_network_header(skb, nh); |
996 | } | 989 | } |
997 | 990 | ||
998 | ICMP_INC_STATS_BH(ICMP_MIB_INMSGS); | 991 | ICMP_INC_STATS_BH(net, ICMP_MIB_INMSGS); |
999 | 992 | ||
1000 | switch (skb->ip_summed) { | 993 | switch (skb->ip_summed) { |
1001 | case CHECKSUM_COMPLETE: | 994 | case CHECKSUM_COMPLETE: |
@@ -1013,7 +1006,7 @@ int icmp_rcv(struct sk_buff *skb) | |||
1013 | 1006 | ||
1014 | icmph = icmp_hdr(skb); | 1007 | icmph = icmp_hdr(skb); |
1015 | 1008 | ||
1016 | ICMPMSGIN_INC_STATS_BH(icmph->type); | 1009 | ICMPMSGIN_INC_STATS_BH(net, icmph->type); |
1017 | /* | 1010 | /* |
1018 | * 18 is the highest 'known' ICMP type. Anything else is a mystery | 1011 | * 18 is the highest 'known' ICMP type. Anything else is a mystery |
1019 | * | 1012 | * |
@@ -1029,9 +1022,6 @@ int icmp_rcv(struct sk_buff *skb) | |||
1029 | */ | 1022 | */ |
1030 | 1023 | ||
1031 | if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { | 1024 | if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { |
1032 | struct net *net; | ||
1033 | |||
1034 | net = dev_net(rt->u.dst.dev); | ||
1035 | /* | 1025 | /* |
1036 | * RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be | 1026 | * RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be |
1037 | * silently ignored (we let user decide with a sysctl). | 1027 | * silently ignored (we let user decide with a sysctl). |
@@ -1057,7 +1047,7 @@ drop: | |||
1057 | kfree_skb(skb); | 1047 | kfree_skb(skb); |
1058 | return 0; | 1048 | return 0; |
1059 | error: | 1049 | error: |
1060 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 1050 | ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); |
1061 | goto drop; | 1051 | goto drop; |
1062 | } | 1052 | } |
1063 | 1053 | ||
@@ -1217,5 +1207,4 @@ int __init icmp_init(void) | |||
1217 | 1207 | ||
1218 | EXPORT_SYMBOL(icmp_err_convert); | 1208 | EXPORT_SYMBOL(icmp_err_convert); |
1219 | EXPORT_SYMBOL(icmp_send); | 1209 | EXPORT_SYMBOL(icmp_send); |
1220 | EXPORT_SYMBOL(icmp_statistics); | ||
1221 | EXPORT_SYMBOL(xrlim_allow); | 1210 | EXPORT_SYMBOL(xrlim_allow); |