b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Marek Lindner <mareklindner@neomailbox.ch>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
Date: Thu, 19 Feb 2015 17:40:34 +0800	[thread overview]
Message-ID: <1485649.labZ4ZGvMV@voltaire> (raw)
In-Reply-To: <OF7D539C0F.7F2029AA-ONC1257DF1.002DB2B5-C1257DF1.002ECBFC@phoenixcontact.com>


[-- Attachment #1.1: Type: text/plain, Size: 3142 bytes --]

=2D-nextPart15347714.kqh6NbhTuU
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

On Thursday, February 19, 2015 09:31:08 Andreas Pape wrote:
> the problem seems to be a little bit more complex. Your latest patch does 
> not solve the problem.
> 
> But I found out, that commenting out the following line in your patch 
> makes bat0 work:
> 
> slave->master = master;
> 
> But as this is the core of "enslaving" a device to a master device, this 
> breaks the complete concept behind this I guess (I'm not a skilled kernel 
> developer). From this I conclude that there might be a bug somewhere 
> deeper in the kernel version I use.  I don't want to give up too early, 
> but it looks a little bit as if this "enslaving concept using rtnl" might 
> not be usable in these older kernels. What do you think?

Please try the attached patch instead. This time we are replacing the function 
with our own function doing nothing at all. The net_dev->master variable seems 
to be reserved for interface bonding and shouldn't be touched at all on these 
ancient kernels.

Cheers,
Marek

=2D-nextPart15347714.kqh6NbhTuU
Content-Disposition: attachment; filename="0001-batman-adv-ignore-netdev_set_master-calls-on-kernels.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0001-batman-adv-ignore-netdev_set_master-calls-on-kernels.patch"

From=20b115b2a7025e00b8f0c345b7bcf1796282c9223d Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Thu, 19 Feb 2015 12:03:39 +0800
Subject: [PATCH] batman-adv: ignore netdev_set_master() calls on kernels older
 than 2.6.39

batman-adv calls netdev_master_upper_dev_link() which is replaced with with
netdev_set_master() for kernels older than 3.9 via compat.h.
Prior to 2.6.39 netdev_set_master() contained Linux bonding calls needed to
setup bonding devices. Calling this function from batman-adv leads to
unexpected behavior when current batman-adv versions are used on these
older kernels.

To fix the situation compat.h now ships its own implementation of
netdev_set_master() which does not change the net_dev->master state
on kernels older than 2.6.39.

Reported-by: Andreas Pape <APape@phoenixcontact.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
=2D--
 compat.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/compat.h b/compat.h
index 27d8a21..916d447 100644
=2D-- a/compat.h
+++ b/compat.h
@@ -191,6 +191,15 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
+/* On older kernels net_dev->master is reserved for iface bonding */
+static inline int batadv_netdev_set_master(struct net_device *slave,
+					   struct net_device *master)
+{
+	return 0;
+}
+
+#define netdev_set_master batadv_netdev_set_master
+
 /* Hack for removing ndo_add/del_slave at the end of net_device_ops.
  * This is somewhat ugly because it requires that ndo_validate_addr
  * is at the end of this struct in soft-interface.c.
=2D- 
2.1.4


=2D-nextPart15347714.kqh6NbhTuU--
This is a multi-part message in MIME format.

[-- Attachment #1.2: Type: text/plain, Size: 997 bytes --]

On Thursday, February 19, 2015 09:31:08 Andreas Pape wrote:
> the problem seems to be a little bit more complex. Your latest patch does 
> not solve the problem.
> 
> But I found out, that commenting out the following line in your patch 
> makes bat0 work:
> 
> slave->master = master;
> 
> But as this is the core of "enslaving" a device to a master device, this 
> breaks the complete concept behind this I guess (I'm not a skilled kernel 
> developer). From this I conclude that there might be a bug somewhere 
> deeper in the kernel version I use.  I don't want to give up too early, 
> but it looks a little bit as if this "enslaving concept using rtnl" might 
> not be usable in these older kernels. What do you think?

Please try the attached patch instead. This time we are replacing the function 
with our own function doing nothing at all. The net_dev->master variable seems 
to be reserved for interface bonding and shouldn't be touched at all on these 
ancient kernels.

Cheers,
Marek

[-- Attachment #1.3: 0001-batman-adv-ignore-netdev_set_master-calls-on-kernels.patch --]
[-- Type: text/x-patch, Size: 1657 bytes --]

From b115b2a7025e00b8f0c345b7bcf1796282c9223d Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Thu, 19 Feb 2015 12:03:39 +0800
Subject: [PATCH] batman-adv: ignore netdev_set_master() calls on kernels older
 than 2.6.39

batman-adv calls netdev_master_upper_dev_link() which is replaced with with
netdev_set_master() for kernels older than 3.9 via compat.h.
Prior to 2.6.39 netdev_set_master() contained Linux bonding calls needed to
setup bonding devices. Calling this function from batman-adv leads to
unexpected behavior when current batman-adv versions are used on these
older kernels.

To fix the situation compat.h now ships its own implementation of
netdev_set_master() which does not change the net_dev->master state
on kernels older than 2.6.39.

Reported-by: Andreas Pape <APape@phoenixcontact.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
 compat.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/compat.h b/compat.h
index 27d8a21..916d447 100644
--- a/compat.h
+++ b/compat.h
@@ -191,6 +191,15 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
+/* On older kernels net_dev->master is reserved for iface bonding */
+static inline int batadv_netdev_set_master(struct net_device *slave,
+					   struct net_device *master)
+{
+	return 0;
+}
+
+#define netdev_set_master batadv_netdev_set_master
+
 /* Hack for removing ndo_add/del_slave at the end of net_device_ops.
  * This is somewhat ugly because it requires that ndo_validate_addr
  * is at the end of this struct in soft-interface.c.
-- 
2.1.4


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-02-19  9:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18  7:35 [B.A.T.M.A.N.] Question concerning batman-adv bug #173 "Mesh packets on bat0" Andreas Pape
2015-02-18 11:26 ` Marek Lindner
2015-02-18 12:28   ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2015-02-18 13:55     ` Marek Lindner
2015-02-18 14:56       ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2015-02-18 15:22         ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2015-02-18 15:45           ` Marek Lindner
2015-02-18 16:10             ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2015-02-19  4:15               ` Marek Lindner
2015-02-19  8:31                 ` Andreas Pape
2015-02-19  9:40                   ` Marek Lindner [this message]
2015-02-19 10:28                     ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2015-02-19 10:36                       ` 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=1485649.labZ4ZGvMV@voltaire \
    --to=mareklindner@neomailbox.ch \
    --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).