Relying on chain's hooknum to know whether the chain is a base one or
not is bogus: having 0 as hooknum is a valid number. Thus setting the
right flag and handling it is the way to go, as parser does already.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
nft_chain_attr_get_u32(nlc, NFT_CHAIN_ATTR_PRIO);
chain->type =
xstrdup(nft_chain_attr_get_str(nlc, NFT_CHAIN_ATTR_TYPE));
+ chain->flags |= CHAIN_F_BASECHAIN;
}
list_add_tail(&chain->list, &ctx->list);
struct rule *rule;
printf("\tchain %s {\n", chain->handle.chain);
- if (chain->hooknum) {
+ if (chain->flags & CHAIN_F_BASECHAIN) {
printf("\t\t type %s hook %s %u;\n", chain->type,
hooknum2str(chain->hooknum), chain->priority);
}