Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1243316

[PATCH] netfilter: turn NF_HOOK into an inline function

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] netfilter: turn NF_HOOK into an inline function
Date 2015-10-09 14:50 +0200
Message-ID <qhFhv-2oj-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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 <arnd@arndb.de>
Fixes: ede2059dbaf9 ("dst: Pass net into dst->output")

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,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] netfilter: turn NF_HOOK into an inline function Arnd Bergmann <arnd@arndb.de> - 2015-10-09 14:50 +0200
  Re: [PATCH] netfilter: turn NF_HOOK into an inline function kbuild test robot <lkp@intel.com> - 2015-10-09 15:10 +0200
    Re: [PATCH] netfilter: turn NF_HOOK into an inline function Arnd Bergmann <arnd@arndb.de> - 2015-10-09 15:20 +0200
      Re: [PATCH] netfilter: turn NF_HOOK into an inline function ebiederm@xmission.com (Eric W. Biederman) - 2015-10-09 20:40 +0200
  Re: [PATCH] netfilter: turn NF_HOOK into an inline function ebiederm@xmission.com (Eric W. Biederman) - 2015-10-09 20:40 +0200
    [PATCH v2] netfilter: turn NF_HOOK into an inline function Arnd Bergmann <arnd@arndb.de> - 2015-10-09 20:50 +0200
      Re: [PATCH v2] netfilter: turn NF_HOOK into an inline function Pablo Neira Ayuso <pablo@netfilter.org> - 2015-10-16 18:40 +0200

csiph-web