netfilter: nf_tables: add support to destroy operation
Subsystems (2)
PATCH v4 1/1 netfilter: nf_tables: add support to destroy operation
Introduce NFT_MSG_DESTROY* message type. The destroy operation performs a delete operation but ignoring the ENOENT errors.
This is useful for the transaction semantics, where failing to delete an object which does not exist results in aborting the transaction.
This new command allows the transaction to proceed in case the object does not exist.
Signed-off-by Fernando Fernandez Mancera <[email protected]>
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v1: initial patch
v2: fix bug on rule destroy without handle
v3: adjust some lines length
v4: apply Pablo's changes and update the _notify() to report the destroy events to userspace.
--- include/uapi/linux/netfilter/nf_tables.h | 14 ++++ net/netfilter/nf_tables_api.c | 95 ++++++++++++++++++++++++ 2 files changed, 109 insertions(+)
include/uapi/linux/netfilter/nf_tables.h +14 -0
@@ -98,6 +98,13 @@ enum nft_verdicts {* @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) * @NFT_MSG_GETRULE_RESET: get rules and reset stateful expressions (enum nft_obj_attributes) +* @NFT_MSG_DESTROYTABLE: destroy a table (enum nft_table_attributes) +* @NFT_MSG_DESTROYCHAIN: destroy a chain (enum nft_chain_attributes) +* @NFT_MSG_DESTROYRULE: destroy a rule (enum nft_rule_attributes) +* @NFT_MSG_DESTROYSET: destroy a set (enum nft_set_attributes) +* @NFT_MSG_DESTROYSETELEM: destroy a set element (enum nft_set_elem_attributes) +* @NFT_MSG_DESTROYOBJ: destroy a stateful object (enum nft_object_attributes) +* @NFT_MSG_DESTROYFLOWTABLE: destroy flow table (enum nft_flowtable_attributes) */ enum nf_tables_msg_types {NFT_MSG_NEWTABLE ,
@@ -126,6 +133,13 @@ enum nf_tables_msg_types {NFT_MSG_GETFLOWTABLE ,NFT_MSG_DELFLOWTABLE ,NFT_MSG_GETRULE_RESET , +NFT_MSG_DESTROYTABLE , +NFT_MSG_DESTROYCHAIN , +NFT_MSG_DESTROYRULE , +NFT_MSG_DESTROYSET , +NFT_MSG_DESTROYSETELEM , +NFT_MSG_DESTROYOBJ , +NFT_MSG_DESTROYFLOWTABLE , NFT_MSG_MAX, };
net/netfilter/nf_tables_api.c +95 -0
298 lines not on this page · raw message
Signature · 1 line
2.30.2