diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-09-12 06:01:34 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:06 -0400 |
commit | 457c4cbc5a3dde259d2a1f15d5f9785290397267 (patch) | |
tree | a2ceee88780cbce27433b9a4434b3e9251efd81a /net/ipv4 | |
parent | 07feaebfcc10cd35e745c7073667935246494bee (diff) |
[NET]: Make /proc/net per network namespace
This patch makes /proc/net per network namespace. It modifies the global
variables proc_net and proc_net_stat to be per network namespace.
The proc_net file helpers are modified to take a network namespace argument,
and all of their callers are fixed to pass &init_net for that argument.
This ensures that all of the /proc/net files are only visible and
usable in the initial network namespace until the code behind them
has been updated to be handle multiple network namespaces.
Making /proc/net per namespace is necessary as at least some files
in /proc/net depend upon the set of network devices which is per
network namespace, and even more files in /proc/net have contents
that are relevant to a single network namespace.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/arp.c | 3 | ||||
-rw-r--r-- | net/ipv4/fib_hash.c | 5 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 17 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 3 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_app.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_conn.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 9 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblcr.c | 5 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_queue.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_CLUSTERIP.c | 3 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_recent.c | 5 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 17 | ||||
-rw-r--r-- | net/ipv4/proc.c | 11 | ||||
-rw-r--r-- | net/ipv4/raw.c | 5 | ||||
-rw-r--r-- | net/ipv4/route.c | 7 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 5 | ||||
-rw-r--r-- | net/ipv4/tcp_probe.c | 7 | ||||
-rw-r--r-- | net/ipv4/udp.c | 5 |
20 files changed, 77 insertions, 58 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 9ab9d534fbac..78dd3443016c 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -103,6 +103,7 @@ | |||
103 | #include <linux/sysctl.h> | 103 | #include <linux/sysctl.h> |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | #include <net/net_namespace.h> | ||
106 | #include <net/ip.h> | 107 | #include <net/ip.h> |
107 | #include <net/icmp.h> | 108 | #include <net/icmp.h> |
108 | #include <net/route.h> | 109 | #include <net/route.h> |
@@ -1400,7 +1401,7 @@ static const struct file_operations arp_seq_fops = { | |||
1400 | 1401 | ||
1401 | static int __init arp_proc_init(void) | 1402 | static int __init arp_proc_init(void) |
1402 | { | 1403 | { |
1403 | if (!proc_net_fops_create("arp", S_IRUGO, &arp_seq_fops)) | 1404 | if (!proc_net_fops_create(&init_net, "arp", S_IRUGO, &arp_seq_fops)) |
1404 | return -ENOMEM; | 1405 | return -ENOMEM; |
1405 | return 0; | 1406 | return 0; |
1406 | } | 1407 | } |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 9ad1d9ff9ce7..9fafbeea8fe6 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/netlink.h> | 35 | #include <linux/netlink.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | 37 | ||
38 | #include <net/net_namespace.h> | ||
38 | #include <net/ip.h> | 39 | #include <net/ip.h> |
39 | #include <net/protocol.h> | 40 | #include <net/protocol.h> |
40 | #include <net/route.h> | 41 | #include <net/route.h> |
@@ -1068,13 +1069,13 @@ static const struct file_operations fib_seq_fops = { | |||
1068 | 1069 | ||
1069 | int __init fib_proc_init(void) | 1070 | int __init fib_proc_init(void) |
1070 | { | 1071 | { |
1071 | if (!proc_net_fops_create("route", S_IRUGO, &fib_seq_fops)) | 1072 | if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_seq_fops)) |
1072 | return -ENOMEM; | 1073 | return -ENOMEM; |
1073 | return 0; | 1074 | return 0; |
1074 | } | 1075 | } |
1075 | 1076 | ||
1076 | void __init fib_proc_exit(void) | 1077 | void __init fib_proc_exit(void) |
1077 | { | 1078 | { |
1078 | proc_net_remove("route"); | 1079 | proc_net_remove(&init_net, "route"); |
1079 | } | 1080 | } |
1080 | #endif /* CONFIG_PROC_FS */ | 1081 | #endif /* CONFIG_PROC_FS */ |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 52b2891c63b7..be34bd556d58 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/netlink.h> | 73 | #include <linux/netlink.h> |
74 | #include <linux/init.h> | 74 | #include <linux/init.h> |
75 | #include <linux/list.h> | 75 | #include <linux/list.h> |
76 | #include <net/net_namespace.h> | ||
76 | #include <net/ip.h> | 77 | #include <net/ip.h> |
77 | #include <net/protocol.h> | 78 | #include <net/protocol.h> |
78 | #include <net/route.h> | 79 | #include <net/route.h> |
@@ -2530,30 +2531,30 @@ static const struct file_operations fib_route_fops = { | |||
2530 | 2531 | ||
2531 | int __init fib_proc_init(void) | 2532 | int __init fib_proc_init(void) |
2532 | { | 2533 | { |
2533 | if (!proc_net_fops_create("fib_trie", S_IRUGO, &fib_trie_fops)) | 2534 | if (!proc_net_fops_create(&init_net, "fib_trie", S_IRUGO, &fib_trie_fops)) |
2534 | goto out1; | 2535 | goto out1; |
2535 | 2536 | ||
2536 | if (!proc_net_fops_create("fib_triestat", S_IRUGO, &fib_triestat_fops)) | 2537 | if (!proc_net_fops_create(&init_net, "fib_triestat", S_IRUGO, &fib_triestat_fops)) |
2537 | goto out2; | 2538 | goto out2; |
2538 | 2539 | ||
2539 | if (!proc_net_fops_create("route", S_IRUGO, &fib_route_fops)) | 2540 | if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_route_fops)) |
2540 | goto out3; | 2541 | goto out3; |
2541 | 2542 | ||
2542 | return 0; | 2543 | return 0; |
2543 | 2544 | ||
2544 | out3: | 2545 | out3: |
2545 | proc_net_remove("fib_triestat"); | 2546 | proc_net_remove(&init_net, "fib_triestat"); |
2546 | out2: | 2547 | out2: |
2547 | proc_net_remove("fib_trie"); | 2548 | proc_net_remove(&init_net, "fib_trie"); |
2548 | out1: | 2549 | out1: |
2549 | return -ENOMEM; | 2550 | return -ENOMEM; |
2550 | } | 2551 | } |
2551 | 2552 | ||
2552 | void __init fib_proc_exit(void) | 2553 | void __init fib_proc_exit(void) |
2553 | { | 2554 | { |
2554 | proc_net_remove("fib_trie"); | 2555 | proc_net_remove(&init_net, "fib_trie"); |
2555 | proc_net_remove("fib_triestat"); | 2556 | proc_net_remove(&init_net, "fib_triestat"); |
2556 | proc_net_remove("route"); | 2557 | proc_net_remove(&init_net, "route"); |
2557 | } | 2558 | } |
2558 | 2559 | ||
2559 | #endif /* CONFIG_PROC_FS */ | 2560 | #endif /* CONFIG_PROC_FS */ |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index a646409c2d06..d78599a9dbd5 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -91,6 +91,7 @@ | |||
91 | #include <linux/rtnetlink.h> | 91 | #include <linux/rtnetlink.h> |
92 | #include <linux/times.h> | 92 | #include <linux/times.h> |
93 | 93 | ||
94 | #include <net/net_namespace.h> | ||
94 | #include <net/arp.h> | 95 | #include <net/arp.h> |
95 | #include <net/ip.h> | 96 | #include <net/ip.h> |
96 | #include <net/protocol.h> | 97 | #include <net/protocol.h> |
@@ -2613,8 +2614,8 @@ static const struct file_operations igmp_mcf_seq_fops = { | |||
2613 | 2614 | ||
2614 | int __init igmp_mc_proc_init(void) | 2615 | int __init igmp_mc_proc_init(void) |
2615 | { | 2616 | { |
2616 | proc_net_fops_create("igmp", S_IRUGO, &igmp_mc_seq_fops); | 2617 | proc_net_fops_create(&init_net, "igmp", S_IRUGO, &igmp_mc_seq_fops); |
2617 | proc_net_fops_create("mcfilter", S_IRUGO, &igmp_mcf_seq_fops); | 2618 | proc_net_fops_create(&init_net, "mcfilter", S_IRUGO, &igmp_mcf_seq_fops); |
2618 | return 0; | 2619 | return 0; |
2619 | } | 2620 | } |
2620 | #endif | 2621 | #endif |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index c5b247077539..5ae4849878a3 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/root_dev.h> | 55 | #include <linux/root_dev.h> |
56 | #include <linux/delay.h> | 56 | #include <linux/delay.h> |
57 | #include <linux/nfs_fs.h> | 57 | #include <linux/nfs_fs.h> |
58 | #include <net/net_namespace.h> | ||
58 | #include <net/arp.h> | 59 | #include <net/arp.h> |
59 | #include <net/ip.h> | 60 | #include <net/ip.h> |
60 | #include <net/ipconfig.h> | 61 | #include <net/ipconfig.h> |
@@ -1253,7 +1254,7 @@ static int __init ip_auto_config(void) | |||
1253 | __be32 addr; | 1254 | __be32 addr; |
1254 | 1255 | ||
1255 | #ifdef CONFIG_PROC_FS | 1256 | #ifdef CONFIG_PROC_FS |
1256 | proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops); | 1257 | proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops); |
1257 | #endif /* CONFIG_PROC_FS */ | 1258 | #endif /* CONFIG_PROC_FS */ |
1258 | 1259 | ||
1259 | if (!ic_enable) | 1260 | if (!ic_enable) |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 7003cc1b7fe2..35683e1a42e8 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/mroute.h> | 49 | #include <linux/mroute.h> |
50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
51 | #include <linux/if_ether.h> | 51 | #include <linux/if_ether.h> |
52 | #include <net/net_namespace.h> | ||
52 | #include <net/ip.h> | 53 | #include <net/ip.h> |
53 | #include <net/protocol.h> | 54 | #include <net/protocol.h> |
54 | #include <linux/skbuff.h> | 55 | #include <linux/skbuff.h> |
@@ -1922,7 +1923,7 @@ void __init ip_mr_init(void) | |||
1922 | ipmr_expire_timer.function=ipmr_expire_process; | 1923 | ipmr_expire_timer.function=ipmr_expire_process; |
1923 | register_netdevice_notifier(&ip_mr_notifier); | 1924 | register_netdevice_notifier(&ip_mr_notifier); |
1924 | #ifdef CONFIG_PROC_FS | 1925 | #ifdef CONFIG_PROC_FS |
1925 | proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops); | 1926 | proc_net_fops_create(&init_net, "ip_mr_vif", 0, &ipmr_vif_fops); |
1926 | proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops); | 1927 | proc_net_fops_create(&init_net, "ip_mr_cache", 0, &ipmr_mfc_fops); |
1927 | #endif | 1928 | #endif |
1928 | } | 1929 | } |
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index 8d6901d4e94f..341474eefa55 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
26 | #include <linux/in.h> | 26 | #include <linux/in.h> |
27 | #include <linux/ip.h> | 27 | #include <linux/ip.h> |
28 | #include <net/net_namespace.h> | ||
28 | #include <net/protocol.h> | 29 | #include <net/protocol.h> |
29 | #include <net/tcp.h> | 30 | #include <net/tcp.h> |
30 | #include <asm/system.h> | 31 | #include <asm/system.h> |
@@ -616,12 +617,12 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, | |||
616 | int ip_vs_app_init(void) | 617 | int ip_vs_app_init(void) |
617 | { | 618 | { |
618 | /* we will replace it with proc_net_ipvs_create() soon */ | 619 | /* we will replace it with proc_net_ipvs_create() soon */ |
619 | proc_net_fops_create("ip_vs_app", 0, &ip_vs_app_fops); | 620 | proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops); |
620 | return 0; | 621 | return 0; |
621 | } | 622 | } |
622 | 623 | ||
623 | 624 | ||
624 | void ip_vs_app_cleanup(void) | 625 | void ip_vs_app_cleanup(void) |
625 | { | 626 | { |
626 | proc_net_remove("ip_vs_app"); | 627 | proc_net_remove(&init_net, "ip_vs_app"); |
627 | } | 628 | } |
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index d612a6a5d957..4b702f708d30 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/jhash.h> | 35 | #include <linux/jhash.h> |
36 | #include <linux/random.h> | 36 | #include <linux/random.h> |
37 | 37 | ||
38 | #include <net/net_namespace.h> | ||
38 | #include <net/ip_vs.h> | 39 | #include <net/ip_vs.h> |
39 | 40 | ||
40 | 41 | ||
@@ -922,7 +923,7 @@ int ip_vs_conn_init(void) | |||
922 | rwlock_init(&__ip_vs_conntbl_lock_array[idx].l); | 923 | rwlock_init(&__ip_vs_conntbl_lock_array[idx].l); |
923 | } | 924 | } |
924 | 925 | ||
925 | proc_net_fops_create("ip_vs_conn", 0, &ip_vs_conn_fops); | 926 | proc_net_fops_create(&init_net, "ip_vs_conn", 0, &ip_vs_conn_fops); |
926 | 927 | ||
927 | /* calculate the random value for connection hash */ | 928 | /* calculate the random value for connection hash */ |
928 | get_random_bytes(&ip_vs_conn_rnd, sizeof(ip_vs_conn_rnd)); | 929 | get_random_bytes(&ip_vs_conn_rnd, sizeof(ip_vs_conn_rnd)); |
@@ -938,6 +939,6 @@ void ip_vs_conn_cleanup(void) | |||
938 | 939 | ||
939 | /* Release the empty cache */ | 940 | /* Release the empty cache */ |
940 | kmem_cache_destroy(ip_vs_conn_cachep); | 941 | kmem_cache_destroy(ip_vs_conn_cachep); |
941 | proc_net_remove("ip_vs_conn"); | 942 | proc_net_remove(&init_net, "ip_vs_conn"); |
942 | vfree(ip_vs_conn_tab); | 943 | vfree(ip_vs_conn_tab); |
943 | } | 944 | } |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index f656d41d8d41..61d023d58b5d 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/netfilter_ipv4.h> | 35 | #include <linux/netfilter_ipv4.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | 37 | ||
38 | #include <net/net_namespace.h> | ||
38 | #include <net/ip.h> | 39 | #include <net/ip.h> |
39 | #include <net/route.h> | 40 | #include <net/route.h> |
40 | #include <net/sock.h> | 41 | #include <net/sock.h> |
@@ -2356,8 +2357,8 @@ int ip_vs_control_init(void) | |||
2356 | return ret; | 2357 | return ret; |
2357 | } | 2358 | } |
2358 | 2359 | ||
2359 | proc_net_fops_create("ip_vs", 0, &ip_vs_info_fops); | 2360 | proc_net_fops_create(&init_net, "ip_vs", 0, &ip_vs_info_fops); |
2360 | proc_net_fops_create("ip_vs_stats",0, &ip_vs_stats_fops); | 2361 | proc_net_fops_create(&init_net, "ip_vs_stats",0, &ip_vs_stats_fops); |
2361 | 2362 | ||
2362 | sysctl_header = register_sysctl_table(vs_root_table); | 2363 | sysctl_header = register_sysctl_table(vs_root_table); |
2363 | 2364 | ||
@@ -2390,8 +2391,8 @@ void ip_vs_control_cleanup(void) | |||
2390 | cancel_work_sync(&defense_work.work); | 2391 | cancel_work_sync(&defense_work.work); |
2391 | ip_vs_kill_estimator(&ip_vs_stats); | 2392 | ip_vs_kill_estimator(&ip_vs_stats); |
2392 | unregister_sysctl_table(sysctl_header); | 2393 | unregister_sysctl_table(sysctl_header); |
2393 | proc_net_remove("ip_vs_stats"); | 2394 | proc_net_remove(&init_net, "ip_vs_stats"); |
2394 | proc_net_remove("ip_vs"); | 2395 | proc_net_remove(&init_net, "ip_vs"); |
2395 | nf_unregister_sockopt(&ip_vs_sockopts); | 2396 | nf_unregister_sockopt(&ip_vs_sockopts); |
2396 | LeaveFunction(2); | 2397 | LeaveFunction(2); |
2397 | } | 2398 | } |
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index 6225acac7a3b..6a1fec416eaf 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/sysctl.h> | 50 | #include <linux/sysctl.h> |
51 | /* for proc_net_create/proc_net_remove */ | 51 | /* for proc_net_create/proc_net_remove */ |
52 | #include <linux/proc_fs.h> | 52 | #include <linux/proc_fs.h> |
53 | #include <net/net_namespace.h> | ||
53 | 54 | ||
54 | #include <net/ip_vs.h> | 55 | #include <net/ip_vs.h> |
55 | 56 | ||
@@ -843,7 +844,7 @@ static int __init ip_vs_lblcr_init(void) | |||
843 | INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); | 844 | INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); |
844 | sysctl_header = register_sysctl_table(lblcr_root_table); | 845 | sysctl_header = register_sysctl_table(lblcr_root_table); |
845 | #ifdef CONFIG_IP_VS_LBLCR_DEBUG | 846 | #ifdef CONFIG_IP_VS_LBLCR_DEBUG |
846 | proc_net_create("ip_vs_lblcr", 0, ip_vs_lblcr_getinfo); | 847 | proc_net_create(&init_net, "ip_vs_lblcr", 0, ip_vs_lblcr_getinfo); |
847 | #endif | 848 | #endif |
848 | return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); | 849 | return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); |
849 | } | 850 | } |
@@ -852,7 +853,7 @@ static int __init ip_vs_lblcr_init(void) | |||
852 | static void __exit ip_vs_lblcr_cleanup(void) | 853 | static void __exit ip_vs_lblcr_cleanup(void) |
853 | { | 854 | { |
854 | #ifdef CONFIG_IP_VS_LBLCR_DEBUG | 855 | #ifdef CONFIG_IP_VS_LBLCR_DEBUG |
855 | proc_net_remove("ip_vs_lblcr"); | 856 | proc_net_remove(&init_net, "ip_vs_lblcr"); |
856 | #endif | 857 | #endif |
857 | unregister_sysctl_table(sysctl_header); | 858 | unregister_sysctl_table(sysctl_header); |
858 | unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler); | 859 | unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler); |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 702d94db19b9..cb5e61a1d7ab 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_fs.h> |
25 | #include <linux/security.h> | 25 | #include <linux/security.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <net/net_namespace.h> | ||
27 | #include <net/sock.h> | 28 | #include <net/sock.h> |
28 | #include <net/route.h> | 29 | #include <net/route.h> |
29 | 30 | ||
@@ -674,7 +675,7 @@ static int __init ip_queue_init(void) | |||
674 | goto cleanup_netlink_notifier; | 675 | goto cleanup_netlink_notifier; |
675 | } | 676 | } |
676 | 677 | ||
677 | proc = proc_net_create(IPQ_PROC_FS_NAME, 0, ipq_get_info); | 678 | proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); |
678 | if (proc) | 679 | if (proc) |
679 | proc->owner = THIS_MODULE; | 680 | proc->owner = THIS_MODULE; |
680 | else { | 681 | else { |
@@ -695,8 +696,7 @@ static int __init ip_queue_init(void) | |||
695 | cleanup_sysctl: | 696 | cleanup_sysctl: |
696 | unregister_sysctl_table(ipq_sysctl_header); | 697 | unregister_sysctl_table(ipq_sysctl_header); |
697 | unregister_netdevice_notifier(&ipq_dev_notifier); | 698 | unregister_netdevice_notifier(&ipq_dev_notifier); |
698 | proc_net_remove(IPQ_PROC_FS_NAME); | 699 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); |
699 | |||
700 | cleanup_ipqnl: | 700 | cleanup_ipqnl: |
701 | sock_release(ipqnl->sk_socket); | 701 | sock_release(ipqnl->sk_socket); |
702 | mutex_lock(&ipqnl_mutex); | 702 | mutex_lock(&ipqnl_mutex); |
@@ -715,7 +715,7 @@ static void __exit ip_queue_fini(void) | |||
715 | 715 | ||
716 | unregister_sysctl_table(ipq_sysctl_header); | 716 | unregister_sysctl_table(ipq_sysctl_header); |
717 | unregister_netdevice_notifier(&ipq_dev_notifier); | 717 | unregister_netdevice_notifier(&ipq_dev_notifier); |
718 | proc_net_remove(IPQ_PROC_FS_NAME); | 718 | proc_net_remove(&init_net, IPQ_PROC_FS_NAME); |
719 | 719 | ||
720 | sock_release(ipqnl->sk_socket); | 720 | sock_release(ipqnl->sk_socket); |
721 | mutex_lock(&ipqnl_mutex); | 721 | mutex_lock(&ipqnl_mutex); |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 69bd362b5fa2..50fc9e009fe4 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/netfilter_ipv4/ip_tables.h> | 25 | #include <linux/netfilter_ipv4/ip_tables.h> |
26 | #include <linux/netfilter_ipv4/ipt_CLUSTERIP.h> | 26 | #include <linux/netfilter_ipv4/ipt_CLUSTERIP.h> |
27 | #include <net/netfilter/nf_conntrack.h> | 27 | #include <net/netfilter/nf_conntrack.h> |
28 | #include <net/net_namespace.h> | ||
28 | #include <net/checksum.h> | 29 | #include <net/checksum.h> |
29 | 30 | ||
30 | #define CLUSTERIP_VERSION "0.8" | 31 | #define CLUSTERIP_VERSION "0.8" |
@@ -726,7 +727,7 @@ static int __init ipt_clusterip_init(void) | |||
726 | goto cleanup_target; | 727 | goto cleanup_target; |
727 | 728 | ||
728 | #ifdef CONFIG_PROC_FS | 729 | #ifdef CONFIG_PROC_FS |
729 | clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", proc_net); | 730 | clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", init_net.proc_net); |
730 | if (!clusterip_procdir) { | 731 | if (!clusterip_procdir) { |
731 | printk(KERN_ERR "CLUSTERIP: Unable to proc dir entry\n"); | 732 | printk(KERN_ERR "CLUSTERIP: Unable to proc dir entry\n"); |
732 | ret = -ENOMEM; | 733 | ret = -ENOMEM; |
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 6d0c0f7364ad..db2a79889f9a 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
25 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
26 | #include <linux/inet.h> | 26 | #include <linux/inet.h> |
27 | #include <net/net_namespace.h> | ||
27 | 28 | ||
28 | #include <linux/netfilter/x_tables.h> | 29 | #include <linux/netfilter/x_tables.h> |
29 | #include <linux/netfilter_ipv4/ipt_recent.h> | 30 | #include <linux/netfilter_ipv4/ipt_recent.h> |
@@ -487,7 +488,7 @@ static int __init ipt_recent_init(void) | |||
487 | #ifdef CONFIG_PROC_FS | 488 | #ifdef CONFIG_PROC_FS |
488 | if (err) | 489 | if (err) |
489 | return err; | 490 | return err; |
490 | proc_dir = proc_mkdir("ipt_recent", proc_net); | 491 | proc_dir = proc_mkdir("ipt_recent", init_net.proc_net); |
491 | if (proc_dir == NULL) { | 492 | if (proc_dir == NULL) { |
492 | xt_unregister_match(&recent_match); | 493 | xt_unregister_match(&recent_match); |
493 | err = -ENOMEM; | 494 | err = -ENOMEM; |
@@ -501,7 +502,7 @@ static void __exit ipt_recent_exit(void) | |||
501 | BUG_ON(!list_empty(&tables)); | 502 | BUG_ON(!list_empty(&tables)); |
502 | xt_unregister_match(&recent_match); | 503 | xt_unregister_match(&recent_match); |
503 | #ifdef CONFIG_PROC_FS | 504 | #ifdef CONFIG_PROC_FS |
504 | remove_proc_entry("ipt_recent", proc_net); | 505 | remove_proc_entry("ipt_recent", init_net.proc_net); |
505 | #endif | 506 | #endif |
506 | } | 507 | } |
507 | 508 | ||
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index b3dd5de9a258..a5ae2eabf0f3 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/proc_fs.h> | 11 | #include <linux/proc_fs.h> |
12 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
13 | #include <linux/percpu.h> | 13 | #include <linux/percpu.h> |
14 | #include <net/net_namespace.h> | ||
14 | 15 | ||
15 | #include <linux/netfilter.h> | 16 | #include <linux/netfilter.h> |
16 | #include <net/netfilter/nf_conntrack_core.h> | 17 | #include <net/netfilter/nf_conntrack_core.h> |
@@ -408,16 +409,16 @@ int __init nf_conntrack_ipv4_compat_init(void) | |||
408 | { | 409 | { |
409 | struct proc_dir_entry *proc, *proc_exp, *proc_stat; | 410 | struct proc_dir_entry *proc, *proc_exp, *proc_stat; |
410 | 411 | ||
411 | proc = proc_net_fops_create("ip_conntrack", 0440, &ct_file_ops); | 412 | proc = proc_net_fops_create(&init_net, "ip_conntrack", 0440, &ct_file_ops); |
412 | if (!proc) | 413 | if (!proc) |
413 | goto err1; | 414 | goto err1; |
414 | 415 | ||
415 | proc_exp = proc_net_fops_create("ip_conntrack_expect", 0440, | 416 | proc_exp = proc_net_fops_create(&init_net, "ip_conntrack_expect", 0440, |
416 | &ip_exp_file_ops); | 417 | &ip_exp_file_ops); |
417 | if (!proc_exp) | 418 | if (!proc_exp) |
418 | goto err2; | 419 | goto err2; |
419 | 420 | ||
420 | proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, proc_net_stat); | 421 | proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, init_net.proc_net_stat); |
421 | if (!proc_stat) | 422 | if (!proc_stat) |
422 | goto err3; | 423 | goto err3; |
423 | 424 | ||
@@ -427,16 +428,16 @@ int __init nf_conntrack_ipv4_compat_init(void) | |||
427 | return 0; | 428 | return 0; |
428 | 429 | ||
429 | err3: | 430 | err3: |
430 | proc_net_remove("ip_conntrack_expect"); | 431 | proc_net_remove(&init_net, "ip_conntrack_expect"); |
431 | err2: | 432 | err2: |
432 | proc_net_remove("ip_conntrack"); | 433 | proc_net_remove(&init_net, "ip_conntrack"); |
433 | err1: | 434 | err1: |
434 | return -ENOMEM; | 435 | return -ENOMEM; |
435 | } | 436 | } |
436 | 437 | ||
437 | void __exit nf_conntrack_ipv4_compat_fini(void) | 438 | void __exit nf_conntrack_ipv4_compat_fini(void) |
438 | { | 439 | { |
439 | remove_proc_entry("ip_conntrack", proc_net_stat); | 440 | remove_proc_entry("ip_conntrack", init_net.proc_net_stat); |
440 | proc_net_remove("ip_conntrack_expect"); | 441 | proc_net_remove(&init_net, "ip_conntrack_expect"); |
441 | proc_net_remove("ip_conntrack"); | 442 | proc_net_remove(&init_net, "ip_conntrack"); |
442 | } | 443 | } |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 986d1c83a000..95a8f8f2de71 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | * 2 of the License, or (at your option) any later version. | 34 | * 2 of the License, or (at your option) any later version. |
35 | */ | 35 | */ |
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <net/net_namespace.h> | ||
37 | #include <net/icmp.h> | 38 | #include <net/icmp.h> |
38 | #include <net/protocol.h> | 39 | #include <net/protocol.h> |
39 | #include <net/tcp.h> | 40 | #include <net/tcp.h> |
@@ -383,20 +384,20 @@ int __init ip_misc_proc_init(void) | |||
383 | { | 384 | { |
384 | int rc = 0; | 385 | int rc = 0; |
385 | 386 | ||
386 | if (!proc_net_fops_create("netstat", S_IRUGO, &netstat_seq_fops)) | 387 | if (!proc_net_fops_create(&init_net, "netstat", S_IRUGO, &netstat_seq_fops)) |
387 | goto out_netstat; | 388 | goto out_netstat; |
388 | 389 | ||
389 | if (!proc_net_fops_create("snmp", S_IRUGO, &snmp_seq_fops)) | 390 | if (!proc_net_fops_create(&init_net, "snmp", S_IRUGO, &snmp_seq_fops)) |
390 | goto out_snmp; | 391 | goto out_snmp; |
391 | 392 | ||
392 | if (!proc_net_fops_create("sockstat", S_IRUGO, &sockstat_seq_fops)) | 393 | if (!proc_net_fops_create(&init_net, "sockstat", S_IRUGO, &sockstat_seq_fops)) |
393 | goto out_sockstat; | 394 | goto out_sockstat; |
394 | out: | 395 | out: |
395 | return rc; | 396 | return rc; |
396 | out_sockstat: | 397 | out_sockstat: |
397 | proc_net_remove("snmp"); | 398 | proc_net_remove(&init_net, "snmp"); |
398 | out_snmp: | 399 | out_snmp: |
399 | proc_net_remove("netstat"); | 400 | proc_net_remove(&init_net, "netstat"); |
400 | out_netstat: | 401 | out_netstat: |
401 | rc = -ENOMEM; | 402 | rc = -ENOMEM; |
402 | goto out; | 403 | goto out; |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index c6d71526f625..216e01b0f44a 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <linux/in_route.h> | 59 | #include <linux/in_route.h> |
60 | #include <linux/route.h> | 60 | #include <linux/route.h> |
61 | #include <linux/skbuff.h> | 61 | #include <linux/skbuff.h> |
62 | #include <net/net_namespace.h> | ||
62 | #include <net/dst.h> | 63 | #include <net/dst.h> |
63 | #include <net/sock.h> | 64 | #include <net/sock.h> |
64 | #include <linux/gfp.h> | 65 | #include <linux/gfp.h> |
@@ -928,13 +929,13 @@ static const struct file_operations raw_seq_fops = { | |||
928 | 929 | ||
929 | int __init raw_proc_init(void) | 930 | int __init raw_proc_init(void) |
930 | { | 931 | { |
931 | if (!proc_net_fops_create("raw", S_IRUGO, &raw_seq_fops)) | 932 | if (!proc_net_fops_create(&init_net, "raw", S_IRUGO, &raw_seq_fops)) |
932 | return -ENOMEM; | 933 | return -ENOMEM; |
933 | return 0; | 934 | return 0; |
934 | } | 935 | } |
935 | 936 | ||
936 | void __init raw_proc_exit(void) | 937 | void __init raw_proc_exit(void) |
937 | { | 938 | { |
938 | proc_net_remove("raw"); | 939 | proc_net_remove(&init_net, "raw"); |
939 | } | 940 | } |
940 | #endif /* CONFIG_PROC_FS */ | 941 | #endif /* CONFIG_PROC_FS */ |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c7ca94bd152c..efd2a9202d68 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -91,6 +91,7 @@ | |||
91 | #include <linux/jhash.h> | 91 | #include <linux/jhash.h> |
92 | #include <linux/rcupdate.h> | 92 | #include <linux/rcupdate.h> |
93 | #include <linux/times.h> | 93 | #include <linux/times.h> |
94 | #include <net/net_namespace.h> | ||
94 | #include <net/protocol.h> | 95 | #include <net/protocol.h> |
95 | #include <net/ip.h> | 96 | #include <net/ip.h> |
96 | #include <net/route.h> | 97 | #include <net/route.h> |
@@ -3011,15 +3012,15 @@ int __init ip_rt_init(void) | |||
3011 | #ifdef CONFIG_PROC_FS | 3012 | #ifdef CONFIG_PROC_FS |
3012 | { | 3013 | { |
3013 | struct proc_dir_entry *rtstat_pde = NULL; /* keep gcc happy */ | 3014 | struct proc_dir_entry *rtstat_pde = NULL; /* keep gcc happy */ |
3014 | if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) || | 3015 | if (!proc_net_fops_create(&init_net, "rt_cache", S_IRUGO, &rt_cache_seq_fops) || |
3015 | !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, | 3016 | !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, |
3016 | proc_net_stat))) { | 3017 | init_net.proc_net_stat))) { |
3017 | return -ENOMEM; | 3018 | return -ENOMEM; |
3018 | } | 3019 | } |
3019 | rtstat_pde->proc_fops = &rt_cpu_seq_fops; | 3020 | rtstat_pde->proc_fops = &rt_cpu_seq_fops; |
3020 | } | 3021 | } |
3021 | #ifdef CONFIG_NET_CLS_ROUTE | 3022 | #ifdef CONFIG_NET_CLS_ROUTE |
3022 | create_proc_read_entry("rt_acct", 0, proc_net, ip_rt_acct_read, NULL); | 3023 | create_proc_read_entry("rt_acct", 0, init_net.proc_net, ip_rt_acct_read, NULL); |
3023 | #endif | 3024 | #endif |
3024 | #endif | 3025 | #endif |
3025 | #ifdef CONFIG_XFRM | 3026 | #ifdef CONFIG_XFRM |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index e089a978e128..8855e640e958 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/init.h> | 62 | #include <linux/init.h> |
63 | #include <linux/times.h> | 63 | #include <linux/times.h> |
64 | 64 | ||
65 | #include <net/net_namespace.h> | ||
65 | #include <net/icmp.h> | 66 | #include <net/icmp.h> |
66 | #include <net/inet_hashtables.h> | 67 | #include <net/inet_hashtables.h> |
67 | #include <net/tcp.h> | 68 | #include <net/tcp.h> |
@@ -2249,7 +2250,7 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo) | |||
2249 | afinfo->seq_fops->llseek = seq_lseek; | 2250 | afinfo->seq_fops->llseek = seq_lseek; |
2250 | afinfo->seq_fops->release = seq_release_private; | 2251 | afinfo->seq_fops->release = seq_release_private; |
2251 | 2252 | ||
2252 | p = proc_net_fops_create(afinfo->name, S_IRUGO, afinfo->seq_fops); | 2253 | p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops); |
2253 | if (p) | 2254 | if (p) |
2254 | p->data = afinfo; | 2255 | p->data = afinfo; |
2255 | else | 2256 | else |
@@ -2261,7 +2262,7 @@ void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo) | |||
2261 | { | 2262 | { |
2262 | if (!afinfo) | 2263 | if (!afinfo) |
2263 | return; | 2264 | return; |
2264 | proc_net_remove(afinfo->name); | 2265 | proc_net_remove(&init_net, afinfo->name); |
2265 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); | 2266 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); |
2266 | } | 2267 | } |
2267 | 2268 | ||
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index b76398d1b454..87dd5bff315f 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/ktime.h> | 27 | #include <linux/ktime.h> |
28 | #include <linux/time.h> | 28 | #include <linux/time.h> |
29 | #include <net/net_namespace.h> | ||
29 | 30 | ||
30 | #include <net/tcp.h> | 31 | #include <net/tcp.h> |
31 | 32 | ||
@@ -228,7 +229,7 @@ static __init int tcpprobe_init(void) | |||
228 | if (!tcp_probe.log) | 229 | if (!tcp_probe.log) |
229 | goto err0; | 230 | goto err0; |
230 | 231 | ||
231 | if (!proc_net_fops_create(procname, S_IRUSR, &tcpprobe_fops)) | 232 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &tcpprobe_fops)) |
232 | goto err0; | 233 | goto err0; |
233 | 234 | ||
234 | ret = register_jprobe(&tcp_jprobe); | 235 | ret = register_jprobe(&tcp_jprobe); |
@@ -238,7 +239,7 @@ static __init int tcpprobe_init(void) | |||
238 | pr_info("TCP probe registered (port=%d)\n", port); | 239 | pr_info("TCP probe registered (port=%d)\n", port); |
239 | return 0; | 240 | return 0; |
240 | err1: | 241 | err1: |
241 | proc_net_remove(procname); | 242 | proc_net_remove(&init_net, procname); |
242 | err0: | 243 | err0: |
243 | kfree(tcp_probe.log); | 244 | kfree(tcp_probe.log); |
244 | return ret; | 245 | return ret; |
@@ -247,7 +248,7 @@ module_init(tcpprobe_init); | |||
247 | 248 | ||
248 | static __exit void tcpprobe_exit(void) | 249 | static __exit void tcpprobe_exit(void) |
249 | { | 250 | { |
250 | proc_net_remove(procname); | 251 | proc_net_remove(&init_net, procname); |
251 | unregister_jprobe(&tcp_jprobe); | 252 | unregister_jprobe(&tcp_jprobe); |
252 | kfree(tcp_probe.log); | 253 | kfree(tcp_probe.log); |
253 | } | 254 | } |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index a581b543bff7..ef4d901ee9ad 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -98,6 +98,7 @@ | |||
98 | #include <linux/skbuff.h> | 98 | #include <linux/skbuff.h> |
99 | #include <linux/proc_fs.h> | 99 | #include <linux/proc_fs.h> |
100 | #include <linux/seq_file.h> | 100 | #include <linux/seq_file.h> |
101 | #include <net/net_namespace.h> | ||
101 | #include <net/icmp.h> | 102 | #include <net/icmp.h> |
102 | #include <net/route.h> | 103 | #include <net/route.h> |
103 | #include <net/checksum.h> | 104 | #include <net/checksum.h> |
@@ -1566,7 +1567,7 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo) | |||
1566 | afinfo->seq_fops->llseek = seq_lseek; | 1567 | afinfo->seq_fops->llseek = seq_lseek; |
1567 | afinfo->seq_fops->release = seq_release_private; | 1568 | afinfo->seq_fops->release = seq_release_private; |
1568 | 1569 | ||
1569 | p = proc_net_fops_create(afinfo->name, S_IRUGO, afinfo->seq_fops); | 1570 | p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops); |
1570 | if (p) | 1571 | if (p) |
1571 | p->data = afinfo; | 1572 | p->data = afinfo; |
1572 | else | 1573 | else |
@@ -1578,7 +1579,7 @@ void udp_proc_unregister(struct udp_seq_afinfo *afinfo) | |||
1578 | { | 1579 | { |
1579 | if (!afinfo) | 1580 | if (!afinfo) |
1580 | return; | 1581 | return; |
1581 | proc_net_remove(afinfo->name); | 1582 | proc_net_remove(&init_net, afinfo->name); |
1582 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); | 1583 | memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); |
1583 | } | 1584 | } |
1584 | 1585 | ||