diff options
| author | Justin Terry (VM) <juterry@microsoft.com> | 2017-09-21 16:13:05 -0700 |
|---|---|---|
| committer | jsorg71 <jay.sorg@gmail.com> | 2017-11-07 18:20:45 -0800 |
| commit | 50bd624cc49d7409f6f73b65aeae4cabdec3e7ee (patch) | |
| tree | 93efaaa410fb6bd279979bd1f590df407a22350f /common/os_calls.c | |
| parent | 3d29b6ec768155b6eacf2846dbdb43eddde1d48c (diff) | |
| download | xrdp-proprietary-50bd624cc49d7409f6f73b65aeae4cabdec3e7ee.tar.gz xrdp-proprietary-50bd624cc49d7409f6f73b65aeae4cabdec3e7ee.zip | |
Implements XRDP over vsock
1. Implements the ability to use AV_VSOCK for the transport rather than TCP.
2. Updates the ini file to be able to conditionally turn this feature on.
Diffstat (limited to 'common/os_calls.c')
| -rw-r--r-- | common/os_calls.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index 43064c40..fb55376a 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -41,6 +41,9 @@ #include <netinet/in.h> #include <netinet/tcp.h> #include <sys/socket.h> +#if defined(XRDP_ENABLE_VSOCK) +#include <linux/vm_sockets.h> +#endif #include <sys/un.h> #include <sys/time.h> #include <sys/times.h> @@ -583,6 +586,19 @@ g_sck_local_socket(void) } /*****************************************************************************/ +#if defined(XRDP_ENABLE_VSOCK) +int +g_sck_vsock_socket(void) +{ +#if defined(_WIN32) + return 0; +#else + return socket(PF_VSOCK, SOCK_STREAM, 0); +#endif +} +#endif + +/*****************************************************************************/ /* returns error */ int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid) @@ -990,6 +1006,26 @@ g_sck_local_bind(int sck, const char *port) #endif } +/*****************************************************************************/ +#if defined(XRDP_ENABLE_VSOCK) +int +g_sck_vsock_bind(int sck, const char *port) +{ +#if defined(_WIN32) + return -1; +#else + struct sockaddr_vm s; + + memset(&s, 0, sizeof(struct sockaddr_vm)); + s.svm_family = AF_VSOCK; + s.svm_port = atoi(port); + s.svm_cid = VMADDR_CID_ANY; + + return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_vm)); +#endif +} +#endif + #if defined(XRDP_ENABLE_IPV6) /*****************************************************************************/ /* Helper function for g_tcp_bind_address. */ |
