Skip to contentSkip to conversation

netfilter: bridge: make NF_TABLES_BRIDGE tristate

PATCH Applied Arnd Bergmann 2 participants 5 messages Jul 10, 2019 – Jul 19, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: bridge: make NF_TABLES_BRIDGE tristate

The new nft_meta_bridge code fails to link as built-in when NF_TABLES is a loadable module.

net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_eval':
nft_meta_bridge.c:(.text+0x1e8): undefined reference to nft_meta_get_eval' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_get_init':
nft_meta_bridge.c:(.text+0x468): undefined reference to nft_meta_get_init' nft_meta_bridge.c:(.text+0x49c): undefined reference to nft_parse_register' nft_meta_bridge.c:(.text+0x4cc): undefined reference to nft_validate_register_store' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_exit':
nft_meta_bridge.c:(.exit.text+0x14): undefined reference to nft_unregister_expr' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_init':
nft_meta_bridge.c:(.init.text+0x14): undefined reference to nft_register_expr' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x60): undefined reference to nft_meta_get_dump' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x88): undefined reference to `nft_meta_set_eval'

This can happen because the NF_TABLES_BRIDGE dependency itself is just a 'bool'. Make the symbol a 'tristate' instead so Kconfig can propagate the dependencies correctly.

Fixes 30e103fe24de ("netfilter: nft_meta: move bridge meta keys into nft_meta_bridge")
---
 net/bridge/netfilter/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/netfilter/Kconfig +1 -1
index 154fa558bb90..d0c75d7ec074 100644
@@ -6,7 +6,7 @@
 menuconfig NF_TABLES_BRIDGE
 	depends on BRIDGE && NETFILTER && NF_TABLES
 	select NETFILTER_FAMILY_BRIDGE
-	bool "Ethernet Bridge nf_tables support"
+	tristate "Ethernet Bridge nf_tables support"
 
 if NF_TABLES_BRIDGE
 
Signature · 1 line
2.20.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Arnd Bergmann

The new nft_meta_bridge code fails to link as built-in when NF_TABLES is a loadable module.

Applied, thanks Arnd.

#2 lore raw
In reply to Arnd Bergmann
Quoted 16 lines · Arnd Bergmann

The new nft_meta_bridge code fails to link as built-in when NF_TABLES is a loadable module.

net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_eval':
nft_meta_bridge.c:(.text+0x1e8): undefined reference to nft_meta_get_eval' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_get_init':
nft_meta_bridge.c:(.text+0x468): undefined reference to nft_meta_get_init' nft_meta_bridge.c:(.text+0x49c): undefined reference to nft_parse_register' nft_meta_bridge.c:(.text+0x4cc): undefined reference to nft_validate_register_store' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_exit':
nft_meta_bridge.c:(.exit.text+0x14): undefined reference to nft_unregister_expr' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_init':
nft_meta_bridge.c:(.init.text+0x14): undefined reference to nft_register_expr' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x60): undefined reference to nft_meta_get_dump' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x88): undefined reference to `nft_meta_set_eval'

Quoted 3 lines

This can happen because the NF_TABLES_BRIDGE dependency itself is just a 'bool'. Make the symbol a 'tristate' instead so Kconfig can propagate the dependencies correctly.

Hm. Something breaks here. Investigating. Looks like bridge support is gone after this, nft fails to register the filter chain type:

# nft add table bridge x
# nft add chain bridge x y { type filter hook input priority 0\; }
Error: Could not process rule: No such file or directory
#3 lore raw
Quoted 21 lines · Pablo Neira Ayuso
Quoted 16 lines · Arnd Bergmann

The new nft_meta_bridge code fails to link as built-in when NF_TABLES is a loadable module.

net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_eval':
nft_meta_bridge.c:(.text+0x1e8): undefined reference to nft_meta_get_eval' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_get_init':
nft_meta_bridge.c:(.text+0x468): undefined reference to nft_meta_get_init' nft_meta_bridge.c:(.text+0x49c): undefined reference to nft_parse_register' nft_meta_bridge.c:(.text+0x4cc): undefined reference to nft_validate_register_store' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_exit':
nft_meta_bridge.c:(.exit.text+0x14): undefined reference to nft_unregister_expr' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_init':
nft_meta_bridge.c:(.init.text+0x14): undefined reference to nft_register_expr' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x60): undefined reference to nft_meta_get_dump' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x88): undefined reference to `nft_meta_set_eval'

Quoted 3 lines

This can happen because the NF_TABLES_BRIDGE dependency itself is just a 'bool'. Make the symbol a 'tristate' instead so Kconfig can propagate the dependencies correctly.

Quoted 6 lines

Hm. Something breaks here. Investigating. Looks like bridge support is gone after this, nft fails to register the filter chain type:

# nft add table bridge x
# nft add chain bridge x y { type filter hook input priority 0\; }
Error: Could not process rule: No such file or directory

Found it. It seems this patch is needed, on top of your patch.

I can just squash this chunk into your original patch and push it out if you're OK witht this.

Thanks.

net/netfilter/nft_chain_filter.c +1 -1
index 3fd540b2c6ba..b5d5d071d765 100644
@@ -193,7 +193,7 @@ static inline void nft_chain_filter_inet_init(void) {}
 static inline void nft_chain_filter_inet_fini(void) {}
 #endif /* CONFIG_NF_TABLES_IPV6 */
 
-#ifdef CONFIG_NF_TABLES_BRIDGE
+#if IS_ENABLED(CONFIG_NF_TABLES_BRIDGE)
 static unsigned int
 nft_do_chain_bridge(void *priv,
 		    struct sk_buff *skb,
#4 lore raw
Quoted 23 lines · Pablo Neira Ayuso
Quoted 21 lines · Pablo Neira Ayuso
Quoted 19 lines · Arnd Bergmann

The new nft_meta_bridge code fails to link as built-in when NF_TABLES is a loadable module.

net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_eval':
nft_meta_bridge.c:(.text+0x1e8): undefined reference to nft_meta_get_eval' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_get_init':
nft_meta_bridge.c:(.text+0x468): undefined reference to nft_meta_get_init' nft_meta_bridge.c:(.text+0x49c): undefined reference to nft_parse_register' nft_meta_bridge.c:(.text+0x4cc): undefined reference to nft_validate_register_store' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_exit':
nft_meta_bridge.c:(.exit.text+0x14): undefined reference to nft_unregister_expr' net/bridge/netfilter/nft_meta_bridge.o: In function nft_meta_bridge_module_init':
nft_meta_bridge.c:(.init.text+0x14): undefined reference to nft_register_expr' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x60): undefined reference to nft_meta_get_dump' net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x88): undefined reference to `nft_meta_set_eval'

This can happen because the NF_TABLES_BRIDGE dependency itself is just a 'bool'. Make the symbol a 'tristate' instead so Kconfig can propagate the dependencies correctly.

Quoted 8 lines
Quoted 6 lines

Hm. Something breaks here. Investigating. Looks like bridge support is gone after this, nft fails to register the filter chain type:

# nft add table bridge x
# nft add chain bridge x y { type filter hook input priority 0\; }
Error: Could not process rule: No such file or directory

Found it. It seems this patch is needed, on top of your patch.

Right, makes sense.

Quoted 2 lines

I can just squash this chunk into your original patch and push it out if you're OK witht this.

Yes, please do.

Arnd