All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] Question concerning batman-adv bug #173 "Mesh packets on bat0"
@ 2015-02-18  7:35 Andreas Pape
  2015-02-18 11:26 ` Marek Lindner
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-18  7:35 UTC (permalink / raw)
  To: b.a.t.m.a.n

Hello everybody, 

I'm interested if there is any progress concerning the bug entry #173 (
http://www.open-mesh.org/issues/173). 

I'm currently observing something similiar on an embedded system running 
an older kernel 2.6.32.26. Batman-adv versions up to 2013.1.0 work 
flawlessly out of the box. All newer versions show the phenomenon 
described in bug #173. 
In my case I found out, that the batadv_batman_skb_recv function is never 
called again as soon as I add bat0 to the bridge interface I use. 
If I use the bat0 interface outside a bridge, everything works fine up to 
the latest version I tested (which was 2014.4.0) even with the old kernel 
version. 

Regards, 
Andreas Pape 



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Question concerning batman-adv bug #173 "Mesh packets on bat0"
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Lindner @ 2015-02-18 11:26 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


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

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

On Wednesday, February 18, 2015 08:35:49 Andreas Pape wrote:
> I'm interested if there is any progress concerning the bug entry #173 (
> http://www.open-mesh.org/issues/173). 
> 
> I'm currently observing something similiar on an embedded system running 
> an older kernel 2.6.32.26. Batman-adv versions up to 2013.1.0 work 
> flawlessly out of the box. All newer versions show the phenomenon 
> described in bug #173. 
> In my case I found out, that the batadv_batman_skb_recv function is never 
> called again as soon as I add bat0 to the bridge interface I use. 
> If I use the bat0 interface outside a bridge, everything works fine up to 
> the latest version I tested (which was 2014.4.0) even with the old kernel 
> version. 

Can you please try the attached patch and check whether it makes any 
difference? If the symptoms are the same, please provide step-by-step 
instructions how you create / configure your interfaces.

Thanks,
Marek

=2D-nextPart2394197.oXrfbe7zVp
Content-Disposition: attachment; filename="0001-do-not-call-master-netdev_ops-ndo_init.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0001-do-not-call-master-netdev_ops-ndo_init.patch"

From=2097dd927aca3747e1a054303638011f93373c96bf Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 19:24:06 +0800
Subject: [PATCH] do not call master->netdev_ops->ndo_init

=2D--
 hard-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index fbda6b5..010a403 100644
=2D-- a/hard-interface.c
+++ b/hard-interface.c
@@ -349,7 +349,7 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
  * is free'd and master can correctly change its internal state.
  * Return 0 on success, a negative value representing the error otherwise
  */
=2Dstatic int batadv_master_del_slave(struct batadv_hard_iface *slave,
+/*tatic int batadv_master_del_slave(struct batadv_hard_iface *slave,
 				   struct net_device *master)
 {
 	int ret;
@@ -362,7 +362,7 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
 		ret = master->netdev_ops->ndo_del_slave(master, slave->net_dev);
 
 	return ret;
=2D}
+}*/
 
 int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 				   const char *iface_name)
@@ -403,10 +403,10 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	/* check if the interface is enslaved in another virtual one and
 	 * in that case unlink it first
 	 */
=2D	master = netdev_master_upper_dev_get(hard_iface->net_dev);
+	/* master = netdev_master_upper_dev_get(hard_iface->net_dev);
 	ret = batadv_master_del_slave(hard_iface, master);
 	if (ret)
=2D		goto err_dev;
+		goto err_dev; */
 
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
=2D- 
2.1.4


=2D-nextPart2394197.oXrfbe7zVp--
This is a multi-part message in MIME format.

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

On Wednesday, February 18, 2015 08:35:49 Andreas Pape wrote:
> I'm interested if there is any progress concerning the bug entry #173 (
> http://www.open-mesh.org/issues/173). 
> 
> I'm currently observing something similiar on an embedded system running 
> an older kernel 2.6.32.26. Batman-adv versions up to 2013.1.0 work 
> flawlessly out of the box. All newer versions show the phenomenon 
> described in bug #173. 
> In my case I found out, that the batadv_batman_skb_recv function is never 
> called again as soon as I add bat0 to the bridge interface I use. 
> If I use the bat0 interface outside a bridge, everything works fine up to 
> the latest version I tested (which was 2014.4.0) even with the old kernel 
> version. 

Can you please try the attached patch and check whether it makes any 
difference? If the symptoms are the same, please provide step-by-step 
instructions how you create / configure your interfaces.

Thanks,
Marek

[-- Attachment #1.3: 0001-do-not-call-master-netdev_ops-ndo_init.patch --]
[-- Type: text/x-patch, Size: 1672 bytes --]

From 97dd927aca3747e1a054303638011f93373c96bf Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 19:24:06 +0800
Subject: [PATCH] do not call master->netdev_ops->ndo_init

---
 hard-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index fbda6b5..010a403 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -349,7 +349,7 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
  * is free'd and master can correctly change its internal state.
  * Return 0 on success, a negative value representing the error otherwise
  */
-static int batadv_master_del_slave(struct batadv_hard_iface *slave,
+/*tatic int batadv_master_del_slave(struct batadv_hard_iface *slave,
 				   struct net_device *master)
 {
 	int ret;
@@ -362,7 +362,7 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
 		ret = master->netdev_ops->ndo_del_slave(master, slave->net_dev);
 
 	return ret;
-}
+}*/
 
 int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 				   const char *iface_name)
@@ -403,10 +403,10 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	/* check if the interface is enslaved in another virtual one and
 	 * in that case unlink it first
 	 */
-	master = netdev_master_upper_dev_get(hard_iface->net_dev);
+	/* master = netdev_master_upper_dev_get(hard_iface->net_dev);
 	ret = batadv_master_del_slave(hard_iface, master);
 	if (ret)
-		goto err_dev;
+		goto err_dev; */
 
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-18 11:26 ` Marek Lindner
@ 2015-02-18 12:28   ` Andreas Pape
  2015-02-18 13:55     ` Marek Lindner
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-18 12:28 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Hi,

