Nick Garlis
|
3efc75f481
|
Add GetGen method to retrieve current generation ID (#325)
Add GetGen method to retrieve current generation ID
nftables uses generation IDs (gen IDs) for optimistic concurrency
control. This commit adds a GetGen method to expose current gen ID so
that users can retrieve it explicitly.
Typical usage:
1. Call GetGen to retrieve current gen ID.
2. Read the the current state.
3. Send the batch along with the gen ID by calling Flush.
If the state changes before the flush, the kernel will reject the
batch, preventing stale writes.
- https://wiki.nftables.org/wiki-nftables/index.php/Portal:DeveloperDocs/nftables_internals#Batched_handlers
- https://docs.kernel.org/networking/netlink_spec/nftables.html#getgen
- 3957a57201/net/netfilter/nfnetlink.c (L424)
|
2025-09-02 14:05:05 +02:00 |