Commit 9b4661bd6e5437508e0920608f3213c23212cd1b
Committed by
David S. Miller
1 parent
852566f53c
Exists in
master
and in
7 other branches
ipv4: add pernet mib operations
These ones are currently empty, but stuff from init_ipv4_mibs will sequentially migrate there. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 20 additions and 0 deletions Side-by-side Diff
net/ipv4/af_inet.c
... | ... | @@ -110,6 +110,7 @@ |
110 | 110 | #include <net/ipip.h> |
111 | 111 | #include <net/inet_common.h> |
112 | 112 | #include <net/xfrm.h> |
113 | +#include <net/net_namespace.h> | |
113 | 114 | #ifdef CONFIG_IP_MROUTE |
114 | 115 | #include <linux/mroute.h> |
115 | 116 | #endif |
... | ... | @@ -1339,6 +1340,20 @@ |
1339 | 1340 | .netns_ok = 1, |
1340 | 1341 | }; |
1341 | 1342 | |
1343 | +static __net_init int ipv4_mib_init_net(struct net *net) | |
1344 | +{ | |
1345 | + return 0; | |
1346 | +} | |
1347 | + | |
1348 | +static __net_exit void ipv4_mib_exit_net(struct net *net) | |
1349 | +{ | |
1350 | +} | |
1351 | + | |
1352 | +static __net_initdata struct pernet_operations ipv4_mib_ops = { | |
1353 | + .init = ipv4_mib_init_net, | |
1354 | + .exit = ipv4_mib_exit_net, | |
1355 | +}; | |
1356 | + | |
1342 | 1357 | static int __init init_ipv4_mibs(void) |
1343 | 1358 | { |
1344 | 1359 | if (snmp_mib_init((void **)net_statistics, |
1345 | 1360 | |
... | ... | @@ -1365,8 +1380,13 @@ |
1365 | 1380 | |
1366 | 1381 | tcp_mib_init(&init_net); |
1367 | 1382 | |
1383 | + if (register_pernet_subsys(&ipv4_mib_ops)) | |
1384 | + goto err_net; | |
1385 | + | |
1368 | 1386 | return 0; |
1369 | 1387 | |
1388 | +err_net: | |
1389 | + snmp_mib_free((void **)udplite_statistics); | |
1370 | 1390 | err_udplite_mib: |
1371 | 1391 | snmp_mib_free((void **)udp_statistics); |
1372 | 1392 | err_udp_mib: |