Commit 757764f61d07ab8ff84699b6d608eac7bc94cecc

Authored by Pavel Emelyanov
Committed by David S. Miller
1 parent 15439febb0

[NETNS][TCP]: Register /proc/net/tcp in a namespace.

After the commit f40c8174d3c21bf178283f3ef3aa8c7bf238fdec ([NETNS][IPV4]
tcp - make proc handle the network namespaces) it is now possible to make
this file present in newly created namespaces.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 17 additions and 2 deletions Side-by-side Diff

... ... @@ -2425,14 +2425,29 @@
2425 2425 .seq_fops = &tcp4_seq_fops,
2426 2426 };
2427 2427  
  2428 +static int tcp4_proc_init_net(struct net *net)
  2429 +{
  2430 + return tcp_proc_register(net, &tcp4_seq_afinfo);
  2431 +}
  2432 +
  2433 +static void tcp4_proc_exit_net(struct net *net)
  2434 +{
  2435 + tcp_proc_unregister(net, &tcp4_seq_afinfo);
  2436 +}
  2437 +
  2438 +static struct pernet_operations tcp4_net_ops = {
  2439 + .init = tcp4_proc_init_net,
  2440 + .exit = tcp4_proc_exit_net,
  2441 +};
  2442 +
2428 2443 int __init tcp4_proc_init(void)
2429 2444 {
2430   - return tcp_proc_register(&init_net, &tcp4_seq_afinfo);
  2445 + return register_pernet_subsys(&tcp4_net_ops);
2431 2446 }
2432 2447  
2433 2448 void tcp4_proc_exit(void)
2434 2449 {
2435   - tcp_proc_unregister(&init_net, &tcp4_seq_afinfo);
  2450 + unregister_pernet_subsys(&tcp4_net_ops);
2436 2451 }
2437 2452 #endif /* CONFIG_PROC_FS */
2438 2453