From patchwork Fri Apr 29 19:51:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 15996 Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id DDCCE822CE; Fri, 29 Apr 2016 21:51:17 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=SoNQJ3U0; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 5678D804C3 for ; Fri, 29 Apr 2016 21:51:16 +0200 (CEST) Received: from sven-edge.localnet (p200300C593C12BFD0000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c1:2bfd::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 09F7A1100F1; Fri, 29 Apr 2016 21:51:16 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1461959476; bh=avLoeS1pIaTWRJk6Dqx3wrDkPPWCGLM8VHmtn6+I9Zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoNQJ3U0kshWBfSaQ8JPzdLmWXMvxRF8vmx7Pq3EmjNGlWWYI9AX3XnfKhjJ9KK3c 7Q/jUTjkaNmKXu5OUOdx8/PyJXSi/An976S2EI5x2KXXuuedp1eppVSqK47phdWkYm xXr8PHaJwUqTHA8okoU4R0PEMw2Wqa/+pm6Eb6eE= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 29 Apr 2016 21:51:12 +0200 Message-ID: <7460918.gGjtq2HAJI@sven-edge> User-Agent: KMail/4.14.10 (Linux/4.5.0-1-amd64; KDE/4.14.14; x86_64; ; ) In-Reply-To: <13794357.HqoOAIfBmV@bentobox> References: <1461875848-11720-1-git-send-email-andrew@lunn.ch> <20160429121427.GB4053@lunn.ch> <13794357.HqoOAIfBmV@bentobox> MIME-Version: 1.0 Subject: Re: [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: Handle parent interfaces in a different netns 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: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" On Friday 29 April 2016 14:59:21 Sven Eckelmann wrote: > On Friday 29 April 2016 14:14:27 Andrew Lunn wrote: > > On Fri, Apr 29, 2016 at 07:52:42AM +0200, Sven Eckelmann wrote: > > > On Thursday 28 April 2016 22:37:19 Andrew Lunn wrote: > > > > batman-adv tries to prevent the user from placing a batX soft > > > > interface into another batman mesh as a hard interface. It does this > > > > by walking up the devices list of parents and ensures they are all > > > > none batX interfaces. iflink can point to an interface in a different > > > > namespace, so also retrieve the parents name space when finding the > > > > parent and use it when doing the comparison. > > > > > > > > Signed-off-by: Andrew Lunn > > > > Acked-by: Antonio Quartulli > > > > --- > > > > > > You are unfortunately reverting back to an older version of the patch > > > which is harder to make compile on older kernels. > > > > Hi Sven > > > > Please point me at the version you would prefer. > > Partially this one: https://patchwork.open-mesh.org/patch/15921/ > > I know that your current submission doesn't contain the compat-patches part > (which I find rather ugly) but this version has only a single function > handling the batadv_getlink_net and thus could be easier to create some wild > #defines working around the compat problem on older versions. But it will > most likely end with a warning and being a big NOP on older kernels. > > It is something like (untested): > > /* WARNING dirty hack for batadv_getlink_net */ > #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) > #define get_link_net get_xstats_size || 1 || > netdev->rtnl_link_ops->get_xstats_size #endif Attached is the patch version of the hack. It creates following warning: /tmp/qemu-batman/batman-adv/net/batman-adv/hard-interface.c:103:9: warning: return makes pointer from integer without a cast [-Wint-conversion] return netdev->rtnl_link_ops->get_link_net(netdev); ^ If somebody else has a good/better idea then please post it. Kind regards, Sven From: Sven Eckelmann Date: Fri, 29 Apr 2016 21:48:55 +0200 Subject: [PATCH] get_link_net hack --- compat.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compat.h b/compat.h index 5a5f478..0644241 100644 --- a/compat.h +++ b/compat.h @@ -140,6 +140,13 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\ #endif /* < KERNEL_VERSION(3, 15, 0) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) + +/* WARNING for batadv_getlink_net */ +#define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size + +#endif /* < KERNEL_VERSION(4, 0, 0) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) #define IFF_NO_QUEUE 0; dev->tx_queue_len = 0