Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"

Message ID 1485649.labZ4ZGvMV@voltaire (mailing list archive)
State RFC, archived
Headers

Commit Message

Marek Lindner Feb. 19, 2015, 9:40 a.m. UTC
  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
  

Comments

Andreas Pape Feb. 19, 2015, 10:28 a.m. UTC | #1
I started with a freshly unpacked source code of the 2014.4.0 release and 
applied only  your latest patch. 

As expected from the tests done so far with the old kernel effectively not 
calling netdev_set_master allows the usage of the latest batman-adv 
version in combination with older kernels (at least the 2.6.32 I tested 
with).

I think this patch is worth to be integrated into the next batman-adv 
version.

Regards,
Andreas


"B.A.T.M.A.N" <b.a.t.m.a.n-bounces@lists.open-mesh.org> schrieb am 
19.02.2015 10:40:34:

> Von: Marek Lindner <mareklindner@neomailbox.ch>
> An: The list for a Better Approach To Mobile Ad-hoc Networking 
> <b.a.t.m.a.n@lists.open-mesh.org>, 
> Datum: 19.02.2015 10:42
> Betreff: Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: 
> Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on 
bat0"
> Gesendet von: "B.A.T.M.A.N" <b.a.t.m.a.n-bounces@lists.open-mesh.org>
> 
> 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 allon 
these 
> ancient kernels.
> 
> Cheers,
> Marek
> [Anhang "0001-batman-adv-ignore-netdev_set_master-calls-on-
> kernels.patch" gelöscht von Andreas Pape/Phoenix Contact] [Anhang 
> "signature.asc" gelöscht von Andreas Pape/Phoenix Contact]
  

Patch

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