Skip to content

Commit b32ca27

Browse files
committed
netfilter: nf_tables: reject destroy command to remove basechain hooks
Report EOPNOTSUPP if NFT_MSG_DESTROYCHAIN is used to delete hooks in an existing netdev basechain, thus, only NFT_MSG_DELCHAIN is allowed. Fixes: 7d937b1 ("netfilter: nf_tables: support for deleting devices in an existing netdev chain") Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent d24b035 commit b32ca27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2944,7 +2944,8 @@ static int nf_tables_delchain(struct sk_buff *skb, const struct nfnl_info *info,
29442944
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, chain, nla);
29452945

29462946
if (nla[NFTA_CHAIN_HOOK]) {
2947-
if (chain->flags & NFT_CHAIN_HW_OFFLOAD)
2947+
if (NFNL_MSG_TYPE(info->nlh->nlmsg_type) == NFT_MSG_DESTROYCHAIN ||
2948+
chain->flags & NFT_CHAIN_HW_OFFLOAD)
29482949
return -EOPNOTSUPP;
29492950

29502951
if (nft_is_base_chain(chain)) {

0 commit comments

Comments
 (0)