Commit Graph

6 Commits

Author SHA1 Message Date
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
patryk4815 eb34035740
Fix incorrect size check in NFGenMsg (#287)
Fix incorrect size check in NFGenMsg, resolving TableFamily issue for rules in monitor
2024-12-13 07:30:25 +01:00
_|+ 51c44dcf05
Implement AddGenerationalMonitor to deliver monitor events in batches (#283) 2024-11-09 12:07:36 +01:00
turekt 4d451ef75f
Fix staticcheck issues (#266) 2024-08-11 10:00:48 +02:00
Michael Stapelberg 6d4c531bb6 monitor: add example and documentation 2023-12-13 08:31:13 +01:00
singchia 5555df300c
feat: add monitor on table chain rule set setelem and obj events (#250)
fixes https://github.com/google/nftables/issues/224
2023-12-13 08:23:07 +01:00