I adapted your patch to batman-adv-2014.4.0 without success. I got the 
additional issue that with the patched version of batman-adv I was not 
able to destroy the virtual wireless interface anymore used fot the adhoc 
connection over which I try to use batman-adv (error message was: 
unregister_netdevice: waiting for ath0 to become free). 

With the unpatched 2014.4.0 I did the following test on two of my devices:

1. created a virtual wireless interface ath0 in adhoc mode
2. iwconfig ath0 essid TEST
3. iwconfig ath0 channel 40
4. ifconfig ath0 up
5. batctl if add ath0

After this the two devices connected and I could see the repective 
neighbor via the batctl o command on both devices. So far so good. 
But I can see via batctl td bat0 OGM packets sent with the MAC address of 
the wlan interface of the device itself and also from the neigbour this 
device is connected to via wlan. Is this OK?

6. Generating a bridge interface via brctl addbr br0
7. add bat0 interface to bridge via brctl addif br0 bat0

As soon as I do this, the batadv_batman_skb_recv isn't called anymore 
(I've put a printk at the beginning of that function for debugging). 
Furthermore batctl o shows that the mesh communication starts timing out 
(last seen time for the originator/neighbor exceeds the ogm send interval 
and increases continuously).

The interesting point in this state is, that batctl td bat0 still shows 
the reception of ogm messages from the neighbour and from the own wlan 
interface as mentioned above.

As mentioned I use a kernel version 2.6.32.26 and batman-adv/batctl 
versions up to 2013.1.0 work with the same configuration steps. 

Thanks for the support,
Andreas





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:  18.02.2015 12:28
Betreff:        Re: [B.A.T.M.A.N.] 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 Wednesday, February 18, 2015 08:35:49 Andreas Pape wrote:
> I'm interested if there is any progress concerning the bug entry #173 (
> http://www.open-mesh.org/issues/173). 
> 
> I'm currently observing something similiar on an embedded system running 

> an older kernel 2.6.32.26. Batman-adv versions up to 2013.1.0 work 
> flawlessly out of the box. All newer versions show the phenomenon 
> described in bug #173. 
> In my case I found out, that the batadv_batman_skb_recv function is 
never 
> called again as soon as I add bat0 to the bridge interface I use. 
> If I use the bat0 interface outside a bridge, everything works fine up 
to 
> the latest version I tested (which was 2014.4.0) even with the old 
kernel 
> version. 

Can you please try the attached patch and check whether it makes any 
difference? If the symptoms are the same, please provide step-by-step 
instructions how you create / configure your interfaces.

Thanks,
Marek
[Anhang "0001-do-not-call-master-netdev_ops-ndo_init.patch" gelöscht von 
Andreas Pape/Phoenix Contact] [Anhang "signature.asc" gelöscht von Andreas 
Pape/Phoenix Contact] 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Lindner @ 2015-02-18 13:55 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


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

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

On Wednesday, February 18, 2015 13:28:27 Andreas Pape wrote:
> I adapted your patch to batman-adv-2014.4.0 without success. I got the 
> additional issue that with the patched version of batman-adv I was not 
> able to destroy the virtual wireless interface anymore used fot the adhoc 
> connection over which I try to use batman-adv (error message was: 
> unregister_netdevice: waiting for ath0 to become free).

It is very possible that the supplied patches have side effects. Right now, I 
am trying to figure out which part of the code introduced with 2013.2.0 causes 
the malfunction. I prepared some more patches which deactivate more code, most 
notably rtnl code added with 2013.2.0. Please give it a try and let me know 
how it goes.


> 
> With the unpatched 2014.4.0 I did the following test on two of my devices:
> 
> 1. created a virtual wireless interface ath0 in adhoc mode
> 2. iwconfig ath0 essid TEST
> 3. iwconfig ath0 channel 40
> 4. ifconfig ath0 up
> 5. batctl if add ath0
> 
> After this the two devices connected and I could see the repective 
> neighbor via the batctl o command on both devices. So far so good. 

At this point the mesh is working to your expectation ? Can you transport 
payload across the mesh ? If so, this is a deviation from #173 - wouldn't you 
agree ?


> But I can see via batctl td bat0 OGM packets sent with the MAC address of 
> the wlan interface of the device itself and also from the neigbour this 
> device is connected to via wlan. Is this OK?

Yes, batman-adv continues to use the mac addresses of the interfaces you 
configure.


Cheers,
Marek


=2D-nextPart45976363.ZZJ1fLcevV
Content-Disposition: attachment; filename="0001-do-not-call-master-netdev_ops-ndo_init.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0001-do-not-call-master-netdev_ops-ndo_init.patch"

From=20b810a3fa1168abe9f8d21f0d9c2b19f5ecf81e0e Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 19:24:06 +0800
Subject: [PATCH 1/3] do not call master->netdev_ops->ndo_init

=2D--
 hard-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index fbda6b5..010a403 100644
=2D-- a/hard-interface.c
+++ b/hard-interface.c
@@ -349,7 +349,7 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
  * is free'd and master can correctly change its internal state.
  * Return 0 on success, a negative value representing the error otherwise
  */
=2Dstatic int batadv_master_del_slave(struct batadv_hard_iface *slave,
+/*tatic int batadv_master_del_slave(struct batadv_hard_iface *slave,
 				   struct net_device *master)
 {
 	int ret;
@@ -362,7 +362,7 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
 		ret = master->netdev_ops->ndo_del_slave(master, slave->net_dev);
 
 	return ret;
=2D}
+}*/
 
 int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 				   const char *iface_name)
@@ -403,10 +403,10 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	/* check if the interface is enslaved in another virtual one and
 	 * in that case unlink it first
 	 */
=2D	master = netdev_master_upper_dev_get(hard_iface->net_dev);
+	/* master = netdev_master_upper_dev_get(hard_iface->net_dev);
 	ret = batadv_master_del_slave(hard_iface, master);
 	if (ret)
=2D		goto err_dev;
+		goto err_dev; */
 
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
=2D- 
2.1.4


=2D-nextPart45976363.ZZJ1fLcevV
Content-Disposition: attachment; filename="0002-remove-netdev_-calls.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0002-remove-netdev_-calls.patch"

From=20df56faedb87a4beddbe8b478210bf71ebdfd7de5 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 21:18:05 +0800
Subject: [PATCH 2/3] remove netdev_* calls

=2D--
 hard-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index 010a403..64ef086 100644
=2D-- a/hard-interface.c
+++ b/hard-interface.c
@@ -411,9 +411,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
=2D	ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface);
+	/*ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface);
 	if (ret)
=2D		goto err_dev;
+		goto err_dev;*/
 
 	ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface);
 	if (ret < 0)
