diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-03-10 05:27:18 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-03-10 10:03:02 -0400 |
commit | 1a4ba64d16a42c1b31d52b671accd7f9103e2626 (patch) | |
tree | f1f61462f14d2017965dae56d82cd05d947cc854 /net/bridge/br_device.c | |
parent | a03a8dbe20eff6d57aae3147577bf84b52aba4e6 (diff) |
netfilter: bridge: use rcu hook to resolve br_netfilter dependency
e5de75b ("netfilter: bridge: move DNAT helper to br_netfilter") results
in the following link problem:
net/bridge/br_device.c:29: undefined reference to `br_nf_prerouting_finish_bridge`
Moreover it creates a hard dependency between br_netfilter and the
bridge core, which is what we've been trying to avoid so far.
Resolve this problem by using a hook structure so we reduce #ifdef
pollution and keep bridge netfilter specific code under br_netfilter.c
which was the original intention.
Reported-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/bridge/br_device.c')
-rw-r--r-- | net/bridge/br_device.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 294cbcc49263..4ff77a16956c 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #define COMMON_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | \ | 25 | #define COMMON_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | \ |
26 | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM) | 26 | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM) |
27 | 27 | ||
28 | const struct nf_br_ops __rcu *nf_br_ops __read_mostly; | ||
29 | EXPORT_SYMBOL_GPL(nf_br_ops); | ||
30 | |||
28 | /* net device transmit always called with BH disabled */ | 31 | /* net device transmit always called with BH disabled */ |
29 | netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | 32 | netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) |
30 | { | 33 | { |
@@ -33,10 +36,12 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
33 | struct net_bridge_fdb_entry *dst; | 36 | struct net_bridge_fdb_entry *dst; |
34 | struct net_bridge_mdb_entry *mdst; | 37 | struct net_bridge_mdb_entry *mdst; |
35 | struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats); | 38 | struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats); |
39 | const struct nf_br_ops *nf_ops; | ||
36 | u16 vid = 0; | 40 | u16 vid = 0; |
37 | 41 | ||
38 | rcu_read_lock(); | 42 | rcu_read_lock(); |
39 | if (br_nf_prerouting_finish_bridge(skb)) { | 43 | nf_ops = rcu_dereference(nf_br_ops); |
44 | if (nf_ops && nf_ops->br_dev_xmit_hook(skb)) { | ||
40 | rcu_read_unlock(); | 45 | rcu_read_unlock(); |
41 | return NETDEV_TX_OK; | 46 | return NETDEV_TX_OK; |
42 | } | 47 | } |