summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-05-19 18:35:02 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-05-19 18:56:25 +0200
commit1351b11102b5f20e521c83e6d9f1753bfa543409 (patch)
tree242c3d1d0d7b89deb8845c07004d7ca1cb172367
parentf316ad1aa6b0a17ca6961f44f95fc31d0159bc36 (diff)
nft: add __nft_table_builtin_find()
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--iptables/nft.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index 6c6cd787..b0a15e9b 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -688,25 +688,31 @@ static void nft_chain_builtin_add(struct nft_handle *h,
nftnl_chain_list_add_tail(c, h->cache->table[table->type].chains);
}
-/* find if built-in table already exists */
-const struct builtin_table *
-nft_table_builtin_find(struct nft_handle *h, const char *table)
+static const struct builtin_table *
+__nft_table_builtin_find(const struct builtin_table *tables, const char *table)
{
int i;
bool found = false;
for (i = 0; i < NFT_TABLE_MAX; i++) {
- if (h->tables[i].name == NULL)
+ if (tables[i].name == NULL)
continue;
- if (strcmp(h->tables[i].name, table) != 0)
+ if (strcmp(tables[i].name, table) != 0)
continue;
found = true;
break;
}
- return found ? &h->tables[i] : NULL;
+ return found ? &tables[i] : NULL;
+}
+
+/* find if built-in table already exists */
+const struct builtin_table *
+nft_table_builtin_find(struct nft_handle *h, const char *table)
+{
+ return __nft_table_builtin_find(h->tables, table);
}
/* find if built-in chain already exists */