aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-18 07:04:02 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-18 07:04:02 -0400
commitb60538a0d737609213e4b758881913498d3ff0b4 (patch)
tree380b75c744b9eb13b56fe386b58ddc2106686372 /net/ipv4
parent386019d3514b3ed9de8d0b05b67e638a7048375b (diff)
mib: put icmp statistics on struct net
Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c11
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/proc.c8
3 files changed, 10 insertions, 11 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index bf1f200c6575..5c72bb3adadd 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1355,10 +1355,15 @@ static __net_init int ipv4_mib_init_net(struct net *net)
1355 if (snmp_mib_init((void **)net->mib.udplite_statistics, 1355 if (snmp_mib_init((void **)net->mib.udplite_statistics,
1356 sizeof(struct udp_mib)) < 0) 1356 sizeof(struct udp_mib)) < 0)
1357 goto err_udplite_mib; 1357 goto err_udplite_mib;
1358 if (snmp_mib_init((void **)net->mib.icmp_statistics,
1359 sizeof(struct icmp_mib)) < 0)
1360 goto err_icmp_mib;
1358 1361
1359 tcp_mib_init(net); 1362 tcp_mib_init(net);
1360 return 0; 1363 return 0;
1361 1364
1365err_icmp_mib:
1366 snmp_mib_free((void **)net->mib.udplite_statistics);
1362err_udplite_mib: 1367err_udplite_mib:
1363 snmp_mib_free((void **)net->mib.udp_statistics); 1368 snmp_mib_free((void **)net->mib.udp_statistics);
1364err_udp_mib: 1369err_udp_mib:
@@ -1373,6 +1378,7 @@ err_tcp_mib:
1373 1378
1374static __net_exit void ipv4_mib_exit_net(struct net *net) 1379static __net_exit void ipv4_mib_exit_net(struct net *net)
1375{ 1380{
1381 snmp_mib_free((void **)net->mib.icmp_statistics);
1376 snmp_mib_free((void **)net->mib.udplite_statistics); 1382 snmp_mib_free((void **)net->mib.udplite_statistics);
1377 snmp_mib_free((void **)net->mib.udp_statistics); 1383 snmp_mib_free((void **)net->mib.udp_statistics);
1378 snmp_mib_free((void **)net->mib.net_statistics); 1384 snmp_mib_free((void **)net->mib.net_statistics);
@@ -1387,9 +1393,6 @@ static __net_initdata struct pernet_operations ipv4_mib_ops = {
1387 1393
1388static int __init init_ipv4_mibs(void) 1394static int __init init_ipv4_mibs(void)
1389{ 1395{
1390 if (snmp_mib_init((void **)icmp_statistics,
1391 sizeof(struct icmp_mib)) < 0)
1392 goto err_icmp_mib;
1393 if (snmp_mib_init((void **)icmpmsg_statistics, 1396 if (snmp_mib_init((void **)icmpmsg_statistics,
1394 sizeof(struct icmpmsg_mib)) < 0) 1397 sizeof(struct icmpmsg_mib)) < 0)
1395 goto err_icmpmsg_mib; 1398 goto err_icmpmsg_mib;
@@ -1402,8 +1405,6 @@ static int __init init_ipv4_mibs(void)
1402err_net: 1405err_net:
1403 snmp_mib_free((void **)icmpmsg_statistics); 1406 snmp_mib_free((void **)icmpmsg_statistics);
1404err_icmpmsg_mib: 1407err_icmpmsg_mib:
1405 snmp_mib_free((void **)icmp_statistics);
1406err_icmp_mib:
1407 return -ENOMEM; 1408 return -ENOMEM;
1408} 1409}
1409 1410
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index ea60ad41008c..33f958902d9b 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -114,7 +114,6 @@ struct icmp_bxm {
114/* 114/*
115 * Statistics 115 * Statistics
116 */ 116 */
117DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics) __read_mostly;
118DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics) __read_mostly; 117DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics) __read_mostly;
119 118
120/* An array of errno for error messages from dest unreach. */ 119/* An array of errno for error messages from dest unreach. */
@@ -1213,5 +1212,4 @@ int __init icmp_init(void)
1213 1212
1214EXPORT_SYMBOL(icmp_err_convert); 1213EXPORT_SYMBOL(icmp_err_convert);
1215EXPORT_SYMBOL(icmp_send); 1214EXPORT_SYMBOL(icmp_send);
1216EXPORT_SYMBOL(icmp_statistics);
1217EXPORT_SYMBOL(xrlim_allow); 1215EXPORT_SYMBOL(xrlim_allow);
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 765418334b3c..6b43cce05587 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -311,15 +311,15 @@ static void icmp_put(struct seq_file *seq)
311 for (i=0; icmpmibmap[i].name != NULL; i++) 311 for (i=0; icmpmibmap[i].name != NULL; i++)
312 seq_printf(seq, " Out%s", icmpmibmap[i].name); 312 seq_printf(seq, " Out%s", icmpmibmap[i].name);
313 seq_printf(seq, "\nIcmp: %lu %lu", 313 seq_printf(seq, "\nIcmp: %lu %lu",
314 snmp_fold_field((void **) icmp_statistics, ICMP_MIB_INMSGS), 314 snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_INMSGS),
315 snmp_fold_field((void **) icmp_statistics, ICMP_MIB_INERRORS)); 315 snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_INERRORS));
316 for (i=0; icmpmibmap[i].name != NULL; i++) 316 for (i=0; icmpmibmap[i].name != NULL; i++)
317 seq_printf(seq, " %lu", 317 seq_printf(seq, " %lu",
318 snmp_fold_field((void **) icmpmsg_statistics, 318 snmp_fold_field((void **) icmpmsg_statistics,
319 icmpmibmap[i].index)); 319 icmpmibmap[i].index));
320 seq_printf(seq, " %lu %lu", 320 seq_printf(seq, " %lu %lu",
321 snmp_fold_field((void **) icmp_statistics, ICMP_MIB_OUTMSGS), 321 snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_OUTMSGS),
322 snmp_fold_field((void **) icmp_statistics, ICMP_MIB_OUTERRORS)); 322 snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_OUTERRORS));
323 for (i=0; icmpmibmap[i].name != NULL; i++) 323 for (i=0; icmpmibmap[i].name != NULL; i++)
324 seq_printf(seq, " %lu", 324 seq_printf(seq, " %lu",
325 snmp_fold_field((void **) icmpmsg_statistics, 325 snmp_fold_field((void **) icmpmsg_statistics,