Fix live restore for IPv6-only and multiple gateway endpoints#49150
Fix live restore for IPv6-only and multiple gateway endpoints#49150robmry merged 5 commits intomoby:masterfrom
Conversation
1f9eeee to
fb0b8b0
Compare
| }) | ||
| assert.Check(t, defFound, "default route %q not found:\n%s", expDefRoute, strings.Join(routes, "\n")) | ||
| if expDefRoute == "" { | ||
| defFound := slices.ContainsFunc(routes, func(s string) bool { |
There was a problem hiding this comment.
Looks like it didn't complain before this, but probably because it's a _test.go - wondering if we should technically have such //go:build tags for these as well
(no need to do in this PR; looks like it was already there)
akerouanton
left a comment
There was a problem hiding this comment.
Just one small nit, otherwise LGTM.
| id: sbs.ID, | ||
| controller: sbs.c, | ||
| containerID: sbs.Cid, | ||
| epPriority: sbs.EpPriority, |
There was a problem hiding this comment.
It seems this method is badly named -- it does more than cleaning up old sandboxes. Maybe we could come up with a more explicit name, or add a comment stating what it's used for? (either in this PR if you have to update it, or in a follow-up)
There was a problem hiding this comment.
I renamed it to sandboxRestore, with comment "sandboxRestore restores Sandbox objects from the store, deleting them if they're not active." ... I think that covers it?
Signed-off-by: Rob Murray <[email protected]>
Signed-off-by: Rob Murray <[email protected]>
Signed-off-by: Rob Murray <[email protected]>
On live-restore, the Sandbox tries to restore state in the osSbox by telling it about interface, routes, and gateways that would have been set up by the previous incarnation of the daemon. Restoring gateways has been broken since commit 1832774 (Allow separate IPv4/IPv6 gateway endpoints.) ... which didn't properly deal with searching for the "dstName" of an interface based on its IPv6 address. This commit fixes that, and splits the osSbox restore into three parts: - Restore the interfaces, including finding the "dstName". - Restore routes, unchanged, they're just a copy of the sandbox's StaticRoutes - Restore gateway info - if the Sandbox's gateway endpoint has an IP address (v4 or v6, depending on which addr family/families it's acting as the gateway for), store that. If not, the default route is bound to the interface, so store that. Signed-off-by: Rob Murray <[email protected]>
Signed-off-by: Rob Murray <[email protected]>
fb0b8b0 to
39c0517
Compare
|
Unrelated failure in CI ... |
- What I did
On live-restore, the Sandbox tries to restore state in the osSbox by telling it about interface, routes, and gateways that would have been set up by the previous incarnation of the daemon.
Restoring gateways has been broken since commit 1832774 (Allow separate IPv4/IPv6 gateway endpoints) ... which didn't properly deal with searching for the "dstName" of an interface based on its IPv6 address.
- How I did it
Split the osSbox restore into three parts:
- How to verify it
Manually ...
Also, repeat test
TestMixL3IPVlanAndBridgewith a live-restore-enabled daemon restart before running the network connects/disconnects - and add an IPv6-only network. Without the fixes in this PR, gateways/default routes could not be removed when an Endpoint leaves the Sandbox, and the IPv6-only network couldn't become a gateway because thedstNameof its interface hadn't been restored correctly.- Description for the changelog