From patchwork Fri Oct 9 12:45:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 528206 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 336431409B7 for ; Fri, 9 Oct 2015 23:45:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755907AbbJIMpa (ORCPT ); Fri, 9 Oct 2015 08:45:30 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:61657 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755874AbbJIMp2 (ORCPT ); Fri, 9 Oct 2015 08:45:28 -0400 Received: from wuerfel.localnet ([149.172.15.242]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0MGJlf-1ZmwxH1Zyh-00FFqo; Fri, 09 Oct 2015 14:45:24 +0200 From: Arnd Bergmann To: Pablo Neira Ayuso Cc: Patrick McHardy , Jozsef Kadlecsik , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, "Eric W. Biederman" , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH] netfilter: turn NF_HOOK into an inline function Date: Fri, 09 Oct 2015 14:45:20 +0200 Message-ID: <7665226.mEs2QJDTOT@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:e0xiPEAY3rMsjWC9s7cf5QsA/VId+il+3cAqozrbIUSvGApktmY TTfdUajF3Fad0WEw4pqAIEecRR3zwTEDD1fE48wLtXCgd3IdNE+SB5/Um5bZ+Qbv5Cw8mPR qObhxFYG09DLKph7OhTFB5gAMj1gUmcK44KmLDmrxhz6cworE3YZA86ExW3NpF6aEfHSsd4 5MANEOa9px4mF0h+W6y1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:M8xjDzzf/6w=:kooy+OzaoQpLE0oUKmcGdO KtcApCyxHgXrLZXzwAKLyYk6IE4kfXYLtWSMbnXgpjJifcpM3uVa+jV+ZHmrmkRB2d8ZqEBZn PZ3CJV8ui7OagYyLN+DWdK14HJa1LgNlPPh0QNSpldknIxJqkvZu9AsvusWkVLVvE1xRgvsar S+ZKSko8esLiRkF8kd9u/KOiYjlDJN202KwjRejL0+uSwk9HNDfR6F0b3UpR7bmQ7rwpgE+dY KigbHf12n4Dho8W/Z+GkRKnr0v5hHvt7oY5ZaW/+PcGs4FUpSykR7jTZSDIGphvpnTCm7sj1o DaczB5AzYPkaF8NqVNKagdheafSkDPjsudA7OOcSLd8ALbt1MaM1n19Jplm+DVbHyTh3uSO1j vHE4kOPY12eFxTbLe0kkc/NSfsxVNTBotcYSWVaMD+iZU/XqrBMfYn30BH9xA4vtUz95g4fe7 hdNcdK1U8a3JIPyod1Sx44mfFxTBfIdJ7LCFaNuRjqP6ehRS6W2U7B6dvGIrZbXfG0NLvhVtT wlxg9JHppq+fUvlYta8jQiKyceijmI7WEa6eMcoFADtHWUKUOLRORShFH4fIdN+3Eqisn0r3V qe31+x9ab40cd6ywEkwEUalX9QcSYBdzBWvmBk7tg/J5/b5IumwJNSIOZAkEZrclINmcsR+7G vpAZG1dI/eBusvkvMl6BXLQrMQpKWF1OqKd5c8jdwn4UkdD7SHcjf2VCOm1sgxv0c7fmRJt0M LF9aBLLBL3AP3JIY Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org A recent change to the dst_output handling caused a new warning when the call to NF_HOOK() is the only used of a local variable passed as 'dev', and CONFIG_NETFILTER is disabled: net/ipv6/ip6_output.c: In function 'ip6_output': net/ipv6/ip6_output.c:135:21: warning: unused variable 'dev' [-Wunused-variable] The reason for this is that the NF_HOOK macro in this case does not reference the variable at all. To avoid that warning now and in the future, this changes the macro into an equivalent inline function, which tells the compiler that the variable is passed correctly but still unused. Signed-off-by: Arnd Bergmann Fixes: ede2059dbaf9 ("dst: Pass net into dst->output") --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index edb3dc32f1da..1ff5c3f82820 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -347,8 +347,23 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) } #else /* !CONFIG_NETFILTER */ -#define NF_HOOK(pf, hook, net, sk, skb, indev, outdev, okfn) (okfn)(net, sk, skb) -#define NF_HOOK_COND(pf, hook, net, sk, skb, indev, outdev, okfn, cond) (okfn)(net, sk, skb) +static inline int +NF_HOOK_COND(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, + struct sk_buff *skb, struct net_device *in, struct net_device *out, + int (*okfn)(struct net *, struct sock *, struct sk_buff *), + bool cond) +{ + return okfn(net, sk, skb); +} + +static inline int +NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct net *, struct sock *, struct sk_buff *)) +{ + return okfn(net, sk, skb); +} + static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct sk_buff *skb, struct net_device *indev, struct net_device *outdev,