diff options
author | Phil Sutter <phil@nwl.cc> | 2020-09-10 16:19:44 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2020-12-21 18:33:21 +0100 |
commit | 9189d1898f2f6c10689e1147e97f3a382d272e41 (patch) | |
tree | 862531bdeb69e1c65078a3ec955a9e45a107e657 /iptables/nft-cache.c | |
parent | 09af1117340cfd1885eb2f0a7b522f2d85f66185 (diff) |
nft: cache: Move nft_chain_find() over
It is basically just a cache lookup, hence fits better in here.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-cache.c')
-rw-r--r-- | iptables/nft-cache.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c index 109524c3..929fa0fa 100644 --- a/iptables/nft-cache.c +++ b/iptables/nft-cache.c @@ -165,6 +165,20 @@ static int fetch_table_cache(struct nft_handle *h) return 1; } +struct nftnl_chain * +nft_chain_find(struct nft_handle *h, const char *table, const char *chain) +{ + const struct builtin_table *t; + struct nftnl_chain_list *list; + + t = nft_table_builtin_find(h, table); + if (!t) + return NULL; + + list = h->cache->table[t->type].chains; + return list ? nftnl_chain_list_lookup_byname(list, chain) : NULL; +} + int nft_cache_add_chain(struct nft_handle *h, const struct builtin_table *t, struct nftnl_chain *c) { |