Release the routing reference when the route manager shuts down

This commit is contained in:
Viktor Liu
2026-08-21 11:02:40 +02:00
parent f0905d89f6
commit dd54240f42
3 changed files with 82 additions and 0 deletions

View File

@@ -420,6 +420,14 @@ func TestIptablesCloseRemovesAllState(t *testing.T) {
require.NoError(t, err)
require.NoError(t, manager.Init(nil))
// A failed assertion below returns before the Close under test, which would
// leave this test's chains and sets in the kernel for the next one.
t.Cleanup(func() {
if err := manager.Close(nil); err != nil {
t.Logf("close after failure: %v", err)
}
})
sources := []netip.Prefix{
netip.MustParsePrefix("10.20.0.42/32"),
netip.MustParsePrefix("10.20.0.43/32"),