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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user