diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-09-09 01:19:58 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-09 01:19:58 +0200 |
commit | 4aa678ba44aa35759c04f300afbc97d3dab5faa2 (patch) | |
tree | fc4a2e01cde902913594b00461ea7e021fc223c4 /net/bridge/br_if.c | |
parent | warn: Turn the netdev timeout WARN_ON() into a WARN() (diff) | |
download | linux-4aa678ba44aa35759c04f300afbc97d3dab5faa2.tar.xz linux-4aa678ba44aa35759c04f300afbc97d3dab5faa2.zip |
netns bridge: allow bridges in netns!
Bridge as netdevice doesn't cross netns boundaries.
Bridge ports and bridge itself live in same netns.
Notifiers are fixed.
netns propagated from userspace socket for setup and teardown.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Stephen Hemminger <shemming@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r-- | net/bridge/br_if.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 63c18aacde8c..66c4f7122cf4 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -168,7 +168,7 @@ static void del_br(struct net_bridge *br) unregister_netdevice(br->dev); } -static struct net_device *new_bridge_dev(const char *name) +static struct net_device *new_bridge_dev(struct net *net, const char *name) { struct net_bridge *br; struct net_device *dev; @@ -178,6 +178,7 @@ static struct net_device *new_bridge_dev(const char *name) if (!dev) return NULL; + dev_net_set(dev, net); br = netdev_priv(dev); br->dev = dev; @@ -262,12 +263,12 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br, return p; } -int br_add_bridge(const char *name) +int br_add_bridge(struct net *net, const char *name) { struct net_device *dev; int ret; - dev = new_bridge_dev(name); + dev = new_bridge_dev(net, name); if (!dev) return -ENOMEM; @@ -294,13 +295,13 @@ out_free: goto out; } -int br_del_bridge(const char *name) +int br_del_bridge(struct net *net, const char *name) { struct net_device *dev; int ret = 0; rtnl_lock(); - dev = __dev_get_by_name(&init_net, name); + dev = __dev_get_by_name(net, name); if (dev == NULL) ret = -ENXIO; /* Could not find device */ |