Message ID | 1453312110-32683-2-git-send-email-andrew@lunn.ch (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Marek Lindner |
Headers |
Return-Path: <andrew@lunn.ch> Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=178.209.37.122; helo=vps0.lunn.ch; envelope-from=andrew@lunn.ch; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=none header.from=lunn.ch Received: from vps0.lunn.ch (vps0.lunn.ch [178.209.37.122]) by open-mesh.org (Postfix) with ESMTPS id 2878481BE1 for <b.a.t.m.a.n@lists.open-mesh.org>; Wed, 20 Jan 2016 18:48:47 +0100 (CET) Received: from andrew by vps0.lunn.ch with local (Exim 4.80) (envelope-from <andrew@lunn.ch>) id 1aLwsA-0008Vr-Qm; Wed, 20 Jan 2016 18:48:46 +0100 From: Andrew Lunn <andrew@lunn.ch> To: Antonio Quartulli <a@unstable.cc> Date: Wed, 20 Jan 2016 18:48:27 +0100 Message-Id: <1453312110-32683-2-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1453312110-32683-1-git-send-email-andrew@lunn.ch> References: <1453312110-32683-1-git-send-email-andrew@lunn.ch> Cc: b.a.t.m.a.n@lists.open-mesh.org Subject: [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: NETIF_F_NETNS_LOCAL feature to prevent netns moves X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n.lists.open-mesh.org> List-Unsubscribe: <https://lists.open-mesh.org/mm/options/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=unsubscribe> List-Archive: <http://lists.open-mesh.org/pipermail/b.a.t.m.a.n/> List-Post: <mailto:b.a.t.m.a.n@lists.open-mesh.org> List-Help: <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=help> List-Subscribe: <https://lists.open-mesh.org/mm/listinfo/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=subscribe> X-List-Received-Date: Wed, 20 Jan 2016 17:48:48 -0000 |
Commit Message
Andrew Lunn
Jan. 20, 2016, 5:48 p.m. UTC
The batX soft interface should not be moved between network name
spaces. This is similar to bridges, bonds, tunnels, which are not
allowed to move between network namespaces.
Suggested-by: Daniel Ehlers <danielehlers@mindeye.net>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
net/batman-adv/soft-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Jan 20, 2016 at 06:48:27PM +0100, Andrew Lunn wrote: > The batX soft interface should not be moved between network name > spaces. This is similar to bridges, bonds, tunnels, which are not > allowed to move between network namespaces. > Andrew, I understand bridges and other similar interfaces do the same, but what is the real reason for preventing a batman soft-interface from moving between namespaces? I tried to figure this put myself, but I couldn't find a real technical reason for that (note - I am not a namespace expert as I am just learning now how they work) Cheers,
On Sat, Jan 23, 2016 at 10:06:37AM +0800, Antonio Quartulli wrote: > On Wed, Jan 20, 2016 at 06:48:27PM +0100, Andrew Lunn wrote: > > The batX soft interface should not be moved between network name > > spaces. This is similar to bridges, bonds, tunnels, which are not > > allowed to move between network namespaces. > > > > Andrew, > I understand bridges and other similar interfaces do the same, but what > is the real reason for preventing a batman soft-interface from moving > between namespaces? Humm, actually, a good question. I blindly copied this code without thinking about it. One clear answer is the notification mechanism, used by batadv_hard_if_event(). As far as i can see, such events are only sent within the interfaces namespace. So for example you hot unplug a hard interface which the soft interface is using, you would not get the NETDEV_DOWN event if the soft interface is in a different namespace. Now that i think of it, there are a few other reasons. All the interface management calls, and displaying of interface names would have to contains the namespace. Otherwise you look at the output for 'batctl o' and have no idea which namespace that wlan0 interface is from. Remember, interface names are only unique within a namespace, not across namespaces. namespaces are supposed to be as transparent as possible. Applications are not supposed to know they are in a name space. That goes right out the window as soon as you need to include a namespace into every interface name. Andrew
On Sat, Jan 23, 2016 at 06:20:06PM +0100, Andrew Lunn wrote: > On Sat, Jan 23, 2016 at 10:06:37AM +0800, Antonio Quartulli wrote: > > On Wed, Jan 20, 2016 at 06:48:27PM +0100, Andrew Lunn wrote: > > > The batX soft interface should not be moved between network name > > > spaces. This is similar to bridges, bonds, tunnels, which are not > > > allowed to move between network namespaces. > > > > > > > Andrew, > > I understand bridges and other similar interfaces do the same, but what > > is the real reason for preventing a batman soft-interface from moving > > between namespaces? > > Humm, actually, a good question. I blindly copied this code without > thinking about it. > > One clear answer is the notification mechanism, used by > batadv_hard_if_event(). As far as i can see, such events are only sent > within the interfaces namespace. So for example you hot unplug a hard > interface which the soft interface is using, you would not get the > NETDEV_DOWN event if the soft interface is in a different namespace. This raises another question (maybe addressed by another of your patch?): what happens if an hard-interface currently enslaved in bat0 changes namespace? Will this result in an UNREGISTER event like when the interface gets destroyed? If not, I am not sure how the whole situation can still be consistent. > > Now that i think of it, there are a few other reasons. All the > interface management calls, and displaying of interface names would > have to contains the namespace. Otherwise you look at the output for > 'batctl o' and have no idea which namespace that wlan0 interface is > from. Remember, interface names are only unique within a namespace, > not across namespaces. Yeah, it make sense. If the softif is in the same ns as the hardifs, it is definitely necessary to prevent bat0 from jumping from a namespace to another. Cheers,
On Sun, Jan 24, 2016 at 02:19:59PM +0800, Antonio Quartulli wrote: > On Sat, Jan 23, 2016 at 06:20:06PM +0100, Andrew Lunn wrote: > > On Sat, Jan 23, 2016 at 10:06:37AM +0800, Antonio Quartulli wrote: > > > On Wed, Jan 20, 2016 at 06:48:27PM +0100, Andrew Lunn wrote: > > > > The batX soft interface should not be moved between network name > > > > spaces. This is similar to bridges, bonds, tunnels, which are not > > > > allowed to move between network namespaces. > > > > > > > > > > Andrew, > > > I understand bridges and other similar interfaces do the same, but what > > > is the real reason for preventing a batman soft-interface from moving > > > between namespaces? > > > > Humm, actually, a good question. I blindly copied this code without > > thinking about it. > > > > One clear answer is the notification mechanism, used by > > batadv_hard_if_event(). As far as i can see, such events are only sent > > within the interfaces namespace. So for example you hot unplug a hard > > interface which the soft interface is using, you would not get the > > NETDEV_DOWN event if the soft interface is in a different namespace. > > This raises another question (maybe addressed by another of your patch?): what > happens if an hard-interface currently enslaved in bat0 changes namespace? > Will this result in an UNREGISTER event like when the interface gets destroyed? > If not, I am not sure how the whole situation can still be consistent. It seems that an UNREGISTER event is broadcasted when an hardif goes to another namespace. At net/dev/core.c:4915 Therefore batman-adv will do the right thing :) Cheers,
On Wed, Jan 20, 2016 at 06:48:27PM +0100, Andrew Lunn wrote: > The batX soft interface should not be moved between network name > spaces. This is similar to bridges, bonds, tunnels, which are not > allowed to move between network namespaces. > > Suggested-by: Daniel Ehlers <danielehlers@mindeye.net> > Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Antonio Quartulli <a@unstable.cc>
> > This raises another question (maybe addressed by another of your patch?): what > > happens if an hard-interface currently enslaved in bat0 changes namespace? > > Will this result in an UNREGISTER event like when the interface gets destroyed? > > If not, I am not sure how the whole situation can still be consistent. > > It seems that an UNREGISTER event is broadcasted when an hardif goes to another > namespace. At net/dev/core.c:4915 > > Therefore batman-adv will do the right thing :) Correct. An interface is effectively hotplugged from one namespace to another. Andrew
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index ac4d08d..f3f096c0 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -940,7 +940,7 @@ static void batadv_softif_init_early(struct net_device *dev) dev->netdev_ops = &batadv_netdev_ops; dev->destructor = batadv_softif_free; - dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL; dev->priv_flags |= IFF_NO_QUEUE; /* can't call min_mtu, because the needed variables