From patchwork Thu Sep 22 09:40:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101760 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2498354qgf; Thu, 22 Sep 2016 02:41:47 -0700 (PDT) X-Received: by 10.66.26.113 with SMTP id k17mr1758831pag.100.1474537307061; Thu, 22 Sep 2016 02:41:47 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x67si1372966pfk.12.2016.09.22.02.41.46; Thu, 22 Sep 2016 02:41:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754197AbcIVJlp (ORCPT + 4 others); Thu, 22 Sep 2016 05:41:45 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:54244 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755623AbcIVJlm (ORCPT ); Thu, 22 Sep 2016 05:41:42 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MRhLp-1bOZk71uMz-00SxMt; Thu, 22 Sep 2016 11:41:34 +0200 From: Arnd Bergmann To: "David S. Miller" Cc: Arnd Bergmann , Mahesh Bandewar , David Ahern , Eric Dumazet , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ipvlan: fix building without netfilter Date: Thu, 22 Sep 2016 11:40:52 +0200 Message-Id: <20160922094130.2154824-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: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@vger.kernel.org The new l3s mode in ipvlan relies on netfilter interfaces, but the ipvlan driver can be configured when CONFIG_NETFILTER is disabled, leading to a build error: drivers/net/ipvlan/ipvlan.h:132:22: error: 'struct nf_hook_state' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] drivers/net/ipvlan/ipvlan_main.c:14:27: error: array type has incomplete element type 'struct nf_hook_ops' ... This adds a forward declaration for struct nf_hook_state, and hides the newly added l3s code in an #ifdef. Fixes: 4fbae7d83c98 ("ipvlan: Introduce l3s mode") Signed-off-by: Arnd Bergmann --- drivers/net/ipvlan/ipvlan.h | 1 + drivers/net/ipvlan/ipvlan_main.c | 8 ++++++++ 2 files changed, 9 insertions(+) -- 2.9.0 diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h index 7e0732f5ea07..e239b90e42e0 100644 --- a/drivers/net/ipvlan/ipvlan.h +++ b/drivers/net/ipvlan/ipvlan.h @@ -128,6 +128,7 @@ bool ipvlan_addr_busy(struct ipvl_port *port, void *iaddr, bool is_v6); void ipvlan_ht_addr_del(struct ipvl_addr *addr); struct sk_buff *ipvlan_l3_rcv(struct net_device *dev, struct sk_buff *skb, u16 proto); +struct nf_hook_state; unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb, const struct nf_hook_state *state); #endif /* __IPVLAN_H */ diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index f442eb366863..19e8b0b1b56f 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -9,6 +9,7 @@ #include "ipvlan.h" +#ifdef CONFIG_NETFILTER static u32 ipvl_nf_hook_refcnt = 0; static struct nf_hook_ops ipvl_nfops[] __read_mostly = { @@ -25,6 +26,7 @@ static struct nf_hook_ops ipvl_nfops[] __read_mostly = { .priority = INT_MAX, }, }; +#endif static struct l3mdev_ops ipvl_l3mdev_ops __read_mostly = { .l3mdev_l3_rcv = ipvlan_l3_rcv, @@ -37,6 +39,7 @@ static void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev) static int ipvlan_register_nf_hook(void) { +#ifdef CONFIG_NETFILTER int err = 0; if (!ipvl_nf_hook_refcnt) { @@ -48,15 +51,20 @@ static int ipvlan_register_nf_hook(void) } return err; +#else + return -EINVAL; +#endif } static void ipvlan_unregister_nf_hook(void) { +#ifdef CONFIG_NETFILTER WARN_ON(!ipvl_nf_hook_refcnt); ipvl_nf_hook_refcnt--; if (!ipvl_nf_hook_refcnt) _nf_unregister_hooks(ipvl_nfops, ARRAY_SIZE(ipvl_nfops)); +#endif } static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)