return batch_add(h, type, r);
}
-struct builtin_table xtables_ipv4[TABLES_MAX] = {
- [RAW] = {
+struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
+ [NFT_TABLE_RAW] = {
.name = "raw",
.chains = {
{
},
},
},
- [MANGLE] = {
+ [NFT_TABLE_MANGLE] = {
.name = "mangle",
.chains = {
{
},
},
},
- [FILTER] = {
+ [NFT_TABLE_FILTER] = {
.name = "filter",
.chains = {
{
},
},
},
- [SECURITY] = {
+ [NFT_TABLE_SECURITY] = {
.name = "security",
.chains = {
{
},
},
},
- [NAT] = {
+ [NFT_TABLE_NAT] = {
.name = "nat",
.chains = {
{
#include <linux/netfilter_arp.h>
-struct builtin_table xtables_arp[TABLES_MAX] = {
- [FILTER] = {
+struct builtin_table xtables_arp[NFT_TABLE_MAX] = {
+ [NFT_TABLE_FILTER] = {
.name = "filter",
.chains = {
{
#include <linux/netfilter_bridge.h>
-struct builtin_table xtables_bridge[TABLES_MAX] = {
- [FILTER] = {
+struct builtin_table xtables_bridge[NFT_TABLE_MAX] = {
+ [NFT_TABLE_FILTER] = {
.name = "filter",
.chains = {
{
},
},
},
- [NAT] = {
+ [NFT_TABLE_NAT] = {
.name = "nat",
.chains = {
{
int i;
bool found = false;
- for (i=0; i<TABLES_MAX; i++) {
+ for (i = 0; i < NFT_TABLE_MAX; i++) {
if (h->tables[i].name == NULL)
continue;
prio = nftnl_chain_get_u32(chain, NFTNL_CHAIN_PRIO);
hook = nftnl_chain_get_u32(chain, NFTNL_CHAIN_HOOKNUM);
- for (i = 0; i < TABLES_MAX; i++) {
+ for (i = 0; i < NFT_TABLE_MAX; i++) {
cur_table = h->tables[i].name;
chains = h->tables[i].chains;
#include "nft-shared.h"
#include <libiptc/linux_list.h>
-#define FILTER 0
-#define MANGLE 1
-#define RAW 2
-#define SECURITY 3
-#define NAT 4
-#define TABLES_MAX 5
+enum nft_table_type {
+ NFT_TABLE_FILTER = 0,
+ NFT_TABLE_MANGLE,
+ NFT_TABLE_RAW,
+ NFT_TABLE_SECURITY,
+ NFT_TABLE_NAT,
+};
+#define NFT_TABLE_MAX (NFT_TABLE_NAT + 1)
struct builtin_chain {
const char *name;
} error;
};
-extern struct builtin_table xtables_ipv4[TABLES_MAX];
-extern struct builtin_table xtables_arp[TABLES_MAX];
-extern struct builtin_table xtables_bridge[TABLES_MAX];
+extern struct builtin_table xtables_ipv4[NFT_TABLE_MAX];
+extern struct builtin_table xtables_arp[NFT_TABLE_MAX];
+extern struct builtin_table xtables_bridge[NFT_TABLE_MAX];
int mnl_talk(struct nft_handle *h, struct nlmsghdr *nlh,
int (*cb)(const struct nlmsghdr *nlh, void *data),