batman-adv: warn if added interface is part of a bridge
Commit Message
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
Thanks to Sven we even have a 'nice' compat.h workaround. :)
compat.h | 1 +
hard-interface.c | 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
Comments
On Wednesday, December 07, 2011 18:02:50 Marek Lindner wrote:
> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> ---
>
> Thanks to Sven we even have a 'nice' compat.h workaround. :)
Applied in revision 9d3e1ff.
Regards,
Marek
@@ -52,6 +52,7 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#define __rcu
+#define IFF_BRIDGE_PORT 0 || (hard_iface->net_dev->br_port ? 1 : 0)
#endif /* < KERNEL_VERSION(2, 6, 36) */
@@ -281,6 +281,14 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
if (!atomic_inc_not_zero(&hard_iface->refcount))
goto out;
+ /* hard-interface is part of a bridge */
+ if (hard_iface->net_dev->priv_flags & IFF_BRIDGE_PORT)
+ pr_err("You are about to enable batman-adv on '%s' which "
+ "already is part of a bridge. Unless you know exactly "
+ "what you are doing this is probably wrong and won't "
+ "work the way you think it would.\n",
+ hard_iface->net_dev->name);
+
soft_iface = dev_get_by_name(&init_net, iface_name);
if (!soft_iface) {