From: Lennart Poettering Date: Thu, 29 Feb 2024 14:56:24 +0000 (+0100) Subject: ssh-generator: handle gracefully if AF_VSOCK works, but /dev/vsock doesn't X-Git-Tag: v256-rc1~698 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f557129ecba0826f2a2bfe055a21e7e33ccb57b0;p=thirdparty%2Fsystemd.git ssh-generator: handle gracefully if AF_VSOCK works, but /dev/vsock doesn't Apparently this case exists, let's handle it gracefully. Prompted by: https://github.com/systemd/systemd/pull/31544#issuecomment-1971241397 --- diff --git a/src/ssh-generator/ssh-generator.c b/src/ssh-generator/ssh-generator.c index 2c4cf5a16a5..f906b475684 100644 --- a/src/ssh-generator/ssh-generator.c +++ b/src/ssh-generator/ssh-generator.c @@ -207,8 +207,14 @@ static int add_vsock_socket( /* Determine the local CID so that we can log it to help users to connect to this VM */ unsigned local_cid; r = vsock_get_local_cid(&local_cid); - if (r < 0) + if (r < 0) { + if (ERRNO_IS_DEVICE_ABSENT(r)) { + log_debug("Not creating AF_VSOCK ssh listener, since /dev/vsock is not available (even though AF_VSOCK is)."); + return 0; + } + return log_error_errno(r, "Failed to query local AF_VSOCK CID: %m"); + } r = make_sshd_template_unit( dest,