diff options
-rw-r--r-- | include/net/netns/mib.h | 1 | ||||
-rw-r--r-- | include/net/udp.h | 9 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 11 | ||||
-rw-r--r-- | net/ipv4/proc.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp.c | 3 |
5 files changed, 12 insertions, 14 deletions
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index b5b1115adfa..738c87ce183 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h | |||
@@ -7,6 +7,7 @@ struct 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 | DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics); |
9 | DEFINE_SNMP_STAT(struct linux_mib, net_statistics); | 9 | DEFINE_SNMP_STAT(struct linux_mib, net_statistics); |
10 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/net/udp.h b/include/net/udp.h index 3e551592aa7..ba554415270 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -148,7 +148,6 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
148 | char __user *optval, int optlen, | 148 | char __user *optval, int optlen, |
149 | int (*push_pending_frames)(struct sock *)); | 149 | int (*push_pending_frames)(struct sock *)); |
150 | 150 | ||
151 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | ||
152 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | 151 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); |
153 | 152 | ||
154 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | 153 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ |
@@ -158,12 +157,12 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | |||
158 | /* | 157 | /* |
159 | * SNMP statistics for UDP and UDP-Lite | 158 | * SNMP statistics for UDP and UDP-Lite |
160 | */ | 159 | */ |
161 | #define UDP_INC_STATS_USER(net, field, is_udplite) do { (void)net; \ | 160 | #define UDP_INC_STATS_USER(net, field, is_udplite) do { \ |
162 | if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \ | 161 | if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \ |
163 | else SNMP_INC_STATS_USER(udp_statistics, field); } while(0) | 162 | else SNMP_INC_STATS_USER((net)->mib.udp_statistics, field); } while(0) |
164 | #define UDP_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ | 163 | #define UDP_INC_STATS_BH(net, field, is_udplite) do { \ |
165 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ | 164 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ |
166 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) | 165 | else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) |
167 | 166 | ||
168 | #define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ | 167 | #define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ |
169 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | 168 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 776ed3199b5..1f418164ebf 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1349,10 +1349,15 @@ static __net_init int ipv4_mib_init_net(struct net *net) | |||
1349 | if (snmp_mib_init((void **)net->mib.net_statistics, | 1349 | if (snmp_mib_init((void **)net->mib.net_statistics, |
1350 | sizeof(struct linux_mib)) < 0) | 1350 | sizeof(struct linux_mib)) < 0) |
1351 | goto err_net_mib; | 1351 | goto err_net_mib; |
1352 | if (snmp_mib_init((void **)net->mib.udp_statistics, | ||
1353 | sizeof(struct udp_mib)) < 0) | ||
1354 | goto err_udp_mib; | ||
1352 | 1355 | ||
1353 | tcp_mib_init(net); | 1356 | tcp_mib_init(net); |
1354 | return 0; | 1357 | return 0; |
1355 | 1358 | ||
1359 | err_udp_mib: | ||
1360 | snmp_mib_free((void **)net->mib.net_statistics); | ||
1356 | err_net_mib: | 1361 | err_net_mib: |
1357 | snmp_mib_free((void **)net->mib.ip_statistics); | 1362 | snmp_mib_free((void **)net->mib.ip_statistics); |
1358 | err_ip_mib: | 1363 | err_ip_mib: |
@@ -1363,6 +1368,7 @@ err_tcp_mib: | |||
1363 | 1368 | ||
1364 | static __net_exit void ipv4_mib_exit_net(struct net *net) | 1369 | static __net_exit void ipv4_mib_exit_net(struct net *net) |
1365 | { | 1370 | { |
1371 | snmp_mib_free((void **)net->mib.udp_statistics); | ||
1366 | snmp_mib_free((void **)net->mib.net_statistics); | 1372 | snmp_mib_free((void **)net->mib.net_statistics); |
1367 | snmp_mib_free((void **)net->mib.ip_statistics); | 1373 | snmp_mib_free((void **)net->mib.ip_statistics); |
1368 | snmp_mib_free((void **)net->mib.tcp_statistics); | 1374 | snmp_mib_free((void **)net->mib.tcp_statistics); |
@@ -1381,9 +1387,6 @@ static int __init init_ipv4_mibs(void) | |||
1381 | if (snmp_mib_init((void **)icmpmsg_statistics, | 1387 | if (snmp_mib_init((void **)icmpmsg_statistics, |
1382 | sizeof(struct icmpmsg_mib)) < 0) | 1388 | sizeof(struct icmpmsg_mib)) < 0) |
1383 | goto err_icmpmsg_mib; | 1389 | goto err_icmpmsg_mib; |
1384 | if (snmp_mib_init((void **)udp_statistics, | ||
1385 | sizeof(struct udp_mib)) < 0) | ||
1386 | goto err_udp_mib; | ||
1387 | if (snmp_mib_init((void **)udplite_statistics, | 1390 | if (snmp_mib_init((void **)udplite_statistics, |
1388 | sizeof(struct udp_mib)) < 0) | 1391 | sizeof(struct udp_mib)) < 0) |
1389 | goto err_udplite_mib; | 1392 | goto err_udplite_mib; |
@@ -1396,8 +1399,6 @@ static int __init init_ipv4_mibs(void) | |||
1396 | err_net: | 1399 | err_net: |
1397 | snmp_mib_free((void **)udplite_statistics); | 1400 | snmp_mib_free((void **)udplite_statistics); |
1398 | err_udplite_mib: | 1401 | err_udplite_mib: |
1399 | snmp_mib_free((void **)udp_statistics); | ||
1400 | err_udp_mib: | ||
1401 | snmp_mib_free((void **)icmpmsg_statistics); | 1402 | snmp_mib_free((void **)icmpmsg_statistics); |
1402 | err_icmpmsg_mib: | 1403 | err_icmpmsg_mib: |
1403 | snmp_mib_free((void **)icmp_statistics); | 1404 | snmp_mib_free((void **)icmp_statistics); |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index ef38b1dccfd..869085c8e43 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -374,7 +374,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
374 | seq_puts(seq, "\nUdp:"); | 374 | seq_puts(seq, "\nUdp:"); |
375 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) | 375 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) |
376 | seq_printf(seq, " %lu", | 376 | seq_printf(seq, " %lu", |
377 | snmp_fold_field((void **)udp_statistics, | 377 | snmp_fold_field((void **)init_net.mib.udp_statistics, |
378 | snmp4_udp_list[i].entry)); | 378 | snmp4_udp_list[i].entry)); |
379 | 379 | ||
380 | /* the UDP and UDP-Lite MIBs are the same */ | 380 | /* the UDP and UDP-Lite MIBs are the same */ |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 1560d11ba6e..a751770947a 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -108,9 +108,6 @@ | |||
108 | * Snmp MIB for the UDP layer | 108 | * Snmp MIB for the UDP layer |
109 | */ | 109 | */ |
110 | 110 | ||
111 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly; | ||
112 | EXPORT_SYMBOL(udp_statistics); | ||
113 | |||
114 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; | 111 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; |
115 | EXPORT_SYMBOL(udp_stats_in6); | 112 | EXPORT_SYMBOL(udp_stats_in6); |
116 | 113 | ||