aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-18 07:04:22 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-18 07:04:22 -0400
commit923c6586b0dc0a00df07a1608185437145a0c68b (patch)
treebbe3324b4ae8920a3a50e81e596c75db11cc9433 /net/ipv4
parentb60538a0d737609213e4b758881913498d3ff0b4 (diff)
mib: put icmpmsg 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.c12
-rw-r--r--net/ipv4/icmp.c5
-rw-r--r--net/ipv4/proc.c10
3 files changed, 11 insertions, 16 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5c72bb3adadd..36ff6dc769c6 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1358,10 +1358,15 @@ static __net_init int ipv4_mib_init_net(struct net *net)
1358 if (snmp_mib_init((void **)net->mib.icmp_statistics, 1358 if (snmp_mib_init((void **)net->mib.icmp_statistics,
1359 sizeof(struct icmp_mib)) < 0) 1359 sizeof(struct icmp_mib)) < 0)
1360 goto err_icmp_mib; 1360 goto err_icmp_mib;
1361 if (snmp_mib_init((void **)net->mib.icmpmsg_statistics,
1362 sizeof(struct icmpmsg_mib)) < 0)
1363 goto err_icmpmsg_mib;
1361 1364
1362 tcp_mib_init(net); 1365 tcp_mib_init(net);
1363 return 0; 1366 return 0;
1364 1367
1368err_icmpmsg_mib:
1369 snmp_mib_free((void **)net->mib.icmp_statistics);
1365err_icmp_mib: 1370err_icmp_mib:
1366 snmp_mib_free((void **)net->mib.udplite_statistics); 1371 snmp_mib_free((void **)net->mib.udplite_statistics);
1367err_udplite_mib: 1372err_udplite_mib:
@@ -1378,6 +1383,7 @@ err_tcp_mib:
1378 1383
1379static __net_exit void ipv4_mib_exit_net(struct net *net) 1384static __net_exit void ipv4_mib_exit_net(struct net *net)
1380{ 1385{
1386 snmp_mib_free((void **)net->mib.icmpmsg_statistics);
1381 snmp_mib_free((void **)net->mib.icmp_statistics); 1387 snmp_mib_free((void **)net->mib.icmp_statistics);
1382 snmp_mib_free((void **)net->mib.udplite_statistics); 1388 snmp_mib_free((void **)net->mib.udplite_statistics);
1383 snmp_mib_free((void **)net->mib.udp_statistics); 1389 snmp_mib_free((void **)net->mib.udp_statistics);
@@ -1393,18 +1399,12 @@ static __net_initdata struct pernet_operations ipv4_mib_ops = {
1393 1399
1394static int __init init_ipv4_mibs(void) 1400static int __init init_ipv4_mibs(void)
1395{ 1401{
1396 if (snmp_mib_init((void **)icmpmsg_statistics,
1397 sizeof(struct icmpmsg_mib)) < 0)
1398 goto err_icmpmsg_mib;
1399
1400 if (register_pernet_subsys(&ipv4_mib_ops)) 1402 if (register_pernet_subsys(&ipv4_mib_ops))
1401 goto err_net; 1403 goto err_net;
1402 1404
1403 return 0; 1405 return 0;
1404 1406
1405err_net: 1407err_net:
1406 snmp_mib_free((void **)icmpmsg_statistics);
1407err_icmpmsg_mib:
1408 return -ENOMEM; 1408 return -ENOMEM;
1409} 1409}
1410 1410
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 33f958902d9b..860558633b2c 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -111,11 +111,6 @@ struct icmp_bxm {
111 unsigned char optbuf[40]; 111 unsigned char optbuf[40];
112}; 112};
113 113
114/*
115 * Statistics
116 */
117DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics) __read_mostly;
118
119/* An array of errno for error messages from dest unreach. */ 114/* An array of errno for error messages from dest unreach. */
120/* 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'. */
121 116
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 6b43cce05587..e11144b0134a 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -270,7 +270,7 @@ static void icmpmsg_put(struct seq_file *seq)
270 count = 0; 270 count = 0;
271 for (i = 0; i < ICMPMSG_MIB_MAX; i++) { 271 for (i = 0; i < ICMPMSG_MIB_MAX; i++) {
272 272
273 if (snmp_fold_field((void **) icmpmsg_statistics, i)) 273 if (snmp_fold_field((void **) init_net.mib.icmpmsg_statistics, i))
274 out[count++] = i; 274 out[count++] = i;
275 if (count < PERLINE) 275 if (count < PERLINE)
276 continue; 276 continue;
@@ -282,7 +282,7 @@ static void icmpmsg_put(struct seq_file *seq)
282 seq_printf(seq, "\nIcmpMsg: "); 282 seq_printf(seq, "\nIcmpMsg: ");
283 for (j = 0; j < PERLINE; ++j) 283 for (j = 0; j < PERLINE; ++j)
284 seq_printf(seq, " %lu", 284 seq_printf(seq, " %lu",
285 snmp_fold_field((void **) icmpmsg_statistics, 285 snmp_fold_field((void **) init_net.mib.icmpmsg_statistics,
286 out[j])); 286 out[j]));
287 seq_putc(seq, '\n'); 287 seq_putc(seq, '\n');
288 } 288 }
@@ -294,7 +294,7 @@ static void icmpmsg_put(struct seq_file *seq)
294 seq_printf(seq, "\nIcmpMsg:"); 294 seq_printf(seq, "\nIcmpMsg:");
295 for (j = 0; j < count; ++j) 295 for (j = 0; j < count; ++j)
296 seq_printf(seq, " %lu", snmp_fold_field((void **) 296 seq_printf(seq, " %lu", snmp_fold_field((void **)
297 icmpmsg_statistics, out[j])); 297 init_net.mib.icmpmsg_statistics, out[j]));
298 } 298 }
299 299
300#undef PERLINE 300#undef PERLINE
@@ -315,14 +315,14 @@ static void icmp_put(struct seq_file *seq)
315 snmp_fold_field((void **) init_net.mib.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 **) init_net.mib.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 **) init_net.mib.icmp_statistics, ICMP_MIB_OUTMSGS), 321 snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_OUTMSGS),
322 snmp_fold_field((void **) init_net.mib.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 **) init_net.mib.icmpmsg_statistics,
326 icmpmibmap[i].index | 0x100)); 326 icmpmibmap[i].index | 0x100));
327} 327}
328 328