b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: warn if added interface is part of a bridge
Date: Wed,  7 Dec 2011 18:02:50 +0800	[thread overview]
Message-ID: <1323252170-13257-1-git-send-email-lindner_marek@yahoo.de> (raw)

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(-)

diff --git a/compat.h b/compat.h
index 964c066..dcd92d1 100644
--- a/compat.h
+++ b/compat.h
@@ -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) */
 
diff --git a/hard-interface.c b/hard-interface.c
index d3e0e32..68b667c 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -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) {
-- 
1.7.5.4


             reply	other threads:[~2011-12-07 10:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07 10:02 Marek Lindner [this message]
2011-12-10  9:31 ` [B.A.T.M.A.N.] [PATCH] batman-adv: warn if added interface is part of a bridge Marek Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323252170-13257-1-git-send-email-lindner_marek@yahoo.de \
    --to=lindner_marek@yahoo.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).