Skip to contentSkip to conversation

Fix "--dev null"

PATCH In review Gert Doering 3 participants 5 messages Feb 24, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix "--dev null"

To test whether a server is reachable and all the key handling is right, openvpn can connect with "--dev null --ifconfig-noexec" to avoid needing to the client with elevated privileges.

This was erroring out for no good reason (because the "set environment variables appropriately" code didn't know if this is a tun or tap device...) - treat --dev null as "tap", done.

---
 src/openvpn/tun.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/openvpn/tun.c +3 -1
index 31585b32..12ce99d5 100644
@@ -560,7 +560,9 @@ is_tun_p2p(const struct tuntap *tt)
 {
     bool tun = false;
 
-    if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET))
+    if (tt->type == DEV_TYPE_TAP ||
+        (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET) ||
+	tt->type == DEV_TYPE_NULL )
     {
         tun = false;
     }
Signature · 1 line
2.11.1
#1 lore raw

Hi,

Quoted 3 lines · Gert Doering

To test whether a server is reachable and all the key handling is right, openvpn can connect with "--dev null --ifconfig-noexec" to avoid needing to the client with elevated privileges.

There seems to be a typo here. Did you mean "to avoid needing to _connect to_ the client with elevated privileges"?

Quoted 26 lines

This was erroring out for no good reason (because the "set environment variables appropriately" code didn't know if this is a tun or tap device...) - treat --dev null as "tap", done.

---
 src/openvpn/tun.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/openvpn/tun.c +3 -1
index 31585b32..12ce99d5 100644
@@ -560,7 +560,9 @@ is_tun_p2p(const struct tuntap *tt)
 {
     bool tun = false;
 
-    if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET))
+    if (tt->type == DEV_TYPE_TAP ||
+        (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET) ||
+	tt->type == DEV_TYPE_NULL )
     {
         tun = false;
     }
Signature · 5 lines
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc

irc freenode net: mattock
#2 lore raw

Hi,

Quoted 7 lines · Samuli Seppänen
Quoted 3 lines · Gert Doering

To test whether a server is reachable and all the key handling is right, openvpn can connect with "--dev null --ifconfig-noexec" to avoid needing to the client with elevated privileges.

There seems to be a typo here. Did you mean "to avoid needing to _connect to_ the client with elevated privileges"?

Actually "to _run_ the client" - indeed.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#3 lore raw
In reply to Gert Doering

Hi,

Quoted 19 lines · Gert Doering

To test whether a server is reachable and all the key handling is right, openvpn can connect with "--dev null --ifconfig-noexec" to avoid needing to the client with elevated privileges.

This was erroring out for no good reason (because the "set environment variables appropriately" code didn't know if this is a tun or tap device...) - treat --dev null as "tap", done.

---
 src/openvpn/tun.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/openvpn/tun.c +0 -0
index 31585b32..12ce99d5 100644

src/openvpn/tun.c is_tun_p2p(const struct tuntap *tt) · line 568

Quoted 10 lines
src/openvpn/tun.c +3 -1
@@ -560,7 +560,9 @@ is_tun_p2p(const struct tuntap *tt)
 {
     bool tun = false;
 
-    if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET))
+    if (tt->type == DEV_TYPE_TAP ||
+        (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET) ||
+	tt->type == DEV_TYPE_NULL )
     {
         tun = false;
     }

Code makes sense. Code-ACK.

Style-wise, we went for pos_arith=lead (Knuth style), so

x = first_condition

      && second_condition
      && third_condition

and this patch is trying to sneak a tab into the code! ;)

I'd be fine with you fixing the style on the fly when applying.

-Steffan

#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Fix '--dev null'

In reply to Gert Doering

Patch has been applied to the master and release/2.4 branch.

As ordered, '||' have been moved to pos_arith=lead, and the tab has been extabinated.

commit 22c5381b71710ad0e1dbbccc1d5680fccb602311 (master) commit 2085c1f3875b9c96ac739941712247b805677efa (release/2.4)

Author: Gert Doering
Date:   Fri Feb 24 14:52:22 2017 +0100
     Fix '--dev null'

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg14186.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering