From patchwork Sun Oct 4 14:24:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christof Schulze X-Patchwork-Id: 4695 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=212.227.17.21; helo=mout.gmx.net; envelope-from=christof.schulze@gmx.net; receiver=b.a.t.m.a.n@lists.open-mesh.org X-Greylist: delayed 313 seconds by postgrey-1.35 at open-mesh.org; Sun, 04 Oct 2015 16:29:27 CEST Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by open-mesh.org (Postfix) with ESMTPS id 5BD1D80525 for ; Sun, 4 Oct 2015 16:29:27 +0200 (CEST) Received: from lappi.localdomain ([213.211.220.187]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MZxch-1a3zRy3DTj-00LnuY; Sun, 04 Oct 2015 16:24:14 +0200 Received: by lappi.localdomain (Postfix, from userid 1000) id 34BB636A277; Sun, 4 Oct 2015 16:24:12 +0200 (CEST) From: Christof Schulze To: siwu@hrz.tu-chemnitz.de, b a t m a n Date: Sun, 04 Oct 2015 16:24:11 +0200 Message-ID: <37028290.5tXI0TbgDB@lappi> User-Agent: KMail/4.14.6 (Linux/3.19.0-25-generic; KDE/4.14.6; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:gzk91tlNZixBZm/9iGD2x6Pixa2m8oPwkTgOeqAVBi45zXSPSUj YVNzzzQ+k/vtcaDeApOFBM/DLYu0Z8i/yX7gRFTaYOkhI4iR9RAQXz107YyxKZz7K1+jbEm DVXhOHOFj9ebaPrXKKT1Nkh5lJgDyKWBQEYULFXnDnfqF/rPKhFYJQe/ZC1puZT7fKtI2eD Zj2M5RAQLo7IFlEEt49eA== X-UI-Out-Filterresults: notjunk:1; V01:K0:0LZCPcJeEQM=:RVEQC1RkhMoStux3yg6mBI IkU6DV1qDaZwo1drzsgMUC6HI9nMwEYHAXdKMj+zRdTcen9LAjpBoOwkqQNmvAeI8t9GB+e0u Dlv7sjZzFVtaUw6ufom932Ejc5I9qBN9sOmM/b2FqG1Mx4OQ2HKhb4Nz//PMIF2rEKBYtSh8e cNB8FMQ4VGWL/pAz1tLdx9n/x5y9c9bDL40dOvnxTNL97qQP8/c41NSePV3xBhN5LQdb9eSql 199DdA06zyubvhJ3f2o54NLsRmvKfzEOxtlgePKZs/DH6LAX/M7CkSC4lqu4hbNGbqddUCa7N cnQRRnVGHPK9L3ao5XANF1yS55oI3tpgZy8dFWPgXjhgtBoz3E3YX7LmF2awMoheFWyJdoCI0 a8eWAl+Zr667duXybuyDZJKFon0c/XvmmmOGMNh54emiW/hk9hSQedM6kvWLlE6yxAlqSnzG5 wdjSXd6jtqG2iLNvMQNKDipWzijBltyO/npX1hhTt5VCkHffNqqvzXuY7LXvy8bZ6Vf55e8tm nIVFUwtKpp9T35WAEhFweALS00/lUiJXV6F/NLagqfTtrz4u2E6FhnTTxKiDFr59yO51sCyZc wUNdHN6NXVGmA5AqSaG9VvU4U7IqKNew4IfmdR7jOBBW7Bmed/ZczkQz8eV/6w8Apwl4AqE9+ ZxshuLzkYEYjFvP4mMGjlHuraHmolaKAFEXA1G8jEYcqqA16RaE09j+UTm8f/ZlDTJh0qMW0T 0pdN9KISndMyWY6AZ5Wz/kzO/B9lvHicZo/8zqZzIoEHN5WQ6MfofV8XsMTQyQYHhDQcCMsgv bk2tYi8 Cc: info@wifi-frankfurt.de, thomas@t-8ch.de Subject: [B.A.T.M.A.N.] Batman-advanced-dkms + debian + kernel >4.1 X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Oct 2015 14:29:27 -0000 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)