[PATCH v2 0/3] Further migration fixes
Here is some more work on the migration stuff. Two of these are fixes, alas, for the already merged "safe" patches. Then there's some extra debugging. David Gibson (3): migrate: Fix several errors with passt-repair migrate, tcp: Report more error conditions during connection repair tcp: Simplify handling of getsockname() .gitignore | 1 + Makefile | 2 +- passt-repair.c | 2 +- tcp.c | 35 ++++++++++++++++------------------- 4 files changed, 19 insertions(+), 21 deletions(-) -- 2.48.1
The passt-repair helper is now merged, but alas it contains several small
bugs:
* close() is not in the seccomp profile, meaning it will immediately
SIGSYS when you make a request of it
* The generated header, seccomp_repair.h isn't listed in .gitignore or
removed by "make clean"
Fixes: 8c24301462c3 ("Introduce passt-repair")
Signed-off-by: David Gibson
On Tue, 4 Feb 2025 16:42:13 +1100
David Gibson
The passt-repair helper is now merged, but alas it contains several small bugs: * close() is not in the seccomp profile, meaning it will immediately SIGSYS when you make a request of it * The generated header, seccomp_repair.h isn't listed in .gitignore or removed by "make clean"
Fixes: 8c24301462c3 ("Introduce passt-repair")
Signed-off-by: David Gibson
Applied. -- Stefano
This should help debugging problems with migration.
[This is a candidate to be folded into the earlier patch]
Signed-off-by: David Gibson
For migration we need to get the specific local address and port for
connected sockets with getsockname(). We currently open code marshalling
the results into the flow entry.
However, we already have inany_from_sockaddr() which handles the fiddly
parts of this, so use it. Also report failures, which may make debugging
problems easier.
Signed-off-by: David Gibson
On Tue, 4 Feb 2025 16:42:15 +1100
David Gibson
For migration we need to get the specific local address and port for connected sockets with getsockname(). We currently open code marshalling the results into the flow entry.
However, we already have inany_from_sockaddr() which handles the fiddly parts of this, so use it. Also report failures, which may make debugging problems easier.
Signed-off-by: David Gibson
--- tcp.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/tcp.c b/tcp.c index 7ce0f4cb..dbdaa9d9 100644 --- a/tcp.c +++ b/tcp.c @@ -1712,24 +1712,14 @@ static void tcp_conn_from_tap(const struct ctx *c, sa_family_t af, tcp_epoll_ctl(c, conn);
if (c->mode == MODE_VU) { /* To rebind to same oport after migration */ - if (af == AF_INET) { - struct sockaddr_in s_in; - - sl = sizeof(s_in); - if (!getsockname(s, (struct sockaddr *)&s_in, &sl)) { - /* NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) */ - tgt->oport = ntohs(s_in.sin_port); - tgt->oaddr = inany_from_v4(s_in.sin_addr); - } - } else { - struct sockaddr_in6 s_in6; + union sockaddr_inany sa; + socklen_t sl = sizeof(sa);
This shadows the previous declaration of 'sl'. Turning into an assignment.
- sl = sizeof(s_in6); - if (!getsockname(s, (struct sockaddr *)&s_in6, &sl)) { - /* NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) */ - tgt->oport = ntohs(s_in6.sin6_port); - tgt->oaddr.a6 = s_in6.sin6_addr; - } + if (!getsockname(s, &sa.sa, &sl)) { + inany_from_sockaddr(&tgt->oaddr, &tgt->oport, &sa); + } else { + err("Failed to get local address for socket: %s", + strerror_(errno)); } }
-- Stefano
On Tue, 4 Feb 2025 16:42:15 +1100
David Gibson
For migration we need to get the specific local address and port for connected sockets with getsockname(). We currently open code marshalling the results into the flow entry.
However, we already have inany_from_sockaddr() which handles the fiddly parts of this, so use it. Also report failures, which may make debugging problems easier.
Signed-off-by: David Gibson
Applied with re-declarations of 'sa' and 'sl' dropped. -- Stefano
participants (2)
-
David Gibson
-
Stefano Brivio