From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYFm-0007CF-IL for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsYFh-00018m-Iz for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:44:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40428 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYFh-00018X-CU for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:44:05 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u97GhmsE142390 for ; Fri, 7 Oct 2016 12:44:05 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0b-001b2d01.pphosted.com with ESMTP id 25xd3e6ddp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 07 Oct 2016 12:44:04 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Oct 2016 12:44:04 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1475772018-27484-4-git-send-email-stefanha@redhat.com> References: <1475772018-27484-1-git-send-email-stefanha@redhat.com> <1475772018-27484-4-git-send-email-stefanha@redhat.com> Date: Fri, 07 Oct 2016 11:42:35 -0500 Message-Id: <20161007164235.9563.23850@loki> Subject: Re: [Qemu-devel] [PATCH 3/4] sockets: add AF_VSOCK support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Quoting Stefan Hajnoczi (2016-10-06 11:40:17) > Add the AF_VSOCK address family so that qemu-ga will be able to use > virtio-vsock. > = > The AF_VSOCK address family uses address tuples. The cid is > the unique identifier comparable to an IP address. AF_VSOCK does not > use name resolution so it's seasy to convert between struct sockaddr_vm > and strings. > = > This patch defines a VsockSocketAddress instead of trying to piggy-back > on InetSocketAddress. This is cleaner in the long run since it avoids > lots of IPv4 vs IPv6 vs vsock special casing. > = > Signed-off-by: Stefan Hajnoczi > --- > qapi-schema.json | 23 +++++- > util/qemu-sockets.c | 222 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++ > 2 files changed, 244 insertions(+), 1 deletion(-) > = > diff --git a/qapi-schema.json b/qapi-schema.json > index c3dcf11..8864a96 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -987,12 +987,14 @@ > # > # @unix: unix socket > # > +# @vsock: vsock family (since 2.8) > +# > # @unknown: otherwise > # > # Since: 2.1 > ## > { 'enum': 'NetworkAddressFamily', > - 'data': [ 'ipv4', 'ipv6', 'unix', 'unknown' ] } > + 'data': [ 'ipv4', 'ipv6', 'unix', 'vsock', 'unknown' ] } > = > ## > # @VncBasicInfo > @@ -3017,6 +3019,24 @@ > 'path': 'str' } } > = > ## > +# @VsockSocketAddress > +# > +# Captures a socket address in the vsock namespace. > +# > +# @cid: unique host identifier > +# @port: port > +# > +# Note that string types are used to allow for possible future hostname = or > +# service resolution support. > +# > +# Since 2.8 > +## > +{ 'struct': 'VsockSocketAddress', > + 'data': { > + 'cid': 'str', > + 'port': 'str' } } Is there any reason to not define these as uint32_t? Not sure if there are other reasons for this, but if it's just for consistency with how Inet is handled, the code seems to do straight atoi()<->printf("%d") to covert between numerical and string representation so it doesn't seem like we need to account for any differences between command-line and internal representation in sockaddr_vm.