summaryrefslogtreecommitdiff
path: root/src/openvpn/mtcp.c
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2020-08-15 21:29:54 +0200
committerBernhard Schmidt <berni@debian.org>2020-08-15 21:29:54 +0200
commit7c229d538824cb679351220ad8911f7b2daa7c23 (patch)
tree5c4d64b60da9018c7db3a9335a9787d326beade3 /src/openvpn/mtcp.c
parentd3986a312f5fbcfd0e78e6b147eef419fb4e5f54 (diff)
parent1079962e4c06f88a54e50d997c1b7e84303d30b4 (diff)
Update upstream source from tag 'upstream/2.5_beta1'
Update to upstream version '2.5~beta1' with Debian dir d53f9a482ac24eb491a294b26c24bb1d87afad24
Diffstat (limited to 'src/openvpn/mtcp.c')
-rw-r--r--src/openvpn/mtcp.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c
index e8d2add..458e6e4 100644
--- a/src/openvpn/mtcp.c
+++ b/src/openvpn/mtcp.c
@@ -29,10 +29,8 @@
#include "syshead.h"
-#if P2MP_SERVER
-
#include "multi.h"
-#include "forward-inline.h"
+#include "forward.h"
#include "memdbg.h"
@@ -269,8 +267,25 @@ multi_tcp_wait(const struct context *c,
struct multi_tcp *mtcp)
{
int status;
+ unsigned int *persistent = &mtcp->tun_rwflags;
socket_set_listen_persistent(c->c2.link_socket, mtcp->es, MTCP_SOCKET);
- tun_set(c->c1.tuntap, mtcp->es, EVENT_READ, MTCP_TUN, &mtcp->tun_rwflags);
+
+#ifdef _WIN32
+ if (tuntap_is_wintun(c->c1.tuntap))
+ {
+ if (!tuntap_ring_empty(c->c1.tuntap))
+ {
+ /* there is data in wintun ring buffer, read it immediately */
+ mtcp->esr[0].arg = MTCP_TUN;
+ mtcp->esr[0].rwflags = EVENT_READ;
+ mtcp->n_esr = 1;
+ return 1;
+ }
+ persistent = NULL;
+ }
+#endif
+ tun_set(c->c1.tuntap, mtcp->es, EVENT_READ, MTCP_TUN, persistent);
+
#ifdef ENABLE_MANAGEMENT
if (management)
{
@@ -844,5 +859,3 @@ tunnel_server_tcp(struct context *top)
multi_top_free(&multi);
close_instance(top);
}
-
-#endif /* if P2MP_SERVER */