From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 7/9] netfilter: explicit module dependency between br_netfilter and physdev
Date: Fri, 3 Oct 2014 19:20:22 +0200 [thread overview]
Message-ID: <1412356824-6362-8-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1412356824-6362-1-git-send-email-pablo@netfilter.org>
You can use physdev to match the physical interface enslaved to the
bridge device. This information is stored in skb->nf_bridge and it is
set up by br_netfilter. So, this is only available when iptables is
used from the bridge netfilter path.
Since 34666d4 ("netfilter: bridge: move br_netfilter out of the core"),
the br_netfilter code is modular. To reduce the impact of this change,
we can autoload the br_netfilter if the physdev match is used since
we assume that the users need br_netfilter in place.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/net/netfilter/br_netfilter.h | 6 ++++++
net/bridge/br_netfilter.c | 5 +++++
net/netfilter/xt_physdev.c | 3 +++
3 files changed, 14 insertions(+)
create mode 100644 include/net/netfilter/br_netfilter.h
diff --git a/include/net/netfilter/br_netfilter.h b/include/net/netfilter/br_netfilter.h
new file mode 100644
index 0000000..2aa6048
--- /dev/null
+++ b/include/net/netfilter/br_netfilter.h
@@ -0,0 +1,6 @@
+#ifndef _BR_NETFILTER_H_
+#define _BR_NETFILTER_H_
+
+void br_netfilter_enable(void);
+
+#endif /* _BR_NETFILTER_H_ */
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 97e4393..fa1270c 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -856,6 +856,11 @@ static unsigned int ip_sabotage_in(const struct nf_hook_ops *ops,
return NF_ACCEPT;
}
+void br_netfilter_enable(void)
+{
+}
+EXPORT_SYMBOL_GPL(br_netfilter_enable);
+
/* For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because
* br_dev_queue_push_xmit is called afterwards */
static struct nf_hook_ops br_nf_ops[] __read_mostly = {
diff --git a/net/netfilter/xt_physdev.c b/net/netfilter/xt_physdev.c
index d7ca16b..f440f57 100644
--- a/net/netfilter/xt_physdev.c
+++ b/net/netfilter/xt_physdev.c
@@ -13,6 +13,7 @@
#include <linux/netfilter_bridge.h>
#include <linux/netfilter/xt_physdev.h>
#include <linux/netfilter/x_tables.h>
+#include <net/netfilter/br_netfilter.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");
@@ -87,6 +88,8 @@ static int physdev_mt_check(const struct xt_mtchk_param *par)
{
const struct xt_physdev_info *info = par->matchinfo;
+ br_netfilter_enable();
+
if (!(info->bitmask & XT_PHYSDEV_OP_MASK) ||
info->bitmask & ~XT_PHYSDEV_OP_MASK)
return -EINVAL;
--
1.7.10.4
next prev parent reply other threads:[~2014-10-03 17:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-03 17:20 [PATCH 0/9] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2014-10-03 17:20 ` [PATCH 1/9] netfilter: nft_reject: introduce icmp code abstraction for inet and bridge Pablo Neira Ayuso
2014-10-03 17:20 ` [PATCH 2/9] netfilter: move nf_send_resetX() code to nf_reject_ipvX modules Pablo Neira Ayuso
2014-10-07 14:45 ` Eric Dumazet
2014-10-03 17:20 ` [PATCH 3/9] netfilter: use IS_ENABLED(CONFIG_BRIDGE_NETFILTER) Pablo Neira Ayuso
2014-10-03 17:20 ` [PATCH 4/9] netfilter: nf_tables: wait for call_rcu completion on module removal Pablo Neira Ayuso
2014-10-03 17:20 ` [PATCH 5/9] netfilter: nft_compat: remove incomplete 32/64 bits arch compat code Pablo Neira Ayuso
2014-10-03 17:20 ` [PATCH 6/9] netfilter: nf_tables: allow to filter from prerouting and postrouting Pablo Neira Ayuso
2014-10-03 17:20 ` Pablo Neira Ayuso [this message]
2014-10-03 17:20 ` [PATCH 8/9] ipvs: Clean up comment style in ip_vs.h Pablo Neira Ayuso
2014-10-03 17:20 ` [PATCH 9/9] netfilter: nft_masq: register/unregister notifiers on module init/exit Pablo Neira Ayuso
2014-10-06 1:33 ` [PATCH 0/9] Netfilter/IPVS updates for net-next David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412356824-6362-8-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).