netfilter: bridge: rename br_netfilter.c to br_netfilter_hooks.c
Subsystems (3)
Pablo Neira Ayuso
maintainerPATCH 1/2 netfilter: bridge: rename br_netfilter.c to br_netfilter_hooks.c
To prepare separation of the IPv6 code into different file.
---
net/bridge/Makefile | 1 +
net/bridge/{br_netfilter.c => br_netfilter_hooks.c} | 0
2 files changed, 1 insertion(+)
rename net/bridge/{br_netfilter.c => br_netfilter_hooks.c} (100%)net/bridge/Makefile +1 -0
@@ -12,6 +12,7 @@ bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o bridge-$(subst m,y,$(CONFIG_BRIDGE_NETFILTER)) += br_nf_core.o +br_netfilter-y := br_netfilter_hooks.o obj-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o bridge-$(CONFIG_BRIDGE_IGMP_SNOOPING) += br_multicast.o br_mdb.o
net/bridge/br_netfilter_hooks.c renamed from net/bridge/br_netfilter.c +0 -0
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 2/2 netfilter: bridge: split ipv6 code out of the core
Reduce ifdef pollution by moving the IPv6 code into a separated br_netfilter_ipv6.c file that is compiled if CONFIG_IPV6 is set.
---
@Bernhard: Could you please test this to check if it solves kbuild robot problems with CONFIG_IPV6 n, y and m? It would be also good to test this in your testbed too to make sure IPv6 things didn't break. Thanks.
I think it should be possible to refactor this a little bit more so other remaining IPv6 code specific can go into the file.
include/net/netfilter/br_netfilter.h | 59 ++++++++ net/bridge/Makefile | 1 + net/bridge/br_netfilter_hooks.c | 248 ++-------------------------------- net/bridge/br_netfilter_ipv6.c | 245 +++++++++++++++++++++++++++++++++ 4 files changed, 314 insertions(+), 239 deletions(-) create mode 100644 net/bridge/br_netfilter_ipv6.c
include/net/netfilter/br_netfilter.h +59 -0
@@ -1,6 +1,65 @@#ifndef _BR_NETFILTER_H_#define _BR_NETFILTER_H_ +#include "../../../net/bridge/br_private.h" + +static inline struct nf_bridge_info *nf_bridge_alloc (struct sk_buff *skb) +{ + skb->nf_bridge =kzalloc (sizeof (struct nf_bridge_info ),GFP_ATOMIC ); + +if (likely (skb->nf_bridge)) +atomic_set (&(skb->nf_bridge->use),1 ); + +return skb->nf_bridge; +} + +void nf_bridge_update_protocol (struct sk_buff *skb); + +static struct nf_bridge_info *nf_bridge_info_get (const struct sk_buff *skb) +{ +return skb->nf_bridge; +} + +unsigned int nf_bridge_encap_header_len (const struct sk_buff *skb); + +static inline void nf_bridge_push_encap_header (struct sk_buff *skb) +{ +unsigned int len =nf_bridge_encap_header_len (skb); + +skb_push (skb, len); + skb->network_header -= len; +} + +int br_nf_pre_routing_finish_bridge (struct sock *sk,struct sk_buff *skb); + +static inline struct rtable *bridge_parent_rtable (const struct net_device *dev) +{ +struct net_bridge_port *port; + + port =br_port_get_rcu (dev); +return port ? &port->br->fake_rtable :NULL ; +} + +struct net_device *setup_pre_routing (struct sk_buff *skb);void br_netfilter_enable (void ); +#if IS_ENABLED (CONFIG_IPV6 ) +int br_validate_ipv6 (struct sk_buff *skb); +unsigned int br_nf_pre_routing_ipv6 (const struct nf_hook_ops *ops, +struct sk_buff *skb, +const struct nf_hook_state *state); +#else +static inline int br_validate_ipv6 (struct sk_buff *skb) +{ +return -1 ; +} + +static inline unsigned int +br_nf_pre_routing_ipv6 (const struct nf_hook_ops *ops,struct sk_buff *skb, +const struct nf_hook_state *state) +{ +return NF_DROP ; +} +#endif +#endif /* _BR_NETFILTER_H_ */
net/bridge/Makefile +1 -0
@@ -13,6 +13,7 @@ bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o bridge-$(subst m,y,$(CONFIG_BRIDGE_NETFILTER)) += br_nf_core.o br_netfilter-y := br_netfilter_hooks.o +br_netfilter-$(subst m,y,$(CONFIG_IPV6)) += br_netfilter_ipv6.o obj-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o bridge-$(CONFIG_BRIDGE_IGMP_SNOOPING) += br_multicast.o br_mdb.o
net/bridge/br_netfilter_hooks.c +9 -239
315 lines not on this page · raw message
net/bridge/br_netfilter_ipv6.c new file +245 -0
245 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerRe: [PATCH nf-next 2/2] netfilter: bridge: split ipv6 code out of the core
Quoted 2 lines · Pablo Neira Ayuso
Reduce ifdef pollution by moving the IPv6 code into a separated
br_netfilter_ipv6.cfile that is compiled ifCONFIG_IPV6is set.
This patch description is wrong btw, if you confirm this is OK, I'll replace it by
"Resolve compilation breakage when CONFIG_IPV6 is not set by moving the IPv6 code into a separated br_netfilter_ipv6.c file."
Quoted 10 lines
Fixes efb6de9b4ba0 ("netfilter: bridge: forward IPv6 fragmented packets")Reported-by kbuild test robot <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>---
@Bernhard: Could you please test this to check if it solves kbuild robot problems withCONFIG_IPV6n, y and m? It would be also good to test this in your testbed too to make sure IPv6 things didn't break. Thanks.I think it should be possible to refactor this a little bit more so other remaining IPv6 code specific can go into the file.