]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: cache: Drop duplicate chain check
authorPhil Sutter <phil@nwl.cc>
Fri, 10 Jul 2020 19:53:08 +0000 (21:53 +0200)
committerPhil Sutter <phil@nwl.cc>
Fri, 24 Jul 2020 17:16:00 +0000 (19:16 +0200)
When fetching chains from kernel, checking for duplicate chain names is
not needed: Nftables doesn't support them in the first place. This is
merely a leftover from when multiple cache fetches could happen and so a
bit of sanity checking was in order.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/nft-cache.c

index 638b18bc7e3824ad49dc14e194501f56ce6044e1..059f0a7f7891e850518ac939123ea54ad8167d9a 100644 (file)
@@ -180,8 +180,8 @@ static int nftnl_chain_list_cb(const struct nlmsghdr *nlh, void *data)
        const struct builtin_table *t = d->t;
        struct nftnl_chain_list *list;
        struct nft_handle *h = d->h;
-       const char *tname, *cname;
        struct nftnl_chain *c;
+       const char *tname;
 
        c = nftnl_chain_alloc();
        if (c == NULL)
@@ -201,11 +201,6 @@ static int nftnl_chain_list_cb(const struct nlmsghdr *nlh, void *data)
        }
 
        list = h->cache->table[t->type].chains;
-       cname = nftnl_chain_get_str(c, NFTNL_CHAIN_NAME);
-
-       if (nftnl_chain_list_lookup_byname(list, cname))
-               goto out;
-
        nftnl_chain_list_add_tail(c, list);
 
        return MNL_CB_OK;