From e9c055b75092f9939e45e972e490a8fdf267dccb Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sun, 24 Oct 2021 16:38:34 +0200 Subject: [PATCH] Print VSOCK warning only with VSOCK-LISTEN --- CHANGES | 3 +++ xio-listen.c | 12 ------------ xio-vsock.c | 10 ++++++++++ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index f47b015..309d7b2 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,9 @@ Corrections: Fixed a few minor coding issues + A VSOCK warning message was generated with all listening addresses + instead of only with VSOCK-LISTEN + Testing: Prevent the TIMESTAMP tests from sporadically failing due do seconds overflow diff --git a/xio-listen.c b/xio-listen.c index 58e054d..6e7f5c5 100644 --- a/xio-listen.c +++ b/xio-listen.c @@ -152,18 +152,6 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl applyopts_offset(xfd, opts); applyopts_cloexec(xfd->fd, opts); -#if defined(WITH_VSOCK) && defined(IOCTL_VM_SOCKETS_GET_LOCAL_CID) - { - unsigned int cid; - if (Ioctl(xfd->fd, IOCTL_VM_SOCKETS_GET_LOCAL_CID, &cid) < 0) { - Warn2("ioctl(%d, IOCTL_VM_SOCKETS_GET_LOCAL_CID, ...): %s", - xfd->fd, strerror(errno)); - } else { - Notice1("VSOCK CID=%u", cid); - } - } -#endif - applyopts(xfd->fd, opts, PH_PREBIND); applyopts(xfd->fd, opts, PH_BIND); if (Bind(xfd->fd, (struct sockaddr *)us, uslen) < 0) { diff --git a/xio-vsock.c b/xio-vsock.c index 0720b2e..5078e9c 100644 --- a/xio-vsock.c +++ b/xio-vsock.c @@ -139,6 +139,16 @@ static int xioopen_vsock_listen(int argc, const char *argv[], struct opt *opts, return ret; } + { + unsigned int cid; + if (Ioctl(xfd->fd, IOCTL_VM_SOCKETS_GET_LOCAL_CID, &cid) < 0) { + Warn2("ioctl(%d, IOCTL_VM_SOCKETS_GET_LOCAL_CID, ...): %s", + xfd->fd, strerror(errno)); + } else { + Notice1("VSOCK CID=%u", cid); + } + } + opts0 = copyopts(opts, GROUP_ALL); ret = retropt_bind(opts, pf, socktype, protocol, (struct sockaddr *)&sa_bind,