Batman-advanced-dkms + debian + kernel >4.1

Message ID 37028290.5tXI0TbgDB@lappi (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Christof Schulze Oct. 4, 2015, 2:24 p.m. UTC
  Hello Simon,

when trying to run batman v14 on a current kernel (I noticed it for Version
4.1) I realized that batman will not build beause the netdev-structs
  have changed.
The solution is fairly simple because the fix has already been
implemented in newer batman versions. The function
batadv_is_on_batman_iface can be copied from there and is working fine.

I am running a system with kernel 4.1 that was patched in this manner
and it has been working fine in a large mesh (Freifunk Frankfurt am
Main) for a week.
The patch should work well for older kernels too because the
netdev-changes have been there for quite a while.

Now: Where is the correct place to implement the patch: in
batman-adv-dkms or in batman itself?

Regards
Christof
  

Comments

Sven Eckelmann Oct. 4, 2015, 4:41 p.m. UTC | #1
On Sunday 04 October 2015 16:24:11 Christof Schulze wrote:
> Hello Simon,
> 
> when trying to run batman v14 on a current kernel (I noticed it for Version
> 4.1) I realized that batman will not build beause the netdev-structs
>   have changed.

v14 is not maintained anymore in the official batman-adv repositories. You may 
instead try to contact the developers of the batman-adv-legacy [1] gluon fork.

> The solution is fairly simple because the fix has already been
> implemented in newer batman versions. The function
> batadv_is_on_batman_iface can be copied from there and is working fine.
> 
[...]
> 
> Now: Where is the correct place to implement the patch: in
> batman-adv-dkms or in batman itself?

Which batman-adv-dkms? I was maintaining a Debian package with that name but 
this was dropped a long time ago... I think 2011 or so. But I would guess that 
you want to add a patch to your "batman-adv-dkms" that patches batman-adv so 
dkms is able to build it against your current kernel. Or get the patch 
directly into your batman-adv v14 fork... But this is nothing Simon or I can 
help you with because we stopped working on v14 and batman-adv-dkms years ago.

Most likely you are talking about gluon based batman-adv-dkms [2] package 
which is also made by the batman-adv-legacy people. But these packages clearly 
states that Matthias Schiffer <mschiffer@universe-factory.net> is responsible 
for them (ok, he forgot to change it maintainer name in 
debian/control.modules.in and didn't update the upstream addresses). So you 
better contact him when you are using his forks. He most likely has complete 
different ideas how this patch has to look like because he isn't interested in 
getting it merged into the official Linux repository.

Kind regards,
	Sven

[1] https://github.com/freifunk-gluon/batman-adv-legacy
[2] http://repo.universe-factory.net/debian/pool/main/b/batman-adv-kernelland/
  

Patch

--- hard-interface.c-orig	2015-09-25 09:58:07.123947197 +0200
+++ hard-interface.c	2015-09-25 10:04:34.611914938 +0200
@@ -74,29 +74,28 @@ 
  * if it is a batman-adv interface itself), false otherwise
  */
 static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
-{
-	struct net_device *parent_dev;
-	bool ret;
+{       
+        struct net_device *parent_dev;
+        bool ret;
+        
+        /* check if this is a batman-adv mesh interface */
+        if (batadv_softif_is_valid(net_dev))
+                return true;                                                                                  
+                                                                                                              
+        /* no more parents..stop recursion */                                                                 
+        if (dev_get_iflink(net_dev) == 0 ||
+            dev_get_iflink(net_dev) == net_dev->ifindex)
+                return false;
+
+        /* recurse over the parent device */
+        parent_dev = __dev_get_by_index(&init_net, dev_get_iflink(net_dev));
+        /* if we got a NULL parent_dev there is something broken.. */
+        if (WARN(!parent_dev, "Cannot find parent device"))
+                return false;
 
-	/* check if this is a batman-adv mesh interface */
-	if (batadv_softif_is_valid(net_dev))
-		return true;
+        ret = batadv_is_on_batman_iface(parent_dev);
 
-	/* no more parents..stop recursion */
-	if (net_dev->iflink == net_dev->ifindex)
-		return false;
-
-	/* recurse over the parent device */
-	parent_dev = dev_get_by_index(&init_net, net_dev->iflink);
-	/* if we got a NULL parent_dev there is something broken.. */
-	if (WARN(!parent_dev, "Cannot find parent device"))
-		return false;
-
-	ret = batadv_is_on_batman_iface(parent_dev);
-
-	if (parent_dev)
-		dev_put(parent_dev);
-	return ret;
+        return ret;
 }
 
 static int batadv_is_valid_iface(const struct net_device *net_dev)