lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87hbxjq38n.wl%chamas@h4.dion.ne.jp>
Date:	Sat, 11 Jul 2009 12:59:20 +0900
From:	Ken-ichirou MATSUZAWA <chamas@...dion.ne.jp>
To:	Stephen Hemminger <shemminger@...tta.com>
Cc:	Ken-ichirou MATSUZAWA <chamas@...dion.ne.jp>,
	netdev@...r.kernel.org
Subject: Re: [PATCH] don't touch bridge sysfs in container.

 Hello,

At Thu, 9 Jul 2009 14:23:17 -0700,
Stephen Hemminger wrote:

> Without tagged sysfs, how could bridge interface work in other containers?

I start thinking I try odd things or I'm not asking right questions.
No one can see what I'm trying in my poor English, please let me explain...

----

base host		terminal A		terminal B
			# ./ns_exec -cn /bin/sh
			# echo $$
			2421
						# ./ns_exec -cn /bin/sh
						# echo $$
						2425
# ip link add type veth
# ip link set veth0 netns 2421
# ip link set veth1 netns 2425
# ip link add type veth
# ip link set veth1 netns 2421
# ip link set veth0 up
			# ip link set veth0 up
			# ip link set veth1 up
			# brctl addbr br0
			# brctl addif br0 veth0
			# brctl addif br0 veth1
			# ip link set br0 up
						# ip link set veth1 up
						# ip addr add 192.168.1.10/24 dev veth1
# ip addr add 192.168.1.1/24 dev veth0
# ping 192.168.1.10

----

I want to play with ebtables, qdisc and something stuff like that in
terminal A. until tagged sysfs merged, we should not try those on present
container system?

Thanks in advance.

Signed-off-by: Ken-ichirou MATSUZAWA

---
 net/bridge/br_if.c |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 8a96672..ea97d2e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -107,7 +107,8 @@ static void destroy_nbp(struct net_bridge_port *p)
 	p->dev = NULL;
 	dev_put(dev);
 
-	kobject_put(&p->kobj);
+        if (dev_net(dev) == &init_net)
+		kobject_put(&p->kobj);
 }
 
 static void destroy_nbp_rcu(struct rcu_head *head)
@@ -148,7 +149,8 @@ static void del_nbp(struct net_bridge_port *p)
 	rcu_assign_pointer(dev->br_port, NULL);
 
 	kobject_uevent(&p->kobj, KOBJ_REMOVE);
-	kobject_del(&p->kobj);
+        if (dev_net(br->dev) == &init_net)
+		kobject_del(&p->kobj);
 
 	call_rcu(&p->rcu, destroy_nbp_rcu);
 }
@@ -164,7 +166,9 @@ static void del_br(struct net_bridge *br)
 
 	del_timer_sync(&br->gc_timer);
 
-	br_sysfs_delbr(br->dev);
+        if (dev_net(br->dev) == &init_net)
+                br_sysfs_delbr(br->dev);
+
 	unregister_netdevice(br->dev);
 }
 
@@ -283,6 +287,9 @@ int br_add_bridge(struct net *net, const char *name)
 	if (ret)
 		goto out_free;
 
+        if (dev_net(dev) != &init_net)
+                goto out;
+
 	ret = br_sysfs_addbr(dev);
 	if (ret)
 		unregister_netdevice(dev);
@@ -387,18 +394,22 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 	if (err)
 		goto put_back;
 
-	err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
-				   SYSFS_BRIDGE_PORT_ATTR);
-	if (err)
-		goto err0;
+        if (dev_net(br->dev) == &init_net) {
+		err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
+					   SYSFS_BRIDGE_PORT_ATTR);
+		if (err)
+			goto err0;
+	}
 
 	err = br_fdb_insert(br, p, dev->dev_addr);
 	if (err)
 		goto err1;
 
-	err = br_sysfs_addif(p);
-	if (err)
-		goto err2;
+        if (dev_net(br->dev) == &init_net) {
+                err = br_sysfs_addif(p);
+                if (err)
+                        goto err2;
+        }
 
 	rcu_assign_pointer(dev->br_port, p);
 	dev_disable_lro(dev);
@@ -424,7 +435,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 err2:
 	br_fdb_delete_by_port(br, p, 1);
 err1:
-	kobject_del(&p->kobj);
+        if (dev_net(br->dev) == &init_net)
+		kobject_del(&p->kobj);
 err0:
 	dev_set_promiscuity(dev, -1);
 put_back:
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