From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bumcy-0001fx-St for qemu-devel@nongnu.org; Thu, 13 Oct 2016 16:29:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bumcu-0000RD-MU for qemu-devel@nongnu.org; Thu, 13 Oct 2016 16:29:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bumcu-0000Ql-D9 for qemu-devel@nongnu.org; Thu, 13 Oct 2016 16:29:16 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9DKO1FG108979 for ; Thu, 13 Oct 2016 16:29:15 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 262bwt9crf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Oct 2016 16:29:15 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Oct 2016 16:29:14 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <20161012150610.GC15590@stefanha-x1.localdomain> References: <1475772018-27484-1-git-send-email-stefanha@redhat.com> <1475772018-27484-4-git-send-email-stefanha@redhat.com> <20161007164235.9563.23850@loki> <20161012150610.GC15590@stefanha-x1.localdomain> Date: Thu, 13 Oct 2016 15:20:22 -0500 Message-Id: <20161013202022.3777.40122@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 Cc: qemu-devel@nongnu.org Quoting Stefan Hajnoczi (2016-10-12 10:06:10) > On Fri, Oct 07, 2016 at 11:42:35AM -0500, Michael Roth wrote: > > 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-ba= ck > > > 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 hostn= ame 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. > = > Just in case AF_VSOCK ever supports name and service resolution like > TCP/IP. In that case cid could be a host name and port could be a > service name. > = > (I mentioned this in the doc comment.) Ahh, sorry I missed that completely. Makes perfect sense then. > = > Stefan