From effc12f8e9e20d0951d2ba5883587666bd8218e3 Mon Sep 17 00:00:00 2001 From: caavery Date: Wed, 6 Sep 2017 18:18:10 -0400 Subject: bpo-27584: New addition of vSockets to the python socket module (#2489) * bpo-27584: New addition of vSockets to the python socket module Support for AF_VSOCK on Linux only * bpo-27584: Fixes for V2 Fixed syntax and naming problems. Fixed #ifdef AF_VSOCK checking Restored original aclocal.m4 * bpo-27584: Fixes for V3 Added checking for fcntl and thread modules. * bpo-27584: Fixes for V4 Fixed white space error * bpo-27584: Fixes for V5 Added back comma in (CID, port). * bpo-27584: Fixes for V6 Added news file. socket.rst now reflects first Linux introduction of AF_VSOCK. Fixed get_cid in test_socket.py. Replaced PyLong_FromLong with PyLong_FromUnsignedLong in socketmodule.c Got rid of extra AF_VSOCK #define. Added sockaddr_vm to sock_addr. * bpo-27584: Fixes for V7 Minor cleanup. * bpo-27584: Fixes for V8 Put back #undef AF_VSOCK as it is necessary when vm_sockets.h is not installed. --- Modules/socketmodule.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Modules/socketmodule.h') diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index 03f982b910..03dbf18f7b 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -107,6 +107,12 @@ typedef int socklen_t; #define SOL_ALG 279 #endif +#ifdef HAVE_LINUX_VM_SOCKETS_H +# include +#else +# undef AF_VSOCK +#endif + /* Linux 3.19 */ #ifndef ALG_SET_AEAD_ASSOCLEN #define ALG_SET_AEAD_ASSOCLEN 4 @@ -193,6 +199,9 @@ typedef union sock_addr { #ifdef HAVE_SOCKADDR_ALG struct sockaddr_alg alg; #endif +#ifdef AF_VSOCK + struct sockaddr_vm vm; +#endif } sock_addr_t; /* The object holding a socket. It holds some extra information, -- cgit v1.2.1