Re: [Openvpn-devel] [PATCH] Fix "--dev null"

2017-02-24 Thread Steffan Karger
Hi,

On 24-02-17 14:52, Gert Doering wrote:
> 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.
> 
> Signed-off-by: Gert Doering 
> ---
>  src/openvpn/tun.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
> index 31585b32..12ce99d5 100644
> --- a/src/openvpn/tun.c
> +++ b/src/openvpn/tun.c
> @@ -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

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] Fix "--dev null"

2017-02-24 Thread Gert Doering
Hi,

On Fri, Feb 24, 2017 at 04:32:14PM +0200, Samuli Seppänen wrote:
> On 24/02/2017 15:52, Gert Doering wrote:
> > 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
-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


signature.asc
Description: PGP signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] Fix "--dev null"

2017-02-24 Thread Samuli Seppänen
Hi,

On 24/02/2017 15:52, Gert Doering wrote:
> 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"?

> 
> 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.
> 
> Signed-off-by: Gert Doering 
> ---
>  src/openvpn/tun.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
> index 31585b32..12ce99d5 100644
> --- a/src/openvpn/tun.c
> +++ b/src/openvpn/tun.c
> @@ -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;
>  }
> 


-- 
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc

irc freenode net: mattock

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH] Fix "--dev null"

2017-02-24 Thread 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.

Signed-off-by: Gert Doering 
---
 src/openvpn/tun.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 31585b32..12ce99d5 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -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;
 }
-- 
2.11.1


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel