-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipmasq: fix nftables backend #1120
Conversation
Tested with
|
7aff05a
to
6084c3a
Compare
@danwinship if you can review this one |
I don't like keeping the broken function, but I don't know what @squeed will think about removing it, API-compatibility-wise. It's also possible to avoid needing a new function, by including the CIDR in the comment hash so each one will get a different comment. |
needs a unit test that fails with the old code and passes with the new code |
Right now
will do |
OK, Casey says But you should still add a unit test |
1b46fa1
to
1f31269
Compare
@danwinship unit test modified to test the fix (and more exotic setup), we should be good to go |
Rename SetupIPMasqForNetwork -> SetupIPMasqForNetworks TeardownIPMasqForNetwork -> TeardownIPMasqForNetworks and have them take []*net.IPNet instead of *net.IPNet. This allow the nftables backend to cleanup stale rules and recreate all needed rules in a single transaction, where previously the stale rules cleanup was breaking all but the last IPNet. Fixes 61d0786 Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
1f31269
to
8a5a815
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@squeed this one should be ready to merge too |
Rename
SetupIPMasqForNetwork -> SetupIPMasqForNetworks
TeardownIPMasqForNetwork -> TeardownIPMasqForNetworks
and have them take []*net.IPNet instead of *net.IPNet.
This allow the nftables backend to cleanup stale rules and recreate all needed rules in a single transaction, where previously the stale rules cleanup was breaking all but the last IPNet.
Fixes 61d0786
Fixes #1118
Comments for reviewer:
I kept
SetupIPMasqForNetwork
(without thes
) but it's broken for nftables if you call it in loop, so might be better to just break the API and get rid of it, as it was just released in 1.6.0.