From patchwork Thu Feb 19 04:15:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 4322 Return-Path: Received-SPF: Softfail (domain owner discourages use of this host) identity=mailfrom; client-ip=5.148.176.57; helo=s1.neomailbox.net; envelope-from=mareklindner@neomailbox.ch; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from s1.neomailbox.net (s1.neomailbox.net [5.148.176.57]) by open-mesh.org (Postfix) with ESMTPS id CFF296013D3 for ; Thu, 19 Feb 2015 05:15:53 +0100 (CET) From: Marek Lindner To: The list for a Better Approach To Mobile Ad-hoc Networking Date: Thu, 19 Feb 2015 12:15:45 +0800 Message-ID: <1549090.s6anOn0kWk@voltaire> User-Agent: KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: References: <23381002.yeogTpj88W@voltaire> MIME-Version: 1.0 Subject: Re: [B.A.T.M.A.N.] Antwort: Re: Antwort: Antwort: Re: Antwort: Re: Question concerning batman-adv bug #173 "Mesh packets on bat0" X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking 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: Thu, 19 Feb 2015 04:15:54 -0000 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 From c01b68bc11a857770c2799f0b033852e05559431 Mon Sep 17 00:00:00 2001 From: Marek Lindner 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 Signed-off-by: Marek Lindner --- 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