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
This commit is contained in:
Lennart Poettering
2024-02-29 18:28:01 +01:00
parent 33f23e2230
commit f557129ecb
+7 -1
View File
@@ -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,