diff options
-rw-r--r-- | net/sysctl_net.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 007c1a6708ee..63ada437fc2f 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -35,8 +35,22 @@ net_ctl_header_lookup(struct ctl_table_root *root, struct nsproxy *namespaces) | |||
35 | return &namespaces->net_ns->sysctl_table_headers; | 35 | return &namespaces->net_ns->sysctl_table_headers; |
36 | } | 36 | } |
37 | 37 | ||
38 | /* Return standard mode bits for table entry. */ | ||
39 | static int net_ctl_permissions(struct ctl_table_root *root, | ||
40 | struct nsproxy *nsproxy, | ||
41 | struct ctl_table *table) | ||
42 | { | ||
43 | /* Allow network administrator to have same access as root. */ | ||
44 | if (capable(CAP_NET_ADMIN)) { | ||
45 | int mode = (table->mode >> 6) & 7; | ||
46 | return (mode << 6) | (mode << 3) | mode; | ||
47 | } | ||
48 | return table->mode; | ||
49 | } | ||
50 | |||
38 | static struct ctl_table_root net_sysctl_root = { | 51 | static struct ctl_table_root net_sysctl_root = { |
39 | .lookup = net_ctl_header_lookup, | 52 | .lookup = net_ctl_header_lookup, |
53 | .permissions = net_ctl_permissions, | ||
40 | }; | 54 | }; |
41 | 55 | ||
42 | static LIST_HEAD(net_sysctl_ro_tables); | 56 | static LIST_HEAD(net_sysctl_ro_tables); |