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 85afe8e82d.

Fixes: https://github.com/systemd/systemd/issues/43364
(cherry picked from commit affcccd4d07180b82d918c0c5f0601d1dec80946)
This commit is contained in:
Nick Rosbrook
2026-10-16 11:36:33 +01:00
committed by Luca Boccassi
parent f844429534
commit fd34e93645
+10 -3
View File
@@ -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)