diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2016-10-14 10:00:55 +0100 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2016-10-31 19:49:33 -0500 |
commit | 6a02c8069f6c28ed1251e3fbbdf16e49d2c27ccc (patch) | |
tree | 428aaa097dc544ba45d63a71d9bcfe5a8c23ddb8 /configure | |
parent | f06b2031a31cdd3acf6f61a977e505b8c6b58f73 (diff) | |
download | qemu-6a02c8069f6c28ed1251e3fbbdf16e49d2c27ccc.zip qemu-6a02c8069f6c28ed1251e3fbbdf16e49d2c27ccc.tar.gz qemu-6a02c8069f6c28ed1251e3fbbdf16e49d2c27ccc.tar.bz2 |
sockets: add AF_VSOCK support
Add the AF_VSOCK address family so that qemu-ga will be able to use
virtio-vsock.
The AF_VSOCK address family uses <cid, port> address tuples. The cid is
the unique identifier comparable to an IP address. AF_VSOCK does not
use name resolution so it's easy 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 <stefanha@redhat.com>
* treat trailing commas as garbage when parsing (Eric Blake)
* add configure check instead of checking AF_VSOCK directly
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -4674,6 +4674,33 @@ if compile_prog "" "" ; then have_rtnetlink=yes fi +########################################## +# check for usable AF_VSOCK environment +have_af_vsock=no +cat > $TMPC << EOF +#include <errno.h> +#include <sys/types.h> +#include <sys/socket.h> +#if !defined(AF_VSOCK) +# error missing AF_VSOCK flag +#endif +#include <linux/vm_sockets.h> +int main(void) { + int sock, ret; + struct sockaddr_vm svm; + socklen_t len = sizeof(svm); + sock = socket(AF_VSOCK, SOCK_STREAM, 0); + ret = getpeername(sock, (struct sockaddr *)&svm, &len); + if ((ret == -1) && (errno == ENOTCONN)) { + return 0; + } + return -1; +} +EOF +if compile_prog "" "" ; then + have_af_vsock=yes +fi + ################################################# # Sparc implicitly links with --relax, which is # incompatible with -r, so --no-relax should be @@ -5662,6 +5689,10 @@ if test "$replication" = "yes" ; then echo "CONFIG_REPLICATION=y" >> $config_host_mak fi +if test "$have_af_vsock" = "yes" ; then + echo "CONFIG_AF_VSOCK=y" >> $config_host_mak +fi + # Hold two types of flag: # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on # a thread we have a handle to |