mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 01:59:02 +00:00
kernel: 3.18: Fix patch 644 dependency chain
This patch introduces some code that is compiled in whenever CONFIG_BRIDGE_NETFILTER is built, with the code called from code compiled under CONFIG_BRIDGE, CONFIG_BRIDGE_IGMP_SNOOPING or CONFIG_BRIDGE_NF_EBTABLES. Unfortunately, these options aren't setting explicitly the dependency they now have on CONFIG_BRIDGE_NETFILTER, for obvious reasons for CONFIG_BRIDGE. However, this is not working really well when CONFIG_BRIDGE_NETFILTER is built as a module, since code statically compiled will now use a function that is not in the kernel image, which makes the linker grumpy. Solve this by removing the option to build CONFIG_BRIDGE_NETFILTER as a module, and protect our function definition by an IS_BUILTIN instead of a IS_ENABLED macro. This fixes the issue for CONFIG_BRIDGE and CONFIG_BRIDGE_IGMP_SNOOPING. Fixing CONFIG_BRIDGE_NF_EBTABLES has to be handled a bit differently, since it directly references a variable that will not be declared if CONFIG_BRIDGE_NETFILTER is not set. Protect the variable affectations by an ifdef to make sure this doesn't happen. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 43419
This commit is contained in:
parent
6cc4c6a3a1
commit
d73dc14957
@ -96,22 +96,17 @@
|
|||||||
if (vlan_tx_tag_present(skb))
|
if (vlan_tx_tag_present(skb))
|
||||||
--- a/net/bridge/br_private.h
|
--- a/net/bridge/br_private.h
|
||||||
+++ b/net/bridge/br_private.h
|
+++ b/net/bridge/br_private.h
|
||||||
@@ -769,15 +769,29 @@ static inline int br_vlan_enabled(struct
|
@@ -778,6 +778,24 @@ static inline void br_nf_core_fini(void)
|
||||||
|
|
||||||
/* br_netfilter.c */
|
|
||||||
#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
|
|
||||||
+extern int brnf_call_ebtables;
|
|
||||||
int br_nf_core_init(void);
|
|
||||||
void br_nf_core_fini(void);
|
|
||||||
void br_netfilter_rtable_init(struct net_bridge *);
|
|
||||||
+bool br_netfilter_run_hooks(void);
|
|
||||||
#else
|
|
||||||
static inline int br_nf_core_init(void) { return 0; }
|
|
||||||
static inline void br_nf_core_fini(void) {}
|
|
||||||
#define br_netfilter_rtable_init(x)
|
#define br_netfilter_rtable_init(x)
|
||||||
+#define br_netfilter_run_hooks() false
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
+#if IS_BUILTIN(CONFIG_BRIDGE_NETFILTER)
|
||||||
|
+extern int brnf_call_ebtables;
|
||||||
|
+bool br_netfilter_run_hooks(void);
|
||||||
|
+#else
|
||||||
|
+#define br_netfilter_run_hooks() false
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
+static inline int
|
+static inline int
|
||||||
+BR_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
|
+BR_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||||
+ struct net_device *in, struct net_device *out,
|
+ struct net_device *in, struct net_device *out,
|
||||||
@ -139,17 +134,39 @@
|
|||||||
|
|
||||||
--- a/net/bridge/netfilter/ebtables.c
|
--- a/net/bridge/netfilter/ebtables.c
|
||||||
+++ b/net/bridge/netfilter/ebtables.c
|
+++ b/net/bridge/netfilter/ebtables.c
|
||||||
@@ -2414,11 +2414,13 @@ static int __init ebtables_init(void)
|
@@ -2414,11 +2414,19 @@ static int __init ebtables_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "Ebtables v2.0 registered\n");
|
printk(KERN_INFO "Ebtables v2.0 registered\n");
|
||||||
|
+
|
||||||
|
+#if IS_BUILTIN(CONFIG_BRIDGE_NETFILTER)
|
||||||
+ brnf_call_ebtables = 1;
|
+ brnf_call_ebtables = 1;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit ebtables_fini(void)
|
static void __exit ebtables_fini(void)
|
||||||
{
|
{
|
||||||
|
+#if IS_BUILTIN(CONFIG_BRIDGE_NETFILTER)
|
||||||
+ brnf_call_ebtables = 0;
|
+ brnf_call_ebtables = 0;
|
||||||
|
+#endif
|
||||||
nf_unregister_sockopt(&ebt_sockopts);
|
nf_unregister_sockopt(&ebt_sockopts);
|
||||||
xt_unregister_target(&ebt_standard_target);
|
xt_unregister_target(&ebt_standard_target);
|
||||||
printk(KERN_INFO "Ebtables v2.0 unregistered\n");
|
printk(KERN_INFO "Ebtables v2.0 unregistered\n");
|
||||||
|
--- a/net/Kconfig
|
||||||
|
+++ b/net/Kconfig
|
||||||
|
@@ -177,11 +177,11 @@ config NETFILTER_ADVANCED
|
||||||
|
If unsure, say Y.
|
||||||
|
|
||||||
|
config BRIDGE_NETFILTER
|
||||||
|
- tristate "Bridged IP/ARP packets filtering"
|
||||||
|
+ bool "Bridged IP/ARP packets filtering"
|
||||||
|
depends on BRIDGE
|
||||||
|
depends on NETFILTER && INET
|
||||||
|
depends on NETFILTER_ADVANCED
|
||||||
|
- default m
|
||||||
|
+ default y
|
||||||
|
---help---
|
||||||
|
Enabling this option will let arptables resp. iptables see bridged
|
||||||
|
ARP resp. IP traffic. If you want a bridging firewall, you probably
|
||||||
|
Loading…
Reference in New Issue
Block a user