diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-07-18 04:02:42 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-18 04:02:42 -0700 |
commit | a20f5799ca7ceb24d63c74b6fdad4b0c0ee91f4f (patch) | |
tree | 0262e4a674c611044d78c9f62f378473df0ce0f1 /net | |
parent | 57ef42d59d1c1d79be59fc3c6380ae14234e38c3 (diff) | |
download | linux-a20f5799ca7ceb24d63c74b6fdad4b0c0ee91f4f.tar.gz |
mib: put ip statistics on struct net
Similar to tcp one.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/af_inet.c | 11 | ||||
-rw-r--r-- | net/ipv4/ip_input.c | 8 | ||||
-rw-r--r-- | net/ipv4/proc.c | 4 |
3 files changed, 8 insertions, 15 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index c1a3e986f8b4..3090a9307c46 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1345,16 +1345,22 @@ static __net_init int ipv4_mib_init_net(struct net *net) if (snmp_mib_init((void **)net->mib.tcp_statistics, sizeof(struct tcp_mib)) < 0) goto err_tcp_mib; + if (snmp_mib_init((void **)net->mib.ip_statistics, + sizeof(struct ipstats_mib)) < 0) + goto err_ip_mib; tcp_mib_init(net); return 0; +err_ip_mib: + snmp_mib_free((void **)net->mib.tcp_statistics); err_tcp_mib: return -ENOMEM; } static __net_exit void ipv4_mib_exit_net(struct net *net) { + snmp_mib_free((void **)net->mib.ip_statistics); snmp_mib_free((void **)net->mib.tcp_statistics); } @@ -1368,9 +1374,6 @@ static int __init init_ipv4_mibs(void) if (snmp_mib_init((void **)net_statistics, sizeof(struct linux_mib)) < 0) goto err_net_mib; - if (snmp_mib_init((void **)ip_statistics, - sizeof(struct ipstats_mib)) < 0) - goto err_ip_mib; if (snmp_mib_init((void **)icmp_statistics, sizeof(struct icmp_mib)) < 0) goto err_icmp_mib; @@ -1398,8 +1401,6 @@ err_udp_mib: err_icmpmsg_mib: snmp_mib_free((void **)icmp_statistics); err_icmp_mib: - snmp_mib_free((void **)ip_statistics); -err_ip_mib: snmp_mib_free((void **)net_statistics); err_net_mib: return -ENOMEM; diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 043f640df4b7..e0bed56c51f1 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -145,12 +145,6 @@ #include <linux/netlink.h> /* - * SNMP management statistics - */ - -DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics) __read_mostly; - -/* * Process Router Attention IP option */ int ip_call_ra_chain(struct sk_buff *skb) @@ -447,5 +441,3 @@ drop: out: return NET_RX_DROP; } - -EXPORT_SYMBOL(ip_statistics); diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 19e1d8e257da..2698bb2ce98f 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -344,7 +344,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) seq_printf(seq, " %lu", - snmp_fold_field((void **)ip_statistics, + snmp_fold_field((void **)init_net.mib.ip_statistics, snmp4_ipstats_list[i].entry)); icmp_put(seq); /* RFC 2011 compatibility */ @@ -431,7 +431,7 @@ static int netstat_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "\nIpExt:"); for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++) seq_printf(seq, " %lu", - snmp_fold_field((void **)ip_statistics, + snmp_fold_field((void **)init_net.mib.ip_statistics, snmp4_ipextstats_list[i].entry)); seq_putc(seq, '\n'); |