On Wednesday 20 January 2016 18:48:29 Andrew Lunn wrote:
batman-adv tries to prevent the user from placing a batX soft interface into another batman mesh as a hard interface. It does this by walking up the devices list of parents and ensures they are all none batX interfaces. iflink can point to an interface in a different nameplace, so also retrieve the parents name space when finding the parent.
Additionally, veth devices come in pairs and they are each others parents. Don't infinitely recurse in this situation.
Signed-off-by: Andrew Lunn andrew@lunn.ch
net/batman-adv/hard-interface.c | 44 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index a5ce58a..8d51a4a 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c
Include missing:
#include <net/rtnetlink.h>
@@ -75,6 +75,39 @@ out: }
/**
- batadv_mutual_parents - check if two devices are each others parent
- @net_dev - 1st parent
- @parent_dev - 2nd parent
- veth devices come in pairs and each is the parent of the other!
- Return true if the devices are each others parent, otherwise false
- */
+static bool batadv_mutual_parents(const struct net_device *dev1,
const struct net *dev1_net,
const struct net_device *dev2,
const struct net *dev2_net)
* What is net_dev and parent_dev? * Missing parameter docs are: - dev1 - dev1_net - dev2 - dev2_net. * Return -> Return:
Kind regards, Sven