Commit 84c375af0ff61e0bd15fac0aed0438640494483e

Authored by Pavel Emelyanov
Committed by David S. Miller
1 parent ff2bac6a63

[NETNS][UDP-Lite]: Register /proc/net/udplite(6) in a namespace.

UDP-Lite sockets are displayed in another files, rather than
UDP ones, so make the present in namespaces as well.

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

Showing 2 changed files with 33 additions and 3 deletions Side-by-side Diff

... ... @@ -83,9 +83,24 @@
83 83 .seq_fops = &udplite4_seq_fops,
84 84 };
85 85  
  86 +static int udplite4_proc_init_net(struct net *net)
  87 +{
  88 + return udp_proc_register(net, &udplite4_seq_afinfo);
  89 +}
  90 +
  91 +static void udplite4_proc_exit_net(struct net *net)
  92 +{
  93 + udp_proc_unregister(net, &udplite4_seq_afinfo);
  94 +}
  95 +
  96 +static struct pernet_operations udplite4_net_ops = {
  97 + .init = udplite4_proc_init_net,
  98 + .exit = udplite4_proc_exit_net,
  99 +};
  100 +
86 101 static __init int udplite4_proc_init(void)
87 102 {
88   - return udp_proc_register(&init_net, &udplite4_seq_afinfo);
  103 + return register_pernet_subsys(&udplite4_net_ops);
89 104 }
90 105 #else
91 106 static inline int udplite4_proc_init(void)
... ... @@ -109,14 +109,29 @@
109 109 .seq_fops = &udplite6_seq_fops,
110 110 };
111 111  
  112 +static int udplite6_proc_init_net(struct net *net)
  113 +{
  114 + return udp_proc_register(net, &udplite6_seq_afinfo);
  115 +}
  116 +
  117 +static void udplite6_proc_exit_net(struct net *net)
  118 +{
  119 + udp_proc_unregister(net, &udplite6_seq_afinfo);
  120 +}
  121 +
  122 +static struct pernet_operations udplite6_net_ops = {
  123 + .init = udplite6_proc_init_net,
  124 + .exit = udplite6_proc_exit_net,
  125 +};
  126 +
112 127 int __init udplite6_proc_init(void)
113 128 {
114   - return udp_proc_register(&init_net, &udplite6_seq_afinfo);
  129 + return register_pernet_subsys(&udplite6_net_ops);
115 130 }
116 131  
117 132 void udplite6_proc_exit(void)
118 133 {
119   - udp_proc_unregister(&init_net, &udplite6_seq_afinfo);
  134 + unregister_pernet_subsys(&udplite6_net_ops);
120 135 }
121 136 #endif