Skip to content

Conversation

@nickgarlis
Copy link
Contributor

Introduce a FindSetElements method to easily query elements in a set. Also refactor GetSetElements into a reusable getSetElements helper, shared across methods performing NFT_MSG_GETSETELEM.

Fixes: #131
Fixes: #315

Copy link
Collaborator

@stapelberg stapelberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall

nftables_test.go Outdated
t.Run(tt.name, func(t *testing.T) {
conn, newNS := nftest.OpenSystemConn(t, *enableSysTests)
defer nftest.CleanupSystemConn(t, newNS)
conn.FlushRuleset()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the flush directly after creating the connection? If it’s required, can you add a comment to explain?

Copy link
Contributor Author

@nickgarlis nickgarlis Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have been deferred. It is actually not needed

Introduce a FindSetElements method to easily query elements in a
set. Also refactor GetSetElements into a reusable getSetElements
helper, shared across methods performing NFT_MSG_GETSETELEM.

Fixes: google#131
Fixes: google#315
@stapelberg stapelberg merged commit 5f4b960 into google:main Nov 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lookup support in a set ? Is there an equivalent method to nft get element ?

2 participants