@@ -466,7 +466,7 @@ out:
 	return 0;
 
 err_upper:
=2D	netdev_upper_dev_unlink(hard_iface->net_dev, soft_iface);
+	/*netdev_upper_dev_unlink(hard_iface->net_dev, soft_iface);*/
 err_dev:
 	hard_iface->soft_iface = NULL;
 	dev_put(soft_iface);
@@ -521,7 +521,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 			batadv_softif_destroy_sysfs(hard_iface->soft_iface);
 	}
 
=2D	netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
+	/*netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);*/
 	hard_iface->soft_iface = NULL;
 	batadv_hardif_free_ref(hard_iface);
 
=2D- 
2.1.4


=2D-nextPart45976363.ZZJ1fLcevV
Content-Disposition: attachment; filename="0003-remove-ndo-workarounds.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0003-remove-ndo-workarounds.patch"

From=2005f48d1e40e55097ac960dc2a8a50d594cf967a8 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 21:44:02 +0800
Subject: [PATCH 3/3] remove ndo workarounds

=2D--
 compat.h         | 14 --------------
 soft-interface.c |  2 --
 2 files changed, 16 deletions(-)

diff --git a/compat.h b/compat.h
index 27d8a21..c3796a8 100644
=2D-- a/compat.h
+++ b/compat.h
@@ -191,20 +191,6 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
=2D/* Hack for removing ndo_add/del_slave at the end of net_device_ops.
=2D * This is somewhat ugly because it requires that ndo_validate_addr
=2D * is at the end of this struct in soft-interface.c.
=2D */
=2D#define ndo_validate_addr \
=2D	ndo_validate_addr = eth_validate_addr, \
=2D}; \
=2Dstatic const struct { \
=2D	void *ndo_validate_addr; \
=2D	void *ndo_add_slave; \
=2D	void *ndo_del_slave; \
=2D} __attribute__((unused)) __useless_ops1 = { \
=2D	.ndo_validate_addr
=2D
 #define ndo_del_slave          ndo_init
 #define ndo_init(x, y)         ndo_init - master->netdev_ops->ndo_init - EBUSY
 
diff --git a/soft-interface.c b/soft-interface.c
index 8748987..a73ebd0 100644
=2D-- a/soft-interface.c
+++ b/soft-interface.c
@@ -874,8 +874,6 @@ static const struct net_device_ops batadv_netdev_ops = {
 	.ndo_set_rx_mode = batadv_interface_set_rx_mode,
 	.ndo_start_xmit = batadv_interface_tx,
 	.ndo_validate_addr = eth_validate_addr,
=2D	.ndo_add_slave = batadv_softif_slave_add,
=2D	.ndo_del_slave = batadv_softif_slave_del,
 };
 
 /**
=2D- 
2.1.4


=2D-nextPart45976363.ZZJ1fLcevV--
This is a multi-part message in MIME format.

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

On Wednesday, February 18, 2015 13:28:27 Andreas Pape wrote:
> I adapted your patch to batman-adv-2014.4.0 without success. I got the 
> additional issue that with the patched version of batman-adv I was not 
> able to destroy the virtual wireless interface anymore used fot the adhoc 
> connection over which I try to use batman-adv (error message was: 
> unregister_netdevice: waiting for ath0 to become free).

It is very possible that the supplied patches have side effects. Right now, I 
am trying to figure out which part of the code introduced with 2013.2.0 causes 
the malfunction. I prepared some more patches which deactivate more code, most 
notably rtnl code added with 2013.2.0. Please give it a try and let me know 
how it goes.


> 
> With the unpatched 2014.4.0 I did the following test on two of my devices:
> 
> 1. created a virtual wireless interface ath0 in adhoc mode
> 2. iwconfig ath0 essid TEST
> 3. iwconfig ath0 channel 40
> 4. ifconfig ath0 up
> 5. batctl if add ath0
> 
> After this the two devices connected and I could see the repective 
> neighbor via the batctl o command on both devices. So far so good. 

At this point the mesh is working to your expectation ? Can you transport 
payload across the mesh ? If so, this is a deviation from #173 - wouldn't you 
agree ?


> But I can see via batctl td bat0 OGM packets sent with the MAC address of 
> the wlan interface of the device itself and also from the neigbour this 
> device is connected to via wlan. Is this OK?

Yes, batman-adv continues to use the mac addresses of the interfaces you 
configure.


Cheers,
Marek


[-- Attachment #1.3: 0001-do-not-call-master-netdev_ops-ndo_init.patch --]
[-- Type: text/x-patch, Size: 1676 bytes --]

From b810a3fa1168abe9f8d21f0d9c2b19f5ecf81e0e Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 19:24:06 +0800
Subject: [PATCH 1/3] do not call master->netdev_ops->ndo_init

---
 hard-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index fbda6b5..010a403 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -349,7 +349,7 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
  * is free'd and master can correctly change its internal state.
  * Return 0 on success, a negative value representing the error otherwise
  */
-static int batadv_master_del_slave(struct batadv_hard_iface *slave,
+/*tatic int batadv_master_del_slave(struct batadv_hard_iface *slave,
 				   struct net_device *master)
 {
 	int ret;
@@ -362,7 +362,7 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
 		ret = master->netdev_ops->ndo_del_slave(master, slave->net_dev);
 
 	return ret;
-}
+}*/
 
 int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 				   const char *iface_name)
@@ -403,10 +403,10 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	/* check if the interface is enslaved in another virtual one and
 	 * in that case unlink it first
 	 */
-	master = netdev_master_upper_dev_get(hard_iface->net_dev);
+	/* master = netdev_master_upper_dev_get(hard_iface->net_dev);
 	ret = batadv_master_del_slave(hard_iface, master);
 	if (ret)
-		goto err_dev;
+		goto err_dev; */
 
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
-- 
2.1.4


[-- Attachment #1.4: 0002-remove-netdev_-calls.patch --]
[-- Type: text/x-patch, Size: 1497 bytes --]

From df56faedb87a4beddbe8b478210bf71ebdfd7de5 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 21:18:05 +0800
Subject: [PATCH 2/3] remove netdev_* calls

---
 hard-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index 010a403..64ef086 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -411,9 +411,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
-	ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface);
+	/*ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface);
 	if (ret)
-		goto err_dev;
+		goto err_dev;*/
 
 	ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface);
 	if (ret < 0)
