On Tuesday 01 March 2016 22:19:06 Andrew Lunn wrote:
When creating a soft interface, create it in the same netns as the hard interface. Replace all references to init_net with the correct name space for the interface being manipulated.
Suggested-by: Daniel Ehlers danielehlers@mindeye.net Signed-off-by: Andrew Lunn andrew@lunn.ch Acked-by: Antonio Quartulli a@unstable.cc
v2: struct net forward declarations Removed unneeded net/net_namespace.h Rebased on https://git.open-mesh.org/batman-adv.git master
net/batman-adv/hard-interface.c | 9 +++++---- net/batman-adv/hard-interface.h | 3 ++- net/batman-adv/soft-interface.c | 7 +++++-- net/batman-adv/soft-interface.h | 3 ++- net/batman-adv/sysfs.c | 3 ++- net/batman-adv/translation-table.c | 4 ++-- 6 files changed, 18 insertions(+), 11 deletions(-)
Just so that I have mentioned it: In theory '#include <net/net_namespace.h>' should be removed by this patch (hard-interface.c) and added again in the next patch. But this would be rather useless when applying the two patches together. It may be different when this patch is applied first without the next patch.
Just to be sure (and so that I don't have to test it here :) ): When this patch is applied, batadv_softif_create would already fail when the two namespaces have a batadv interface with the same name because the debugfs function would fail. But it would work when the batman-adv interfaces + the slave interfaces (for per-slave interface information) have different names. Right?
Just some of my notes (just in case someone else asks himself the same questions):
It looks to me that the only reason a device from a different namespace isn't added is because batadv_softif_slave_add + batadv_store_mesh_iface is getting the namespace of the new slave device and batadv_hardif_enable_interface then only searches the soft-interface (batX) in this namespace.
It is currently not prevented that a slave device changes the namespace after it was added. But this should not be a problem because the device will be first removed from the original namespace (so it will be removed from batX) and later added to the target namespace (see dev_change_net_namespace).
Reviewed-by: Sven Eckelmann sven@narfation.org
Kind regards, Sven