Skip to contentSkip to conversation

netfilter: avoid arp/bridge WARN_ON if arp/ebtables not supported

PATCH Applied Florian Westphal 2 participants 2 messages Jan 8, 2018 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: avoid arp/bridge WARN_ON if arp/ebtables not supported

We need to retain the 'case' statement, otherwise, if e.g. arp tables isn't supported first NF_HOOK(NFPROTO_ARP, ... will produce a bogus WARN_ON().

Fixes 8de98f05836 ("netfilter: don't allocate space for arp/bridge hooks unless needed")
---
 include/linux/netfilter.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/netfilter.h +4 -4
index 84987186aa26..85a1a0b32c66 100644
@@ -214,16 +214,16 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
 	case NFPROTO_IPV6:
 		hook_head = rcu_dereference(net->nf.hooks_ipv6[hook]);
 		break;
-#ifdef CONFIG_NETFILTER_FAMILY_ARP
 	case NFPROTO_ARP:
+#ifdef CONFIG_NETFILTER_FAMILY_ARP
 		hook_head = rcu_dereference(net->nf.hooks_arp[hook]);
-		break;
 #endif
-#ifdef CONFIG_NETFILTER_FAMILY_BRIDGE
+		break;
 	case NFPROTO_BRIDGE:
+#ifdef CONFIG_NETFILTER_FAMILY_BRIDGE
 		hook_head = rcu_dereference(net->nf.hooks_bridge[hook]);
-		break;
 #endif
+		break;
 #if IS_ENABLED(CONFIG_DECNET)
 	case NFPROTO_DECNET:
 		hook_head = rcu_dereference(net->nf.hooks_decnet[hook]);
Signature · 1 line
2.13.6
maintainer Applied
#1 lore raw
Quoted 3 lines · Florian Westphal

We need to retain the 'case' statement, otherwise, if e.g. arp tables isn't supported first NF_HOOK(NFPROTO_ARP, ... will produce a bogus WARN_ON().

Applied, thanks Florian.