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 <[email protected]>
1f31269 to
8a5a815
Compare
|
@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.