public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] Batman-advanced-dkms + debian + kernel >4.1
@ 2015-10-04 14:24 Christof Schulze
  2015-10-04 16:41 ` Sven Eckelmann
  0 siblings, 1 reply; 2+ messages in thread
From: Christof Schulze @ 2015-10-04 14:24 UTC (permalink / raw)
  To: siwu, b a t m a n; +Cc: info, thomas

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


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




-- 
()  ascii ribbon campaign - against html e-mail
/\  against proprietary attachments


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

end of thread, other threads:[~2015-10-04 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-04 14:24 [B.A.T.M.A.N.] Batman-advanced-dkms + debian + kernel >4.1 Christof Schulze
2015-10-04 16:41 ` Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox