summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c16
-rw-r--r--common/os_calls.h9
-rw-r--r--common/trans.c6
-rw-r--r--common/trans.h3
-rw-r--r--xrdp/xrdp_listen.c11
5 files changed, 15 insertions, 30 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index fb55376a..7bd3e68f 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -586,17 +586,15 @@ g_sck_local_socket(void)
}
/*****************************************************************************/
-#if defined(XRDP_ENABLE_VSOCK)
int
g_sck_vsock_socket(void)
{
-#if defined(_WIN32)
- return 0;
-#else
+#if defined(XRDP_ENABLE_VSOCK)
return socket(PF_VSOCK, SOCK_STREAM, 0);
+#else
+ return 0;
#endif
}
-#endif
/*****************************************************************************/
/* returns error */
@@ -1007,13 +1005,10 @@ g_sck_local_bind(int sck, const char *port)
}
/*****************************************************************************/
-#if defined(XRDP_ENABLE_VSOCK)
int
g_sck_vsock_bind(int sck, const char *port)
{
-#if defined(_WIN32)
- return -1;
-#else
+#if defined(XRDP_ENABLE_VSOCK)
struct sockaddr_vm s;
memset(&s, 0, sizeof(struct sockaddr_vm));
@@ -1022,9 +1017,10 @@ g_sck_vsock_bind(int sck, const char *port)
s.svm_cid = VMADDR_CID_ANY;
return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_vm));
+#else
+ return -1;
#endif
}
-#endif
#if defined(XRDP_ENABLE_IPV6)
/*****************************************************************************/
diff --git a/common/os_calls.h b/common/os_calls.h
index d21b4d9c..e42e95bd 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -37,11 +37,6 @@
#define g_tcp_select g_sck_select
#define g_close_wait_obj g_delete_wait_obj
-#if defined(XRDP_ENABLE_VSOCK)
-#define g_vsock_socket g_sck_vsock_socket
-#define g_vsock_bind g_sck_vsock_bind
-#endif
-
int g_rm_temp_dir(void);
int g_mk_socket_path(const char* app_name);
void g_init(const char* app_name);
@@ -67,9 +62,7 @@ int g_sck_get_send_buffer_bytes(int sck, int *bytes);
int g_sck_set_recv_buffer_bytes(int sck, int bytes);
int g_sck_get_recv_buffer_bytes(int sck, int *bytes);
int g_sck_local_socket(void);
-#if defined(XRDP_ENABLE_VSOCK)
int g_sck_vsock_socket(void);
-#endif
int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid);
void g_sck_close(int sck);
int g_tcp_connect(int sck, const char* address, const char* port);
@@ -77,9 +70,7 @@ int g_sck_local_connect(int sck, const char* port);
int g_sck_set_non_blocking(int sck);
int g_tcp_bind(int sck, const char *port);
int g_sck_local_bind(int sck, const char* port);
-#if defined(XRDP_ENABLE_VSOCK)
int g_sck_vsock_bind(int sck, const char* port);
-#endif
int g_tcp_bind_address(int sck, const char* port, const char* address);
int g_sck_listen(int sck);
int g_tcp_accept(int sck);
diff --git a/common/trans.c b/common/trans.c
index 8a271722..24004dbf 100644
--- a/common/trans.c
+++ b/common/trans.c
@@ -831,16 +831,15 @@ trans_listen_address(struct trans *self, char *port, const char *address)
}
}
}
-#if defined(XRDP_ENABLE_VSOCK)
else if (self->mode == TRANS_MODE_VSOCK) /* vsock socket */
{
- self->sck = g_vsock_socket();
+ self->sck = g_sck_vsock_socket();
if (self->sck < 0)
return 1;
g_tcp_set_non_blocking(self->sck);
- if (g_vsock_bind(self->sck, port) == 0)
+ if (g_sck_vsock_bind(self->sck, port) == 0)
{
if (g_tcp_listen(self->sck) == 0)
{
@@ -850,7 +849,6 @@ trans_listen_address(struct trans *self, char *port, const char *address)
}
}
}
-#endif
return 1;
}
diff --git a/common/trans.h b/common/trans.h
index 8b0b5a70..57a0fd6a 100644
--- a/common/trans.h
+++ b/common/trans.h
@@ -26,10 +26,7 @@
#define TRANS_MODE_TCP 1
#define TRANS_MODE_UNIX 2
-
-#if defined(XRDP_ENABLE_VSOCK)
#define TRANS_MODE_VSOCK 3
-#endif
#define TRANS_TYPE_LISTENER 1
#define TRANS_TYPE_SERVER 2
diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c
index ddfa5b59..259e9e98 100644
--- a/xrdp/xrdp_listen.c
+++ b/xrdp/xrdp_listen.c
@@ -206,7 +206,6 @@ xrdp_listen_get_port_address(char *port, int port_bytes,
}
}
}
-#if defined(XRDP_ENABLE_VSOCK)
if (g_strcasecmp(val, "use_vsock") == 0)
{
val = (char *)list_get_item(values, index);
@@ -215,7 +214,6 @@ xrdp_listen_get_port_address(char *port, int port_bytes,
*mode = TRANS_MODE_VSOCK;
}
}
-#endif
if (g_strcasecmp(val, "address") == 0)
{
val = (char *)list_get_item(values, index);
@@ -381,13 +379,11 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
/* not valid with UDS */
tcp_nodelay = 0;
}
-#if defined(XRDP_ENABLE_VSOCK)
else if (self->listen_trans->mode == TRANS_MODE_VSOCK)
{
/* not valid with VSOCK */
tcp_nodelay = 0;
}
-#endif
/* Create socket */
error = trans_listen_address(self->listen_trans, port, address);
@@ -568,6 +564,13 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
{
log_message(LOG_LEVEL_ERROR,"xrdp_listen_main_loop: listen error, possible port "
"already in use");
+#if !defined(XRDP_ENABLE_VSOCK)
+ if (self->listen_trans->mode == TRANS_MODE_VSOCK)
+ {
+ log_message(LOG_LEVEL_ERROR,"xrdp_listen_main_loop: listen error, "
+ "vsock support not compiled and config requested");
+ }
+#endif
}
self->status = -1;