aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/icmp.h5
-rw-r--r--include/net/netns/mib.h1
-rw-r--r--net/ipv4/af_inet.c12
-rw-r--r--net/ipv4/icmp.c5
-rw-r--r--net/ipv4/proc.c10
5 files changed, 14 insertions, 19 deletions
diff --git a/include/net/icmp.h b/include/net/icmp.h
index e14f2c03f42e..dfa72d4e8907 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -29,11 +29,10 @@ struct icmp_err {
29}; 29};
30 30
31extern struct icmp_err icmp_err_convert[]; 31extern struct icmp_err icmp_err_convert[];
32DECLARE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
33#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) 32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
34#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) 33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field)
35#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS(icmpmsg_statistics, field+256) 34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256)
36#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH(icmpmsg_statistics, field) 35#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmpmsg_statistics, field)
37 36
38struct dst_entry; 37struct dst_entry;
39struct net_proto_family; 38struct net_proto_family;
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 03f5abdf58e5..449147604642 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -10,6 +10,7 @@ struct netns_mib {
10 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); 10 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); 11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); 12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
13 DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
13}; 14};
14 15
15#endif 16#endif
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