@@ -466,7 +466,7 @@ out:
 	return 0;
 
 err_upper:
-	netdev_upper_dev_unlink(hard_iface->net_dev, soft_iface);
+	/*netdev_upper_dev_unlink(hard_iface->net_dev, soft_iface);*/
 err_dev:
 	hard_iface->soft_iface = NULL;
 	dev_put(soft_iface);
@@ -521,7 +521,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 			batadv_softif_destroy_sysfs(hard_iface->soft_iface);
 	}
 
-	netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
+	/*netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);*/
 	hard_iface->soft_iface = NULL;
 	batadv_hardif_free_ref(hard_iface);
 
-- 
2.1.4


[-- Attachment #1.5: 0003-remove-ndo-workarounds.patch --]
[-- Type: text/x-patch, Size: 1570 bytes --]

From 05f48d1e40e55097ac960dc2a8a50d594cf967a8 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 18 Feb 2015 21:44:02 +0800
Subject: [PATCH 3/3] remove ndo workarounds

---
 compat.h         | 14 --------------
 soft-interface.c |  2 --
 2 files changed, 16 deletions(-)

diff --git a/compat.h b/compat.h
index 27d8a21..c3796a8 100644
--- a/compat.h
+++ b/compat.h
@@ -191,20 +191,6 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
-/* 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.
- */
-#define ndo_validate_addr \
-	ndo_validate_addr = eth_validate_addr, \
-}; \
-static const struct { \
-	void *ndo_validate_addr; \
-	void *ndo_add_slave; \
-	void *ndo_del_slave; \
-} __attribute__((unused)) __useless_ops1 = { \
-	.ndo_validate_addr
-
 #define ndo_del_slave          ndo_init
 #define ndo_init(x, y)         ndo_init - master->netdev_ops->ndo_init - EBUSY
 
diff --git a/soft-interface.c b/soft-interface.c
index 8748987..a73ebd0 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -874,8 +874,6 @@ static const struct net_device_ops batadv_netdev_ops = {
 	.ndo_set_rx_mode = batadv_interface_set_rx_mode,
 	.ndo_start_xmit = batadv_interface_tx,
 	.ndo_validate_addr = eth_validate_addr,
-	.ndo_add_slave = batadv_softif_slave_add,
-	.ndo_del_slave = batadv_softif_slave_del,
 };
 
 /**
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-18 13:55     ` Marek Lindner
@ 2015-02-18 14:56       ` Andreas Pape
  2015-02-18 15:22         ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-18 14:56 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

>At this point the mesh is working to your expectation ? Can you transport 

>payload across the mesh ? If so, this is a deviation from #173 - wouldn't 
you 
>agree ?

Before adding bat0 to the bridge br0 I can communicate via the mesh 
interface. I configured ip addresses for the bat0 interfaces on my devices 
and the ping worked without problems. But I understood from #173 that 
pinging was possible in that case, too. I'm referring to #173 because I 
can see the ogm messages received via wlan also at the bat0 interface, 
which was not the case in 2013.1.0 and earlier - if I remember my tests 
correctly...

In the meantime I found out that not only batman-adv stops receiving the 
ogm messages at ath0 but also the wpa_supplicant does not receive EAPOL 
frames any more as soon as bat0 is attached to the bridge br0 if I try to 
use WPA with the mesh interface (wpa_supplicant -i ath0). But I can see 
the EAPOL frames at the bridge interface br0 (via batctl td br0). Strange.

I'll come back to you as soon as I have tested your latest patches.

Thanks for your support,
Andreas




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-18 14:56       ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
@ 2015-02-18 15:22         ` Andreas Pape
  2015-02-18 15:45           ` Marek Lindner
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-18 15:22 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Hi Marek,

good news: the sum of the three patches you sent solved the problem as far 
as I have tested yet. Now bat0 works in combination with the bridge and 
also ethernet traffic is bridged into the mini-mesh setup I use correctly. 
Furthermore there are no ogm messages visible anymore at bat0 (with the 
command batctl td bat0).

Do you see a chance to add these changes to the compatibility code for 
older kernels (I guess for kernels < 2.6.39)?

Thanks for the excellent help,
Andreas


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Lindner @ 2015-02-18 15:45 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]

On Wednesday, February 18, 2015 16:22:18 Andreas Pape wrote:
> good news: the sum of the three patches you sent solved the problem as far 
> as I have tested yet. Now bat0 works in combination with the bridge and 
> also ethernet traffic is bridged into the mini-mesh setup I use correctly. 
> Furthermore there are no ogm messages visible anymore at bat0 (with the 
> command batctl td bat0).
> 
> Do you see a chance to add these changes to the compatibility code for 
> older kernels (I guess for kernels < 2.6.39)?

Sounds like we are on a good path! Glad to hear that!

Ultimately, we want to fix the problem and support the older kernels correctly. 
We still don't know what exactly created the problem. Can you try the patches 
one-by-one and let me know if a single also fixes the compat issue ? The first 
patch you already tried - remains patch 2 and 3.

Cheers,
Marek

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-18 15:45           ` Marek Lindner
@ 2015-02-18 16:10             ` Andreas Pape
  2015-02-19  4:15               ` Marek Lindner
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-18 16:10 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Hi Marek,

I reverted the changes step by step starting with patch 
0002-remove-netdev_calls.patch, as patch 1 did not help and patch 3 
containes in compat.h and soft-interface.c, I tried out myself earlier 
today.

The essential call is in patch 2 as assumed. As soon as I add the 
netdev_master_upper_dev_link call again to the compilable code, the 
problem starts to occur (mesh doesn't work as soon as bat0 is added to the 
bridge, ogm packets can be seen at bat0). It seems that this call behaves 
in older kernels different compared to newer ones.

I haven't tried to add all the other excluded parts again except for the 
netdev_master_upper_dev_link call. If you are interested I can test this 
tomorrow, too.

Regards,
Andreas


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Lindner @ 2015-02-19  4:15 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


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

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

On Wednesday, February 18, 2015 17:10:12 Andreas Pape wrote:
> The essential call is in patch 2 as assumed. As soon as I add the
> netdev_master_upper_dev_link call again to the compilable code, the
> problem starts to occur (mesh doesn't work as soon as bat0 is added to the
> bridge, ogm packets can be seen at bat0). It seems that this call behaves
> in older kernels different compared to newer ones.
> 
> I haven't tried to add all the other excluded parts again except for the
> netdev_master_upper_dev_link call. If you are interested I can test this
> tomorrow, too.

Can you try the attached patch without applying any of the previous patches ?
This patch is meant to fix the compat issue without harming any functionality 
and could be included in the next release.

Cheers,
Marek

=2D-nextPart2075742.AEyD6QK7me
Content-Disposition: attachment; filename="0001-batman-adv-make-netdev_set_master-generic-for-kernel.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0001-batman-adv-make-netdev_set_master-generic-for-kernel.patch"

From=20c01b68bc11a857770c2799f0b033852e05559431 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: make netdev_set_master() generic for 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() for kernels older than 2.6.39.

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

diff --git a/compat.h b/compat.h
index 27d8a21..f1da3da 100644
=2D-- a/compat.h
+++ b/compat.h
@@ -191,6 +191,30 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
+static inline int batadv_netdev_set_master(struct net_device *slave,
+					   struct net_device *master)
+{
+	struct net_device *old = slave->master;
+
+	ASSERT_RTNL();
+
+	if (master) {
+		if (old)
+			return -EBUSY;
+		dev_hold(master);
+	}
+
+	slave->master = master;
+
+	if (old) {
+		synchronize_net();
+		dev_put(old);
+	}
+	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-nextPart2075742.AEyD6QK7me--
This is a multi-part message in MIME format.

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

On Wednesday, February 18, 2015 17:10:12 Andreas Pape wrote:
> The essential call is in patch 2 as assumed. As soon as I add the
> netdev_master_upper_dev_link call again to the compilable code, the
> problem starts to occur (mesh doesn't work as soon as bat0 is added to the
> bridge, ogm packets can be seen at bat0). It seems that this call behaves
> in older kernels different compared to newer ones.
> 
> I haven't tried to add all the other excluded parts again except for the
> netdev_master_upper_dev_link call. If you are interested I can test this
> tomorrow, too.

Can you try the attached patch without applying any of the previous patches ?
This patch is meant to fix the compat issue without harming any functionality 
and could be included in the next release.

Cheers,
Marek

[-- Attachment #1.3: 0001-batman-adv-make-netdev_set_master-generic-for-kernel.patch --]
[-- Type: text/x-patch, Size: 1779 bytes --]

From c01b68bc11a857770c2799f0b033852e05559431 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: make netdev_set_master() generic for 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() for kernels older than 2.6.39.

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

diff --git a/compat.h b/compat.h
index 27d8a21..f1da3da 100644
--- a/compat.h
+++ b/compat.h
@@ -191,6 +191,30 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
+static inline int batadv_netdev_set_master(struct net_device *slave,
+					   struct net_device *master)
+{
+	struct net_device *old = slave->master;
+
+	ASSERT_RTNL();
+
+	if (master) {
+		if (old)
+			return -EBUSY;
+		dev_hold(master);
+	}
+
+	slave->master = master;
+
+	if (old) {
+		synchronize_net();
+		dev_put(old);
+	}
+	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 --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-19  4:15               ` Marek Lindner
@ 2015-02-19  8:31                 ` Andreas Pape
  2015-02-19  9:40                   ` Marek Lindner
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-19  8:31 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Hi Marek,

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?

Regards,
Andreas


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-19  8:31                 ` Andreas Pape
@ 2015-02-19  9:40                   ` Marek Lindner
  2015-02-19 10:28                     ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Lindner @ 2015-02-19  9:40 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


[-- 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 --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] Antwort: Re: Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-19  9:40                   ` Marek Lindner
@ 2015-02-19 10:28                     ` Andreas Pape
  2015-02-19 10:36                       ` Marek Lindner
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Pape @ 2015-02-19 10:28 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

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] 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0"
  2015-02-19 10:28                     ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
@ 2015-02-19 10:36                       ` Marek Lindner
  0 siblings, 0 replies; 13+ messages in thread
From: Marek Lindner @ 2015-02-19 10:36 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

On Thursday, February 19, 2015 11:28:24 Andreas Pape wrote:
> 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.

Thanks for testing! I'll stage the patch for inclusion.

Cheers,
Marek

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-02-19 10:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-02-19 10:28                     ` [B.A.T.M.A.N.] Antwort: " Andreas Pape
2015-02-19 10:36                       ` Marek Lindner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.