netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: Clean up unnecessary #ifdef
@ 2019-11-20 11:33 Lukas Wunner
  2019-12-17 21:58 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wunner @ 2019-11-20 11:33 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal
  Cc: netfilter-devel, coreteam, netdev, Daniel Borkmann

If CONFIG_NETFILTER_INGRESS is not enabled, nf_ingress() becomes a no-op
because it solely contains an if-clause calling nf_hook_ingress_active(),
for which an empty inline stub exists in <linux/netfilter_ingress.h>.

All the symbols used in the if-clause's body are still available even if
CONFIG_NETFILTER_INGRESS is not enabled.

The additional "#ifdef CONFIG_NETFILTER_INGRESS" in nf_ingress() is thus
unnecessary, so drop it.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Daniel Borkmann <daniel@iogearbox.net>
---
Resending this patch without RFC tag on Pablo's request since it's just
an uncontroversial cleanup.

Previous submission:
https://lore.kernel.org/netfilter-devel/ba3cc38580d4cb43aa5599524ec5e5205d6dfa77.1572528496.git.lukas@wunner.de/

 net/core/dev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index da78a433c10c..330c6d21cc1c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4932,7 +4932,6 @@ static bool skb_pfmemalloc_protocol(struct sk_buff *skb)
 static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev,
 			     int *ret, struct net_device *orig_dev)
 {
-#ifdef CONFIG_NETFILTER_INGRESS
 	if (nf_hook_ingress_active(skb)) {
 		int ingress_retval;
 
@@ -4946,7 +4945,6 @@ static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev,
 		rcu_read_unlock();
 		return ingress_retval;
 	}
-#endif /* CONFIG_NETFILTER_INGRESS */
 	return 0;
 }
 
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf-next] netfilter: Clean up unnecessary #ifdef
  2019-11-20 11:33 [PATCH nf-next] netfilter: Clean up unnecessary #ifdef Lukas Wunner
@ 2019-12-17 21:58 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-12-17 21:58 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
	netdev, Daniel Borkmann

On Wed, Nov 20, 2019 at 12:33:59PM +0100, Lukas Wunner wrote:
> If CONFIG_NETFILTER_INGRESS is not enabled, nf_ingress() becomes a no-op
> because it solely contains an if-clause calling nf_hook_ingress_active(),
> for which an empty inline stub exists in <linux/netfilter_ingress.h>.
> 
> All the symbols used in the if-clause's body are still available even if
> CONFIG_NETFILTER_INGRESS is not enabled.
> 
> The additional "#ifdef CONFIG_NETFILTER_INGRESS" in nf_ingress() is thus
> unnecessary, so drop it.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-17 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 11:33 [PATCH nf-next] netfilter: Clean up unnecessary #ifdef Lukas Wunner
2019-12-17 21:58 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).