summaryrefslogtreecommitdiffstats
path: root/iptables/nft-cache.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-09-17 16:51:33 +0200
committerPhil Sutter <phil@nwl.cc>2021-09-27 13:29:45 +0200
commite865a853d7afcff4b2d4279ef843cd13fa6defa1 (patch)
tree33ea6d71d70fa2d8b4b14698682ff4bd25ef5824 /iptables/nft-cache.c
parentf9b33967f2b4b58160c0a970da77d5e44406803a (diff)
nft-chain: Introduce base_slot field
For builtin chains, record the base_chains array slot they are assigned to. This simplifies removing that reference if they are being deleted later. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-cache.c')
-rw-r--r--iptables/nft-cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c
index b7f10ab9..43ac291e 100644
--- a/iptables/nft-cache.c
+++ b/iptables/nft-cache.c
@@ -226,10 +226,11 @@ nft_cache_add_base_chain(struct nft_handle *h, const struct builtin_table *t,
strcmp(type, bc->type))
return -EINVAL;
- if (h->cache->table[t->type].base_chains[hooknum])
+ nc->base_slot = &h->cache->table[t->type].base_chains[hooknum];
+ if (*nc->base_slot)
return -EEXIST;
- h->cache->table[t->type].base_chains[hooknum] = nc;
+ *nc->base_slot = nc;
return 0;
}