Skip to contentSkip to conversation

tap-windows6 interoperability patches

PATCH In review [email protected]... 2 participants 4 messages Oct 22, 2014 – Oct 24, 2014

lore
Share & tools
lore
#0 lore raw

cover tap-windows6 interoperability patches

These patches fix serious interoperability issues with tap-windows6. Backported versions of these patches were tested with OpenVPN 2.3.4 because openvpn-build is currently unable to build from Git "master".

[PATCH 1/2] Modification to address bug where OpenVPN enters state [PATCH 2/2] Revised fix for code=995 sped bug.

#1 lore raw

PATCH 1/2 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.

From: TDivine <[email protected]...>

Adding new tap adapters while connected:

https://community.openvpn.net/openvpn/ticket/430

---
 src/openvpn/tun.h | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
src/openvpn/tun.h +18 -9
index 631b53c..d84b777 100644
@@ -380,15 +380,24 @@ int tun_finalize (HANDLE h, struct overlapped_io *io, struct buffer *buf);
 static inline bool
 tuntap_stop (int status)
 {
-  /*
-   * This corresponds to the STATUS_NO_SUCH_DEVICE
-   * error in tapdrvr.c.
-   */
-  if (status < 0)
-    {
-      return openvpn_errno () == ERROR_FILE_NOT_FOUND;
-    }
-  return false;
+   /*
+    * This corresponds to the STATUS_NO_SUCH_DEVICE
+    * error in tapdrvr.c.
+    */
+   if (status < 0)
+   {
+      status = openvpn_errno();
+      switch (status)
+      {
+      case ERROR_FILE_NOT_FOUND:
+      case ERROR_OPERATION_ABORTED:
+         return true;
+
+      default:
+         return false;
+      }
+   }
+   return false;
 }
 
 static inline int
Signature · 1 line
1.9.1
#2 lore raw

[Openvpn-devel] [PATCH applied] Re: 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.

Your patch has been applied to the master and release/2.3 branches.

Since the second patch basically undoes everything the first one does and uses a different approach, I've merged them into one patch to make the net change more explicit - and fixed a bit of spurious whitespace.

Also, I've taken the liberty of adding a non-Win32 version of tuntap_abort() to tun.h, to avoid breaking compilation elsewhere.

But anyway, thanks for telling us where the problem with our talking to the driver was :-)

commit 7aa178381241ae015273914065471e0d271ee1c3 (master) commit 4fe957aabb9289b13ce9c28854d1e912efee9b77 (release/2.3)

Author: TDivine
Date:   Wed Oct 22 10:07:39 2014 +0300
    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 <[email protected]...>
    Message-Id: <[email protected]...>
    URL: http://article.gmane.org/gmane.network.openvpn.devel/9165
    Signed-off-by: Gert Doering <[email protected]...>
    
    Acked-by: Gert Doering <[email protected]...>
    Message-Id: <[email protected]...>
    URL: http://article.gmane.org/gmane.network.openvpn.devel/9167
    Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#3 lore raw

PATCH 2/2 Revised fix for code=995 sped bug.

In reply to [email protected]...

From: TDivine <[email protected]...>

---
 src/openvpn/forward.c |  9 +++++++++
 src/openvpn/tun.h     | 34 ++++++++++++++++++++--------------
 2 files changed, 29 insertions(+), 14 deletions(-)
src/openvpn/forward.c +9 -0
index 39f66e3..27b775f 100644
@@ -948,6 +948,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);
 
src/openvpn/tun.h +20 -14
index d84b777..7712568 100644
@@ -378,28 +378,34 @@ int tun_write_queue (struct tuntap *tt, struct buffer *buf);
 int tun_finalize (HANDLE h, struct overlapped_io *io, struct buffer *buf);
 
 static inline bool
-tuntap_stop (int status)
+tuntap_stop(int status)
+{
+   /*
+   * This corresponds to the STATUS_NO_SUCH_DEVICE
+   * error in tapdrvr.c.
+   */
+   if (status < 0)
+   {
+      return openvpn_errno() == ERROR_FILE_NOT_FOUND;
+   }
+   return false;
+}
+
+static inline bool
+tuntap_abort(int status)
 {
    /*
-    * This corresponds to the STATUS_NO_SUCH_DEVICE
-    * error in tapdrvr.c.
-    */
+   * Typically generated when driver is halted.
+   */
    if (status < 0)
    {
-      status = openvpn_errno();
-      switch (status)
-      {
-      case ERROR_FILE_NOT_FOUND:
-      case ERROR_OPERATION_ABORTED:
-         return true;
-
-      default:
-         return false;
-      }
+      return openvpn_errno() == ERROR_OPERATION_ABORTED;
    }
    return false;
 }
 
+
+
 static inline int
 tun_write_win32 (struct tuntap *tt, struct buffer *buf)
 {
Signature · 1 line
1.9.1