On Tuesday 01 March 2016 22:19:07 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 namespace, so also retrieve the parents name space when finding the parent and use it when doing the comparison.
Signed-off-by: Andrew Lunn andrew@lunn.ch Acked-by: Antonio Quartulli a@untable.cc
[...]
return (dev1_parent_iflink == dev2->ifindex) &&
(dev2_parent_iflink == dev1->ifindex);
(dev2_parent_iflink == dev1->ifindex) &&
net_eq(dev1_parent_net, net2) &&
net_eq(dev2_parent_net, net1);
}
Just spotted this:
"(dev2_parent_iflink == dev1->ifindex) &&" and all following lines are not correctly aligned anymore (7 spaces vs 1 tab).
[...]
- const struct net *dev1_parent_net = net1;
- const struct net *dev2_parent_net = net2;
- if (dev1->rtnl_link_ops && dev1->rtnl_link_ops->get_link_net)
dev1_parent_net = dev1->rtnl_link_ops->get_link_net(dev1);
- if (dev2->rtnl_link_ops && dev2->rtnl_link_ops->get_link_net)
dev2_parent_net = dev2->rtnl_link_ops->get_link_net(dev2);
[...]
struct net *parent_net = net;
[...]
- if (net_dev->rtnl_link_ops && net_dev->rtnl_link_ops->get_link_net)
parent_net = net_dev->rtnl_link_ops->get_link_net(net_dev);
My proposal is there to move this in an extra function [1] so adding compat code is easier [2].
Already said this in an earlier mail but just for completeness:
Include missing in net/batman-adv/hard-interface.c
#include <net/rtnetlink.h>
Kind regards, Sven
[1] https://git.open-mesh.org/batman-adv.git/blob/aef6842ec0facda9ec52736f8a6ce8... [2] https://git.open-mesh.org/batman-adv.git/blob/fb7b5eb8c81969dc8bea356d0a3f0b...