From: Pablo Neira Ayuso Date: Sun, 19 May 2019 16:35:02 +0000 (+0200) Subject: nft: add __nft_table_builtin_find() X-Git-Tag: v1.8.3~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1351b11102b5f20e521c83e6d9f1753bfa543409;p=thirdparty%2Fiptables.git nft: add __nft_table_builtin_find() Signed-off-by: Pablo Neira Ayuso --- 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 */