new transaction infrastructure for nf_tables (v3)
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest10 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | netfilter: nf_tables: deconstify table and chain in context structureinclude/ net/ | +32 | 0 replies | |
| 2/10 | netfilter: nf_tables: generalise transaction infrastructureinclude/ net/ | +80 | 0 replies | |
| 3/10 | netfilter: nf_tables: relocate commit and abort routines in the source filenet/ | +80 | 0 replies | |
| 4/10 | netfilter: nf_tables: add message type to transactionsinclude/ net/ | +45 | 0 replies | |
| 5/10 | netfilter: nf_tables: use new transaction infrastructure to handle setsinclude/ include/ net/ +1 more | +133 | 0 replies | |
| 6/10 | netfilter: nf_tables: use new transaction infrastructure to handle chaininclude/ net/ | +189 | 0 replies | |
| 7/10 | netfilter: nf_tables: disabling table hooks always succeedsnet/ | +5 | 0 replies | |
| 8/10 | netfilter: nf_tables: pass context to nf_tables_uptablenet/ | +26 | 0 replies | |
| 9/10 | netfilter: nf_tables: use new transaction infrastructure to handle tableinclude/ net/ | +136 | 0 replies | |
| 10/10 | netfilter: nf_tables: use new transaction infrastructure to handle elementsinclude/ net/ | +102 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/10] new transaction infrastructure for nf_tables (v3)
Hi!
This patchset contains updates to the transaction infrastructure and a new batch API to userspace to include table, chain, set and set element in one single batch updates.
This helps to:
* speed up updates since we save many netlink messages between kernel and userspace and this also improves several batch loading error cases.
* leave things in consistent state if we have to abort a batch in the middle of the processing. We don't leave any of the objects in intermediate state if we hit a problem in the middle of the batch handling.
Basically, the idea is to allocate a transaction object (struct nft_trans) which contains the context of the request, the command type and specific information which depends on the transaction command type. These transaction objects are added to the per-netns commit list. The batch and transaction processing is done in two steps:
1) Batch processing, which consists of digesting the batch, updating objects (table, chains, etc.) in the nf_tables database and feeding the commit list with transaction objects. New objects are left in inactive state whenever possible or added to the list in a speculative fashion that we can easily undo. Since the batch processing may fail, we can call the abort procedure to unroll changes and leave things in consistent state, ie. just like they were before we failed to update things.
2) Transaction processing, which consists of activating the objects and deliver netlink events to userspace, also known as the commit routine. The transaction objects are also released in this stage.
The patchset includes userspace changes that allow new versions of nft to operate with the with old and new nf_tables kernels. This means that old nft binaries (ie. 0.099) will not work after this change unless we add some glue code to the kernel. However, I don't find a good reason why someone would be willing to stick to nft-0.099 at this moment, it contains many bugs that we will be resolved in the upcoming version and we also changed some semantic aspects in the upcoming version. If there is someone really willing to stick to nft-0.099 for some reason, I can send patches to add the compatibility code to the kernel.
Changes with v2:
* Generalise the transaction object to allocate variable length private area depending on the object type.
* Include the set element transactions (patch 10/10).
* Fix named set handling.
Pablo Neira Ayuso (10):
netfilter: nf_tables: deconstify table and chain in context structure
netfilter: nf_tables: generalise transaction infrastructure
netfilter: nf_tables: relocate commit and abort routines in the source file
netfilter: nf_tables: add message type to transactions
netfilter: nf_tables: use new transaction infrastructure to handle sets
netfilter: nf_tables: use new transaction infrastructure to handle chain
netfilter: nf_tables: disabling table hooks always succeeds
netfilter: nf_tables: pass context to nf_tables_uptable
netfilter: nf_tables: use new transaction infrastructure to handle table
netfilter: nf_tables: use new transaction infrastructure to handle elements
include/net/netfilter/nf_tables.h | 72 ++- include/uapi/linux/netfilter/nf_tables.h | 6 + net/netfilter/nf_tables_api.c | 941 +++++++++++++++++++++--------- net/netfilter/nft_lookup.c | 10 +- 4 files changed, 756 insertions(+), 273 deletions(-)
Signature · 1 line
1.7.10.4