diff options
-rw-r--r-- | include/net/net_namespace.h | 6 | ||||
-rw-r--r-- | include/net/netns/unix.h | 13 | ||||
-rw-r--r-- | net/unix/af_unix.c | 4 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 12 |
4 files changed, 24 insertions, 11 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index b62e31fca474..d943fd4eaba5 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/workqueue.h> | 8 | #include <linux/workqueue.h> |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | 10 | ||
11 | #include <net/netns/unix.h> | ||
12 | |||
11 | struct proc_dir_entry; | 13 | struct proc_dir_entry; |
12 | struct net_device; | 14 | struct net_device; |
13 | struct sock; | 15 | struct sock; |
@@ -45,9 +47,7 @@ struct net { | |||
45 | rwlock_t packet_sklist_lock; | 47 | rwlock_t packet_sklist_lock; |
46 | struct hlist_head packet_sklist; | 48 | struct hlist_head packet_sklist; |
47 | 49 | ||
48 | /* unix sockets */ | 50 | struct netns_unix unx; |
49 | int sysctl_unix_max_dgram_qlen; | ||
50 | struct ctl_table_header *unix_ctl; | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | #ifdef CONFIG_NET | 53 | #ifdef CONFIG_NET |
diff --git a/include/net/netns/unix.h b/include/net/netns/unix.h new file mode 100644 index 000000000000..284649d4dfb4 --- /dev/null +++ b/include/net/netns/unix.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * Unix network namespace | ||
3 | */ | ||
4 | #ifndef __NETNS_UNIX_H__ | ||
5 | #define __NETNS_UNIX_H__ | ||
6 | |||
7 | struct ctl_table_header; | ||
8 | struct netns_unix { | ||
9 | int sysctl_max_dgram_qlen; | ||
10 | struct ctl_table_header *ctl; | ||
11 | }; | ||
12 | |||
13 | #endif /* __NETNS_UNIX_H__ */ | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index b8a2189fb5c0..63a9239571a4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -592,7 +592,7 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
592 | &af_unix_sk_receive_queue_lock_key); | 592 | &af_unix_sk_receive_queue_lock_key); |
593 | 593 | ||
594 | sk->sk_write_space = unix_write_space; | 594 | sk->sk_write_space = unix_write_space; |
595 | sk->sk_max_ack_backlog = net->sysctl_unix_max_dgram_qlen; | 595 | sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; |
596 | sk->sk_destruct = unix_sock_destructor; | 596 | sk->sk_destruct = unix_sock_destructor; |
597 | u = unix_sk(sk); | 597 | u = unix_sk(sk); |
598 | u->dentry = NULL; | 598 | u->dentry = NULL; |
@@ -2138,7 +2138,7 @@ static int unix_net_init(struct net *net) | |||
2138 | { | 2138 | { |
2139 | int error = -ENOMEM; | 2139 | int error = -ENOMEM; |
2140 | 2140 | ||
2141 | net->sysctl_unix_max_dgram_qlen = 10; | 2141 | net->unx.sysctl_max_dgram_qlen = 10; |
2142 | if (unix_sysctl_register(net)) | 2142 | if (unix_sysctl_register(net)) |
2143 | goto out; | 2143 | goto out; |
2144 | 2144 | ||
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index 553ef6a487d0..77513d7e35f2 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -18,7 +18,7 @@ static ctl_table unix_table[] = { | |||
18 | { | 18 | { |
19 | .ctl_name = NET_UNIX_MAX_DGRAM_QLEN, | 19 | .ctl_name = NET_UNIX_MAX_DGRAM_QLEN, |
20 | .procname = "max_dgram_qlen", | 20 | .procname = "max_dgram_qlen", |
21 | .data = &init_net.sysctl_unix_max_dgram_qlen, | 21 | .data = &init_net.unx.sysctl_max_dgram_qlen, |
22 | .maxlen = sizeof(int), | 22 | .maxlen = sizeof(int), |
23 | .mode = 0644, | 23 | .mode = 0644, |
24 | .proc_handler = &proc_dointvec | 24 | .proc_handler = &proc_dointvec |
@@ -40,9 +40,9 @@ int unix_sysctl_register(struct net *net) | |||
40 | if (table == NULL) | 40 | if (table == NULL) |
41 | goto err_alloc; | 41 | goto err_alloc; |
42 | 42 | ||
43 | table[0].data = &net->sysctl_unix_max_dgram_qlen; | 43 | table[0].data = &net->unx.sysctl_max_dgram_qlen; |
44 | net->unix_ctl = register_net_sysctl_table(net, unix_path, table); | 44 | net->unx.ctl = register_net_sysctl_table(net, unix_path, table); |
45 | if (net->unix_ctl == NULL) | 45 | if (net->unx.ctl == NULL) |
46 | goto err_reg; | 46 | goto err_reg; |
47 | 47 | ||
48 | return 0; | 48 | return 0; |
@@ -57,8 +57,8 @@ void unix_sysctl_unregister(struct net *net) | |||
57 | { | 57 | { |
58 | struct ctl_table *table; | 58 | struct ctl_table *table; |
59 | 59 | ||
60 | table = net->unix_ctl->ctl_table_arg; | 60 | table = net->unx.ctl->ctl_table_arg; |
61 | unregister_sysctl_table(net->unix_ctl); | 61 | unregister_sysctl_table(net->unx.ctl); |
62 | kfree(table); | 62 | kfree(table); |
63 | } | 63 | } |
64 | 64 | ||