diff options
author | Phil Sutter <phil@nwl.cc> | 2020-08-04 17:02:21 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2020-08-21 19:01:04 +0200 |
commit | f75750ff9d5c49808812c41081cd2a3700878941 (patch) | |
tree | cc2eb4349d90e86daf83a0fad3d38073a2cef79f /iptables | |
parent | c330a2198e86d757e1d553f7e1d64baa2f10d7a9 (diff) |
nft: Use nft_chain_find() in nft_chain_builtin_init()
The replaced code is basically identical to nft_chain_find()'s body.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables')
-rw-r--r-- | iptables/nft.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/iptables/nft.c b/iptables/nft.c index dd66b98e..27bb98d1 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -736,22 +736,17 @@ nft_chain_builtin_find(const struct builtin_table *t, const char *chain) return found ? &t->chains[i] : NULL; } +static struct nftnl_chain * +nft_chain_find(struct nft_handle *h, const char *table, const char *chain); + static void nft_chain_builtin_init(struct nft_handle *h, const struct builtin_table *table) { - struct nftnl_chain_list *list; - struct nftnl_chain *c; int i; /* Initialize built-in chains if they don't exist yet */ for (i=0; i < NF_INET_NUMHOOKS && table->chains[i].name != NULL; i++) { - list = nft_chain_list_get(h, table->name, - table->chains[i].name); - if (!list) - continue; - - c = nftnl_chain_list_lookup_byname(list, table->chains[i].name); - if (c != NULL) + if (nft_chain_find(h, table->name, table->chains[i].name)) continue; nft_chain_builtin_add(h, table, &table->chains[i]); @@ -1388,9 +1383,6 @@ err: return NULL; } -static struct nftnl_chain * -nft_chain_find(struct nft_handle *h, const char *table, const char *chain); - int nft_rule_append(struct nft_handle *h, const char *chain, const char *table, struct nftnl_rule *r, struct nftnl_rule *ref, bool verbose) |