Linux Netfilter development
 help / color / mirror / Atom feed
* [PATCH nf 1/3] netfilter: nf_tables: reject destroy command to remove basechain hooks
@ 2024-03-21  0:28 Pablo Neira Ayuso
  2024-03-21  0:28 ` [PATCH nf 2/3] netfilter: nf_tables: reject table flag and netdev basechain updates Pablo Neira Ayuso
  2024-03-21  0:28 ` [PATCH nf 3/3] netfilter: nf_tables: skip netdev hook unregistration if table is dormant Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2024-03-21  0:28 UTC (permalink / raw)
  To: netfilter-devel

Report EOPNOTSUPP if NFT_MSG_DESTROYCHAIN is used to delete hooks in an
existing netdev basechain, thus, only NFT_MSG_DELCHAIN is allowed.

Fixes: 7d937b107108f ("netfilter: nf_tables: support for deleting devices in an existing netdev chain")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 5fa3d3540c93..a1a8030e16a5 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2944,7 +2944,8 @@ static int nf_tables_delchain(struct sk_buff *skb, const struct nfnl_info *info,
 	nft_ctx_init(&ctx, net, skb, info->nlh, family, table, chain, nla);
 
 	if (nla[NFTA_CHAIN_HOOK]) {
-		if (chain->flags & NFT_CHAIN_HW_OFFLOAD)
+		if (NFNL_MSG_TYPE(info->nlh->nlmsg_type) == NFT_MSG_DESTROYCHAIN ||
+		    chain->flags & NFT_CHAIN_HW_OFFLOAD)
 			return -EOPNOTSUPP;
 
 		if (nft_is_base_chain(chain)) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-21  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21  0:28 [PATCH nf 1/3] netfilter: nf_tables: reject destroy command to remove basechain hooks Pablo Neira Ayuso
2024-03-21  0:28 ` [PATCH nf 2/3] netfilter: nf_tables: reject table flag and netdev basechain updates Pablo Neira Ayuso
2024-03-21  0:28 ` [PATCH nf 3/3] netfilter: nf_tables: skip netdev hook unregistration if table is dormant Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox