summaryrefslogtreecommitdiffstats
path: root/iptables/nft.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-02-11 16:16:50 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2015-02-11 16:19:24 +0100
commit87f82cbd4f94cca74eb58506e117f226a2270759 (patch)
treec49b2f0ba1b80c0953c41f6c865cab92e30038eb /iptables/nft.c
parentaa562a660d1555b13cffbac1e744033e91f82707 (diff)
parent24775a7a3178c163302560d2bd74ecc6ed0f7af4 (diff)
Merge branch 'ebtables-compat'
The ebtables-compat branch provides the compatibility layer to run ebtables extensions. Currently, only the following matches / targets / watchers are supported: * 802_3 * ip * mark_m and mark * log The remaining ones should be easy to port them to on top of libxtables, they will follow up later.
Diffstat (limited to 'iptables/nft.c')
-rw-r--r--iptables/nft.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index 568faa19..7cd56efa 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -469,6 +469,57 @@ struct builtin_table xtables_arp[TABLES_MAX] = {
},
};
+#include <linux/netfilter_bridge.h>
+
+struct builtin_table xtables_bridge[TABLES_MAX] = {
+ [FILTER] = {
+ .name = "filter",
+ .chains = {
+ {
+ .name = "INPUT",
+ .type = "filter",
+ .prio = NF_BR_PRI_FILTER_BRIDGED,
+ .hook = NF_BR_LOCAL_IN,
+ },
+ {
+ .name = "FORWARD",
+ .type = "filter",
+ .prio = NF_BR_PRI_FILTER_BRIDGED,
+ .hook = NF_BR_FORWARD,
+ },
+ {
+ .name = "OUTPUT",
+ .type = "filter",
+ .prio = NF_BR_PRI_FILTER_BRIDGED,
+ .hook = NF_BR_LOCAL_OUT,
+ },
+ },
+ },
+ [NAT] = {
+ .name = "nat",
+ .chains = {
+ {
+ .name = "PREROUTING",
+ .type = "filter",
+ .prio = NF_BR_PRI_NAT_DST_BRIDGED,
+ .hook = NF_BR_PRE_ROUTING,
+ },
+ {
+ .name = "OUTPUT",
+ .type = "filter",
+ .prio = NF_BR_PRI_NAT_DST_OTHER,
+ .hook = NF_BR_LOCAL_OUT,
+ },
+ {
+ .name = "POSTROUTING",
+ .type = "filter",
+ .prio = NF_BR_PRI_NAT_SRC,
+ .hook = NF_BR_POST_ROUTING,
+ },
+ },
+ },
+};
+
int nft_table_add(struct nft_handle *h, struct nft_table *t, uint16_t flags)
{
char buf[MNL_SOCKET_BUFFER_SIZE];
@@ -587,7 +638,7 @@ nft_table_builtin_find(struct nft_handle *h, const char *table)
for (i=0; i<TABLES_MAX; i++) {
if (h->tables[i].name == NULL)
- break;
+ continue;
if (strcmp(h->tables[i].name, table) != 0)
continue;
@@ -1968,6 +2019,9 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table,
if (iter == NULL)
goto err;
+ if (ops->print_table_header)
+ ops->print_table_header(table);
+
c = nft_chain_list_iter_next(iter);
while (c != NULL) {
const char *chain_table =