Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
commit f8a8f6058f797569f917a3735683ff4ff17b4dd4 Author: Nicolas Dichtel nicolas.dichtel@6wind.com Date: Fri Apr 17 19:15:10 2015 +0200
batman-adv: introduce dev_get_iflink()
The goal of this patch is to prepare the removal of the iflink field. It introduces a new ndo function, which will be implemented by virtual interfaces.
There is no functional change into this patch. All readers of iflink field now call dev_get_iflink().
Signed-off-by: Nicolas Dichtel nicolas.dichtel@6wind.com Signed-off-by: David S. Miller davem@davemloft.net [sven@narfation.org: added compat code] Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
f8a8f6058f797569f917a3735683ff4ff17b4dd4 compat.h | 6 ++++++ hard-interface.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/compat.h b/compat.h index 45412b0..a5f027a 100644 --- a/compat.h +++ b/compat.h @@ -482,4 +482,10 @@ static inline bool seq_has_overflowed(struct seq_file *m)
#endif /* < KERNEL_VERSION(3, 19, 0) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) + +#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) + +#endif /* < KERNEL_VERSION(4, 1, 0) */ + #endif /* _NET_BATMAN_ADV_COMPAT_H_ */ diff --git a/hard-interface.c b/hard-interface.c index fbda6b5..baf1f98 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -83,11 +83,12 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) return true;
/* no more parents..stop recursion */ - if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex) + if (dev_get_iflink(net_dev) == 0 || + dev_get_iflink(net_dev) == net_dev->ifindex) return false;
/* recurse over the parent device */ - parent_dev = __dev_get_by_index(&init_net, net_dev->iflink); + parent_dev = __dev_get_by_index(&init_net, dev_get_iflink(net_dev)); /* if we got a NULL parent_dev there is something broken.. */ if (WARN(!parent_dev, "Cannot find parent device")) return false;