vmspawn: use our generic vsock CID parser, instead of a howngrown one

Let's also use 'unsigned' as type for the CID everywhere, and
VMADDR_CID_ANY as marker for "invalid CID", as that's what the vsock
APIs natively do.
This commit is contained in:
Lennart Poettering
2024-01-12 16:03:19 +01:00
parent 1d748d7c99
commit 06d4fe57c9
2 changed files with 17 additions and 12 deletions
+5
View File
@@ -374,6 +374,11 @@ int socket_get_mtu(int fd, int af, size_t *ret);
int connect_unix_path(int fd, int dir_fd, const char *path);
static inline bool VSOCK_CID_IS_REGULAR(unsigned cid) {
/* 0, 1, 2, UINT32_MAX are special, refuse those */
return cid > 2 && cid < UINT32_MAX;
}
int vsock_parse_port(const char *s, unsigned *ret);
int vsock_parse_cid(const char *s, unsigned *ret);