diff options
-rw-r--r-- | net/ipv4/raw.c | 22 | ||||
-rw-r--r-- | net/ipv6/raw.c | 22 |
2 files changed, 38 insertions, 6 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 206c869db921..91a52184351d 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -1003,15 +1003,31 @@ static const struct file_operations raw_seq_fops = { | |||
1003 | .release = seq_release_net, | 1003 | .release = seq_release_net, |
1004 | }; | 1004 | }; |
1005 | 1005 | ||
1006 | int __init raw_proc_init(void) | 1006 | static __net_init int raw_init_net(struct net *net) |
1007 | { | 1007 | { |
1008 | if (!proc_net_fops_create(&init_net, "raw", S_IRUGO, &raw_seq_fops)) | 1008 | if (!proc_net_fops_create(net, "raw", S_IRUGO, &raw_seq_fops)) |
1009 | return -ENOMEM; | 1009 | return -ENOMEM; |
1010 | |||
1010 | return 0; | 1011 | return 0; |
1011 | } | 1012 | } |
1012 | 1013 | ||
1014 | static __net_exit void raw_exit_net(struct net *net) | ||
1015 | { | ||
1016 | proc_net_remove(net, "raw"); | ||
1017 | } | ||
1018 | |||
1019 | static __net_initdata struct pernet_operations raw_net_ops = { | ||
1020 | .init = raw_init_net, | ||
1021 | .exit = raw_exit_net, | ||
1022 | }; | ||
1023 | |||
1024 | int __init raw_proc_init(void) | ||
1025 | { | ||
1026 | return register_pernet_subsys(&raw_net_ops); | ||
1027 | } | ||
1028 | |||
1013 | void __init raw_proc_exit(void) | 1029 | void __init raw_proc_exit(void) |
1014 | { | 1030 | { |
1015 | proc_net_remove(&init_net, "raw"); | 1031 | unregister_pernet_subsys(&raw_net_ops); |
1016 | } | 1032 | } |
1017 | #endif /* CONFIG_PROC_FS */ | 1033 | #endif /* CONFIG_PROC_FS */ |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 970529e4754a..4d880551fe6a 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1270,16 +1270,32 @@ static const struct file_operations raw6_seq_fops = { | |||
1270 | .release = seq_release_net, | 1270 | .release = seq_release_net, |
1271 | }; | 1271 | }; |
1272 | 1272 | ||
1273 | int __init raw6_proc_init(void) | 1273 | static int raw6_init_net(struct net *net) |
1274 | { | 1274 | { |
1275 | if (!proc_net_fops_create(&init_net, "raw6", S_IRUGO, &raw6_seq_fops)) | 1275 | if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops)) |
1276 | return -ENOMEM; | 1276 | return -ENOMEM; |
1277 | |||
1277 | return 0; | 1278 | return 0; |
1278 | } | 1279 | } |
1279 | 1280 | ||
1281 | static void raw6_exit_net(struct net *net) | ||
1282 | { | ||
1283 | proc_net_remove(net, "raw6"); | ||
1284 | } | ||
1285 | |||
1286 | static struct pernet_operations raw6_net_ops = { | ||
1287 | .init = raw6_init_net, | ||
1288 | .exit = raw6_exit_net, | ||
1289 | }; | ||
1290 | |||
1291 | int __init raw6_proc_init(void) | ||
1292 | { | ||
1293 | return register_pernet_subsys(&raw6_net_ops); | ||
1294 | } | ||
1295 | |||
1280 | void raw6_proc_exit(void) | 1296 | void raw6_proc_exit(void) |
1281 | { | 1297 | { |
1282 | proc_net_remove(&init_net, "raw6"); | 1298 | unregister_pernet_subsys(&raw6_net_ops); |
1283 | } | 1299 | } |
1284 | #endif /* CONFIG_PROC_FS */ | 1300 | #endif /* CONFIG_PROC_FS */ |
1285 | 1301 | ||