From 4fe957aabb9289b13ce9c28854d1e912efee9b77 Mon Sep 17 00:00:00 2001 From: TDivine Date: Wed, 22 Oct 2014 10:07:39 +0300 Subject: [PATCH] Fix "code=995" bug with windows NDIS6 tap driver. Modification to address bug where OpenVPN enters state where it is unresponsive and cannot be terminated. Log output is continuous spew of "code=995" errors. Revised fix for code=995 sped bug. Adding new tap adapters while connected: https://community.openvpn.net/openvpn/ticket/430 Acked-by: Gert Doering Message-Id: <1413961660-19251-2-git-send-email-samuli@openvpn.net> URL: http://article.gmane.org/gmane.network.openvpn.devel/9165 Signed-off-by: Gert Doering Acked-by: Gert Doering Message-Id: <1413961660-19251-3-git-send-email-samuli@openvpn.net> URL: http://article.gmane.org/gmane.network.openvpn.devel/9167 Signed-off-by: Gert Doering (cherry picked from commit 7aa178381241ae015273914065471e0d271ee1c3) --- src/openvpn/forward.c | 9 +++++++++ src/openvpn/tun.h | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 024cd58cf..7f0d083db 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -952,6 +952,15 @@ read_incoming_tun (struct context *c) return; } + /* Was TUN/TAP I/O operation aborted? */ + if (tuntap_abort(c->c2.buf.len)) + { + register_signal(c, SIGTERM, "tun-abort"); + msg(M_FATAL, "TUN/TAP I/O operation aborted, exiting"); + perf_pop(); + return; + } + /* Check the status return from read() */ check_status (c->c2.buf.len, "read from TUN/TAP", NULL, c->c1.tuntap); diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 085d6a3f0..1931c5207 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -374,6 +374,19 @@ tuntap_stop (int status) return false; } +static inline bool +tuntap_abort(int status) +{ + /* + * Typically generated when driver is halted. + */ + if (status < 0) + { + return openvpn_errno() == ERROR_OPERATION_ABORTED; + } + return false; +} + static inline int tun_write_win32 (struct tuntap *tt, struct buffer *buf) { @@ -415,6 +428,12 @@ tuntap_stop (int status) return false; } +static inline bool +tuntap_abort(int status) +{ + return false; +} + static inline void tun_standby_init (struct tuntap *tt) { -- 2.47.2