nft_xt_builtin_init(h, table);
+ /* Since ebtables user-defined chain policies are implemented as last
+ * rule in nftables, rule cache is required here to treat them right. */
+ if (h->family == NFPROTO_BRIDGE) {
+ c = nft_chain_find(h, table, chain);
+ if (c && !nft_chain_builtin(c))
+ nft_build_cache(h);
+ }
+
nft_fn = nft_rule_append;
r = nft_rule_new(h, chain, table, data);
struct nftnl_chain *c;
int ret = 0;
+ nft_build_cache(h);
+
list = nft_chain_list_get(h, table);
if (!list)
return 0;
fprintf(stdout, "Deleting chain `%s'\n",
nftnl_chain_get_str(c, NFTNL_CHAIN_NAME));
+ /* This triggers required policy rule deletion. */
+ if (h->family == NFPROTO_BRIDGE)
+ nft_build_cache(h);
+
/* XXX This triggers a fast lookup from the kernel. */
nftnl_chain_unset(c, NFTNL_CHAIN_HANDLE);
ret = batch_chain_add(h, NFT_COMPAT_CHAIN_USER_DEL, c);
struct nftnl_rule_iter *iter;
bool found = false;
+ nft_build_cache(h);
+
if (rulenum >= 0)
/* Delete by rule number case */
return nftnl_rule_lookup_byindex(c, rulenum);
else
return 0;
+ nft_build_cache(h);
+
nftnl_chain_set_u32(c, NFTNL_CHAIN_POLICY, pval);
return 1;
}
enum nf_inet_hooks hook;
int prio;
+ nft_build_cache(h);
+
if (nftnl_rule_foreach(c, nft_is_rule_compatible, NULL))
return -1;