]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machined: initialize CID of '.host' pseudo-machine to 1 (i.e. the loopback vsock... 33325/head
authorLennart Poettering <lennart@poettering.net>
Thu, 23 May 2024 21:34:39 +0000 (23:34 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 14 Jun 2024 09:13:36 +0000 (11:13 +0200)
src/machine/machined.c

index 398375bc5e29963cb70eaa4eaf9524b8e4d3738c..60badbf5d075b7cb904d8009d195e940376651e1 100644 (file)
@@ -26,6 +26,7 @@
 #include "process-util.h"
 #include "service-util.h"
 #include "signal-util.h"
+#include "socket-util.h"
 #include "special.h"
 
 static Manager* manager_unref(Manager *m);
@@ -143,6 +144,11 @@ static int manager_add_host_machine(Manager *m) {
         t->leader = TAKE_PIDREF(pidref);
         t->id = mid;
 
+        /* If vsock is available, let's expose the loopback CID for the local host (and not the actual local
+         * CID, in order to return a ideally constant record for the host) */
+        if (vsock_get_local_cid(/* ret= */ NULL) >= 0)
+                t->vsock_cid = VMADDR_CID_LOCAL;
+
         t->root_directory = TAKE_PTR(rd);
         t->unit = TAKE_PTR(unit);