aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ip.h7
-rw-r--r--include/net/netns/mib.h1
-rw-r--r--net/ipv4/af_inet.c11
-rw-r--r--net/ipv4/ip_input.c8
-rw-r--r--net/ipv4/proc.c4
5 files changed, 12 insertions, 19 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 02924fb4bdbf..ff2535ada02e 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -156,10 +156,9 @@ struct ipv4_config
156}; 156};
157 157
158extern struct ipv4_config ipv4_config; 158extern struct ipv4_config ipv4_config;
159DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics); 159#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field)
160#define IP_INC_STATS(net, field) do { (void)net; SNMP_INC_STATS(ip_statistics, field); } while (0) 160#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field)
161#define IP_INC_STATS_BH(net, field) do { (void)net; SNMP_INC_STATS_BH(ip_statistics, field); } while (0) 161#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val)
162#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH(ip_statistics, field, val)
163DECLARE_SNMP_STAT(struct linux_mib, net_statistics); 162DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
164#define NET_INC_STATS(net, field) do { (void)net; SNMP_INC_STATS(net_statistics, field); } while (0) 163#define NET_INC_STATS(net, field) do { (void)net; SNMP_INC_STATS(net_statistics, field); } while (0)
165#define NET_INC_STATS_BH(net, field) do { (void)net; SNMP_INC_STATS_BH(net_statistics, field); } while (0) 164#define NET_INC_STATS_BH(net, field) do { (void)net; SNMP_INC_STATS_BH(net_statistics, field); } while (0)
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 8f96079bf0e3..1094ebbf0b42 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -5,6 +5,7 @@
5 5
6struct netns_mib { 6struct netns_mib {
7 DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics); 7 DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics);
8 DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics);
8}; 9};
9 10
10#endif 11#endif
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)
1345 if (snmp_mib_init((void **)net->mib.tcp_statistics, 1345 if (snmp_mib_init((void **)net->mib.tcp_statistics,
1346 sizeof(struct tcp_mib)) < 0) 1346 sizeof(struct tcp_mib)) < 0)
1347 goto err_tcp_mib; 1347 goto err_tcp_mib;
1348 if (snmp_mib_init((void **)net->mib.ip_statistics,
1349 sizeof(struct ipstats_mib)) < 0)
1350 goto err_ip_mib;
1348 1351
1349 tcp_mib_init(net); 1352 tcp_mib_init(net);
1350 return 0; 1353 return 0;
1351 1354
1355err_ip_mib:
1356 snmp_mib_free((void **)net->mib.tcp_statistics);
1352err_tcp_mib: 1357err_tcp_mib:
1353 return -ENOMEM; 1358 return -ENOMEM;
1354} 1359}
1355 1360
1356static __net_exit void ipv4_mib_exit_net(struct net *net) 1361static __net_exit void ipv4_mib_exit_net(struct net *net)
1357{ 1362{
1363 snmp_mib_free((void **)net->mib.ip_statistics);
1358 snmp_mib_free((void **)net->mib.tcp_statistics); 1364 snmp_mib_free((void **)net->mib.tcp_statistics);
1359} 1365}
1360 1366
@@ -1368,9 +1374,6 @@ static int __init init_ipv4_mibs(void)
1368 if (snmp_mib_init((void **)net_statistics, 1374 if (snmp_mib_init((void **)net_statistics,
1369 sizeof(struct linux_mib)) < 0) 1375 sizeof(struct linux_mib)) < 0)
1370 goto err_net_mib; 1376 goto err_net_mib;
1371 if (snmp_mib_init((void **)ip_statistics,
1372 sizeof(struct ipstats_mib)) < 0)
1373 goto err_ip_mib;
1374 if (snmp_mib_init((void **)icmp_statistics, 1377 if (snmp_mib_init((void **)icmp_statistics,
1375 sizeof(struct icmp_mib)) < 0) 1378 sizeof(struct icmp_mib)) < 0)
1376 goto err_icmp_mib; 1379 goto err_icmp_mib;
@@ -1398,8 +1401,6 @@ err_udp_mib:
1398err_icmpmsg_mib: 1401err_icmpmsg_mib:
1399 snmp_mib_free((void **)icmp_statistics); 1402 snmp_mib_free((void **)icmp_statistics);
1400err_icmp_mib: 1403err_icmp_mib:
1401 snmp_mib_free((void **)ip_statistics);
1402err_ip_mib:
1403 snmp_mib_free((void **)net_statistics); 1404 snmp_mib_free((void **)net_statistics);
1404err_net_mib: 1405err_net_mib:
1405 return -ENOMEM; 1406 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 @@
145#include <linux/netlink.h> 145#include <linux/netlink.h>
146 146
147/* 147/*
148 * SNMP management statistics
149 */
150
151DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics) __read_mostly;
152
153/*
154 * Process Router Attention IP option 148 * Process Router Attention IP option
155 */ 149 */
156int ip_call_ra_chain(struct sk_buff *skb) 150int ip_call_ra_chain(struct sk_buff *skb)
@@ -447,5 +441,3 @@ drop:
447out: 441out:
448 return NET_RX_DROP; 442 return NET_RX_DROP;
449} 443}
450
451EXPORT_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)
344 344
345 for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) 345 for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
346 seq_printf(seq, " %lu", 346 seq_printf(seq, " %lu",
347 snmp_fold_field((void **)ip_statistics, 347 snmp_fold_field((void **)init_net.mib.ip_statistics,
348 snmp4_ipstats_list[i].entry)); 348 snmp4_ipstats_list[i].entry));
349 349
350 icmp_put(seq); /* RFC 2011 compatibility */ 350 icmp_put(seq); /* RFC 2011 compatibility */
@@ -431,7 +431,7 @@ static int netstat_seq_show(struct seq_file *seq, void *v)
431 seq_puts(seq, "\nIpExt:"); 431 seq_puts(seq, "\nIpExt:");
432 for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++) 432 for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
433 seq_printf(seq, " %lu", 433 seq_printf(seq, " %lu",
434 snmp_fold_field((void **)ip_statistics, 434 snmp_fold_field((void **)init_net.mib.ip_statistics,
435 snmp4_ipextstats_list[i].entry)); 435 snmp4_ipextstats_list[i].entry));
436 436
437 seq_putc(seq, '\n'); 437 seq_putc(seq, '\n');