From fd34e936455ab927cefd198e419615dc3bd1d5bc Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Sat, 3 Oct 2026 19:59:59 -0400 Subject: [PATCH] ssh-issue: never suggest connecting with VMADDR_CID_ANY Even if the vsock driver allows using this as a wildcard to listen over vsock, it still cannot be used as a destination CID from the host (and is rejected by systemd-ssh-proxy). Show a more generic message in this case instead. Use VSOCK_CID_IS_REGULAR() to exclude other similar cases too. Follow-up for 85afe8e82d8be44d2dafb2b7cfd243954d346c5a. Fixes: https://github.com/systemd/systemd/issues/43364 (cherry picked from commit affcccd4d07180b82d918c0c5f0601d1dec80946) --- src/ssh-generator/ssh-issue.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ssh-generator/ssh-issue.c b/src/ssh-generator/ssh-issue.c index 178fdef341..889f8836d9 100644 --- a/src/ssh-generator/ssh-issue.c +++ b/src/ssh-generator/ssh-issue.c @@ -13,6 +13,7 @@ #include "main-func.h" #include "mkdir.h" #include "parse-argument.h" +#include "socket-util.h" #include "ssh-util.h" #include "string-util.h" #include "strv.h" @@ -84,9 +85,15 @@ static int verb_make_vsock(int argc, char *argv[], uintptr_t _data, void *_userd } else out = stdout; - fprintf(out, - "Try contacting this VM's SSH server via 'ssh vsock%%%u' from host.\n" - "\n", cid); + if (VSOCK_CID_IS_REGULAR(cid)) + fprintf(out, + "Try contacting this VM's SSH server via 'ssh vsock%%%u' from host.\n" + "\n", cid); + else + /* Even when hwdb reports VSOCK_ACCEPT_VMADDR_CID_ANY=1, do not print + * VMADDR_CID_ANY in the output. It will be rejected by systemd-ssh-proxy, + * because it is still not a valid destination CID. */ + fputs("This VM's SSH server is available over AF_VSOCK.\n\n", out); if (f) { if (fchmod(fileno(f), 0644) < 0)