aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2014-11-28 01:29:51 +0000
committerFlorian Fainelli <florian@openwrt.org>2014-11-28 01:29:51 +0000
commitd73dc14957000f34310b4980d95f76c60a61bee6 (patch)
treeb629c60ba0ef51b116d31b9b47a6dbca4a64e31c /target/linux
parent6cc4c6a3a1921ee589516094f41970f5b0d417a7 (diff)
downloadupstream-d73dc14957000f34310b4980d95f76c60a61bee6.tar.gz
upstream-d73dc14957000f34310b4980d95f76c60a61bee6.tar.bz2
upstream-d73dc14957000f34310b4980d95f76c60a61bee6.zip
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
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/patches-3.18/644-bridge_optimize_netfilter_hooks.patch43
1 files changed, 30 insertions, 13 deletions
diff --git a/target/linux/generic/patches-3.18/644-bridge_optimize_netfilter_hooks.patch b/target/linux/generic/patches-3.18/644-bridge_optimize_netfilter_hooks.patch
index c876c2bce0..4df94ca9d8 100644
--- a/target/linux/generic/patches-3.18/644-bridge_optimize_netfilter_hooks.patch
+++ b/target/linux/generic/patches-3.18/644-bridge_optimize_netfilter_hooks.patch
@@ -96,22 +96,17 @@
if (vlan_tx_tag_present(skb))
--- a/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)
+ #define br_netfilter_rtable_init(x)
+ #endif
- /* br_netfilter.c */
- #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
++#if IS_BUILTIN(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)
++#else
+#define br_netfilter_run_hooks() false
- #endif
-
++#endif
++
+static inline int
+BR_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
+ struct net_device *in, struct net_device *out,
@@ -139,17 +134,39 @@
--- a/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");
++
++#if IS_BUILTIN(CONFIG_BRIDGE_NETFILTER)
+ brnf_call_ebtables = 1;
++#endif
++
return 0;
}
static void __exit ebtables_fini(void)
{
++#if IS_BUILTIN(CONFIG_BRIDGE_NETFILTER)
+ brnf_call_ebtables = 0;
++#endif
nf_unregister_sockopt(&ebt_sockopts);
xt_unregister_target(&ebt_standard_target);
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