aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_netlink.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-11-30 08:21:31 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:24 -0500
commitb854272b3c732316676e9128f7b9e6f1e1ff88b0 (patch)
treec90c74b9ec068453881f1173da4c57d6bb00a7d9 /net/bridge/br_netlink.c
parentad5d20a63940fcfb40af76ba06148f36d5d0b433 (diff)
[NET]: Modify all rtnetlink methods to only work in the initial namespace (v2)
Before I can enable rtnetlink to work in all network namespaces I need to be certain that something won't break. So this patch deliberately disables all of the rtnletlink methods in everything except the initial network namespace. After the methods have been audited this extra check can be disabled. Changes from v1: - added IPv6 addrlabel protection Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'net/bridge/br_netlink.c')
-rw-r--r--net/bridge/br_netlink.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 53ab8e0cb518..a4ffa2b63cd5 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <net/rtnetlink.h> 14#include <net/rtnetlink.h>
15#include <net/net_namespace.h> 15#include <net/net_namespace.h>
16#include <net/sock.h>
16#include "br_private.h" 17#include "br_private.h"
17 18
18static inline size_t br_nlmsg_size(void) 19static inline size_t br_nlmsg_size(void)
@@ -107,9 +108,13 @@ errout:
107 */ 108 */
108static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) 109static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
109{ 110{
111 struct net *net = skb->sk->sk_net;
110 struct net_device *dev; 112 struct net_device *dev;
111 int idx; 113 int idx;
112 114
115 if (net != &init_net)
116 return 0;
117
113 idx = 0; 118 idx = 0;
114 for_each_netdev(&init_net, dev) { 119 for_each_netdev(&init_net, dev) {
115 /* not a bridge port */ 120 /* not a bridge port */
@@ -135,12 +140,16 @@ skip:
135 */ 140 */
136static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 141static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
137{ 142{
143 struct net *net = skb->sk->sk_net;
138 struct ifinfomsg *ifm; 144 struct ifinfomsg *ifm;
139 struct nlattr *protinfo; 145 struct nlattr *protinfo;
140 struct net_device *dev; 146 struct net_device *dev;
141 struct net_bridge_port *p; 147 struct net_bridge_port *p;
142 u8 new_state; 148 u8 new_state;
143 149
150 if (net != &init_net)
151 return -EINVAL;
152
144 if (nlmsg_len(nlh) < sizeof(*ifm)) 153 if (nlmsg_len(nlh) < sizeof(*ifm))
145 return -EINVAL; 154 return -EINVAL;
146 155