5 Commits

Author SHA1 Message Date
Cory Snider
7d4bb80d87 d/libn/i/nftables: define dynamic maps, sets
Add support for defining nftables maps and sets with size and timeout
specified, which are required values for maps and sets that are updated
from the packet path.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2026-07-02 18:42:45 -04:00
Cory Snider
4845c1f59a d/libn/i/nftables: add comments to elements of maps, sets
Signed-off-by: Cory Snider <csnider@mirantis.com>
2026-07-02 18:40:47 -04:00
Cory Snider
b086f5e226 d/libn/i/nftables: drop unused golden testdata
Delete .golden files that are not referenced by any tests.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2026-07-02 18:40:47 -04:00
Rob Murray
785ae9a0f9 Rework the interface to libnet/internal/nftables
Add nftables.Modifier, to hold a queue of commands that can be applied
using Modifier.Apply. No updates are made to the underlying Table
until Apply is called, errors in the queue if commands are deferred
until Apply.

This has the advantages that:
- less error handling is needed in code that generates update commands
- it's transactional, without needing explicit transactions

Minor disadvantages are that it's slightly more difficult to debug updates,
as it's no longer possible to step through the call making an update to
the Table manipulation in a debugger - and errors in the command, and
errors like trying to update a nonexistent chain/set/vmap, deleting an
object that doesn't exist or creating a duplicate are not reported
until the updates are applied (but, the file/line where the rule was
added is reported).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-28 19:27:19 +01:00
Albin Kerouanton
1d6c7663c4 d/libnet/i/nftables: move golden files into subdir
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-25 10:48:46 +02:00