From: "plaisthos (Code Review)" Date: Mon, 16 Sep 2024 22:42:33 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <9ac38cda0c7320cb344a659a2850edfbaaf38366-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="4mxJKwFgRA4="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Change dev null to be a driver type instead of a special mode of tun/tap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --4mxJKwFgRA4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld,=20 I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/748?usp=3Demail to look at the new patch set (#3). Change subject: Change dev null to be a driver type instead of a special mo= de of tun/tap ...................................................................... Change dev null to be a driver type instead of a special mode of tun/tap Change-Id: I5987ebb7c38ab176eed7efc004ea54f606a77a12 Signed-off-by: Arne Schwabe --- M src/openvpn/init.c M src/openvpn/proto.h M src/openvpn/tun.c M src/openvpn/tun.h 4 files changed, 86 insertions(+), 113 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/748/3 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index b516608..378dd48 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1764,6 +1764,10 @@ /* Using AF_UNIX trumps using DCO */ c->c1.tuntap->backend_driver =3D DRIVER_AFUNIX; } + else if (is_dev_type(c->options.dev, c->options.dev_type, "null")) + { + c->c1.tuntap->backend_driver =3D DRIVER_NULL; + } #ifdef _WIN32 else { @@ -1858,7 +1862,12 @@ open_tun_backend(struct context *c) { struct tuntap *tt =3D c->c1.tuntap; - if (tt->backend_driver =3D=3D DRIVER_AFUNIX) + + if (tt->backend_driver =3D=3D DRIVER_NULL) + { + open_tun_null(c->c1.tuntap); + } + else if (tt->backend_driver =3D=3D DRIVER_AFUNIX) { open_tun_afunix(&c->options, c->c2.frame.tun_mtu, tt, c->c2.es); } @@ -2059,6 +2068,11 @@ { tun_afunix_close(c->c1.tuntap); } + else if (c->c1.tuntap->backend_driver =3D=3D DRIVER_NULL) + { + free(c->c1.tuntap->actual_name); + free(c->c1.tuntap); + } else { close_tun(c->c1.tuntap, &c->net_ctx); diff --git a/src/openvpn/proto.h b/src/openvpn/proto.h index 4b6d6d6..a160fb6 100644 --- a/src/openvpn/proto.h +++ b/src/openvpn/proto.h @@ -33,7 +33,6 @@ * Tunnel types */ #define DEV_TYPE_UNDEF 0 -#define DEV_TYPE_NULL 1 #define DEV_TYPE_TUN 2 /* point-to-point IP tunnel */ #define DEV_TYPE_TAP 3 /* ethernet (802.3) tunnel */ diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 3f5f450..c6f14c3 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -78,6 +78,9 @@ case DRIVER_AFUNIX: return "unix"; + case DRIVER_NULL: + return "null"; + #ifdef HAVE_NET_IF_UTUN_H case DRIVER_UTUN: return "utun"; @@ -468,7 +471,9 @@ int dev_type_enum(const char *dev, const char *dev_type) { - if (is_dev_type(dev, dev_type, "tun")) + /* We pretend that the null device is also a tun device but it does not + * really matter as it will discard evertything anyway */ + if (is_dev_type(dev, dev_type, "tun") || is_dev_type(dev, dev_type, "n= ull")) { return DEV_TYPE_TUN; } @@ -476,10 +481,6 @@ { return DEV_TYPE_TAP; } - else if (is_dev_type(dev, dev_type, "null")) - { - return DEV_TYPE_NULL; - } else { return DEV_TYPE_UNDEF; @@ -497,9 +498,6 @@ case DEV_TYPE_TAP: return "tap"; - case DEV_TYPE_NULL: - return "null"; - default: return "[unknown-dev-type]"; } @@ -773,8 +771,7 @@ bool tun_p2p =3D false; if (tt->type =3D=3D DEV_TYPE_TAP - || (tt->type =3D=3D DEV_TYPE_TUN && tt->topology =3D=3D TOP_SUBNET) - || tt->type =3D=3D DEV_TYPE_NULL) + || (tt->type =3D=3D DEV_TYPE_TUN && tt->topology =3D=3D TOP_SUBNET= )) { tun_p2p =3D false; } @@ -785,7 +782,6 @@ else { msg(M_FATAL, "Error: problem with tun vs. tap setting"); /* JYFIXM= E -- needs to be caught earlier, in init_tun? */ - } return tun_p2p; } @@ -1751,7 +1747,7 @@ void undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx) { - if (tt->type !=3D DEV_TYPE_NULL) + if (tt->backend_driver !=3D DRIVER_AFUNIX && tt->backend_driver !=3D D= RIVER_NULL) { if (tt->did_ifconfig_setup) { @@ -1782,13 +1778,6 @@ #endif } -static void -open_null(struct tuntap *tt) -{ - tt->actual_name =3D string_alloc("null", NULL); -} - - #if defined (TARGET_OPENBSD) || (defined(TARGET_DARWIN) && HAVE_NET_IF_UTU= N_H) /* @@ -1904,78 +1893,72 @@ char dynamic_name[256]; bool dynamic_opened =3D false; - if (tt->type =3D=3D DEV_TYPE_NULL) + /* + * --dev-node specified, so open an explicit device node + */ + if (dev_node) { - open_null(tt); + snprintf(tunname, sizeof(tunname), "%s", dev_node); } else { /* - * --dev-node specified, so open an explicit device node + * dynamic open is indicated by --dev specified without + * explicit unit number. Try opening /dev/[dev]n + * where n =3D [0, 255]. */ - if (dev_node) + + if (!tun_name_is_fixed(dev)) { - snprintf(tunname, sizeof(tunname), "%s", dev_node); + for (int i =3D 0; i < 256; ++i) + { + snprintf(tunname, sizeof(tunname), + "/dev/%s%d", dev, i); + snprintf(dynamic_name, sizeof(dynamic_name), + "%s%d", dev, i); + if ((tt->fd =3D open(tunname, O_RDWR)) > 0) + { + dynamic_opened =3D true; + break; + } + msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)", t= unname); + } + if (!dynamic_opened) + { + msg(M_FATAL, "Cannot allocate TUN/TAP dev dynamically"); + } } + /* + * explicit unit number specified + */ else { - /* - * dynamic open is indicated by --dev specified without - * explicit unit number. Try opening /dev/[dev]n - * where n =3D [0, 255]. - */ - - if (!tun_name_is_fixed(dev)) - { - for (int i =3D 0; i < 256; ++i) - { - snprintf(tunname, sizeof(tunname), - "/dev/%s%d", dev, i); - snprintf(dynamic_name, sizeof(dynamic_name), - "%s%d", dev, i); - if ((tt->fd =3D open(tunname, O_RDWR)) > 0) - { - dynamic_opened =3D true; - break; - } - msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)= ", tunname); - } - if (!dynamic_opened) - { - msg(M_FATAL, "Cannot allocate TUN/TAP dev dynamically"= ); - } - } - /* - * explicit unit number specified - */ - else - { - snprintf(tunname, sizeof(tunname), "/dev/%s", dev); - } + snprintf(tunname, sizeof(tunname), "/dev/%s", dev); } - - if (!dynamic_opened) - { - /* has named device existed before? if so, don't destroy at en= d */ - if (if_nametoindex( dev ) > 0) - { - msg(M_INFO, "TUN/TAP device %s exists previously, keep at = program end", dev ); - tt->persistent_if =3D true; - } - - if ((tt->fd =3D open(tunname, O_RDWR)) < 0) - { - msg(M_ERR, "Cannot open TUN/TAP dev %s", tunname); - } - } - - set_nonblock(tt->fd); - set_cloexec(tt->fd); /* don't pass fd to scripts */ - msg(M_INFO, "TUN/TAP device %s opened", tunname); - - /* tt->actual_name is passed to up and down scripts and used as th= e ifconfig dev name */ - tt->actual_name =3D string_alloc(dynamic_opened ? dynamic_name : d= ev, NULL); } + + if (!dynamic_opened) + { + /* has named device existed before? if so, don't destroy at end */ + if (if_nametoindex( dev ) > 0) + { + msg(M_INFO, "TUN/TAP device %s exists previously, keep at prog= ram end", dev ); + tt->persistent_if =3D true; + } + + if ((tt->fd =3D open(tunname, O_RDWR)) < 0) + { + msg(M_ERR, "Cannot open TUN/TAP dev %s", tunname); + } + } + + set_nonblock(tt->fd); + set_cloexec(tt->fd); /* don't pass fd to scripts */ + msg(M_INFO, "TUN/TAP device %s opened", tunname); + + /* tt->actual_name is passed to up and down scripts and used as the if= config dev name */ + tt->actual_name =3D string_alloc(dynamic_opened ? dynamic_name : dev, = NULL); + } #endif /* !_WIN32 && !TARGET_LINUX && !TARGET_FREEBSD*/ @@ -1987,12 +1970,6 @@ char dynamic_name[256]; bool dynamic_opened =3D false; - if (tt->type =3D=3D DEV_TYPE_NULL) - { - open_null(tt); - return; - } - /* * unlike "open_tun_generic()", DCO on Linux and FreeBSD follows * the device naming model of "non-DCO linux", that is: @@ -2175,14 +2152,7 @@ { struct ifreq ifr; - /* - * We handle --dev null specially, we do not open /dev/null for this. - */ - if (tt->type =3D=3D DEV_TYPE_NULL) - { - open_null(tt); - } - else if (tun_dco_enabled(tt)) + if (tun_dco_enabled(tt)) { open_tun_dco_generic(dev, dev_type, tt, ctx); } @@ -2407,12 +2377,6 @@ */ CLEAR(ifr); - if (tt->type =3D=3D DEV_TYPE_NULL) - { - open_null(tt); - return; - } - if (tt->type =3D=3D DEV_TYPE_TUN) { ip_node =3D "/dev/udp"; @@ -3491,12 +3455,6 @@ char dynamic_name[20]; const char *p; - if (tt->type =3D=3D DEV_TYPE_NULL) - { - open_null(tt); - return; - } - if (tt->type =3D=3D DEV_TYPE_TUN) { msg(M_FATAL, "no support for 'tun' devices on AIX" ); @@ -6838,12 +6796,7 @@ msg( M_INFO, "open_tun"); - if (tt->type =3D=3D DEV_TYPE_NULL) - { - open_null(tt); - return; - } - else if (tt->type !=3D DEV_TYPE_TAP && tt->type !=3D DEV_TYPE_TUN) + if (tt->type !=3D DEV_TYPE_TAP && tt->type !=3D DEV_TYPE_TUN) { msg(M_FATAL|M_NOPREFIX, "Unknown virtual device type: '%s'", dev); } diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 75a4218..5287e0c 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -54,6 +54,7 @@ * this is always defined. We error out if a user tries to open this = type * on unsupported platforms*/ DRIVER_AFUNIX, + DRIVER_NULL, DRIVER_DCO, #ifdef HAVE_NET_IF_UTUN_H DRIVER_UTUN @@ -790,4 +791,10 @@ { return tt && tt->type !=3D DEV_TYPE_UNDEF; } + +static inline void +open_tun_null(struct tuntap *tt) +{ + tt->actual_name =3D string_alloc("null", NULL); +} #endif /* TUN_H */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/748?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5987ebb7c38ab176eed7efc004ea54f606a77a12 Gerrit-Change-Number: 748 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --4mxJKwFgRA4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos uploaded patch set #3 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/748?usp=3Demail">View Chang= e

Change dev null to be a driver type instead of a special mode of tun/=
tap

Change-Id: I5987ebb7c38ab176eed7efc004ea54f606a77a12
Signed-o= ff-by: Arne Schwabe <arne@...1227...>
---
M src/openvpn/init.c<= br>M src/openvpn/proto.h
M src/openvpn/tun.c
M src/openvpn/tun.h
4= files changed, 86 insertions(+), 113 deletions(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/48/748/3
diff --git=
 a/src/openvpn/init.c b/src/openvpn/init.c
index b516608..3= 78dd48 100644
--- a/src/openvpn/init.c
+++ = b/src/openvpn/init.c
@@ -1764,6 +1764,10 @@
/* Using AF_UNIX trumps using DCO */
c-&= gt;c1.tuntap->backend_driver =3D DRIVER_AFUNIX;
}
+ else if (is_dev_t= ype(c->options.dev, c->options.dev_type, "null"))+ {
+ c->c1.tuntap->backend_drive= r =3D DRIVER_NULL;
+ = }
#ifdef _WIN32
else
{

@@ -1858,7 +1862,12 @@
open_tun_= backend(struct context *c)
{
struct t= untap *tt =3D c->c1.tuntap;
- if (tt->backend_driver =3D=3D DRIVER_AFUNIX)
+
+ if (tt->backend_driver =3D=3D DRIVER_NULL)
+ {
+ open_tun_null(c->c1.tuntap= );
+ }
<= span style=3D"color: hsl(120, 100%, 40%);">+ else if (tt->backend_dri= ver =3D=3D DRIVER_AFUNIX)

{
o= pen_tun_afunix(&c->options, c->c2.frame.tun_mtu, tt, c->c2.es)= ;
}
@@ -2059,6 +2068,11 @@
<= span> {
tun_afunix_close(c->c1.tunt= ap);
}
+ else if (c->c1.tuntap->backend_driver =3D=3D DRIV= ER_NULL)
+ {
+ free(c-&g= t;c1.tuntap->actual_name);
+ free(c->c1.tuntap);
+ }
else
= {
close_tun(c->c1.tuntap, &a= mp;c->net_ctx);
diff --git a/src/openvpn/proto.h b/src/o= penvpn/proto.h
index 4b6d6d6..a160fb6 100644
--- a/src/openvpn/proto.h

+++ b/src/openvpn/proto.h

@@ -33,7 +33,6 @@
* Tunnel types
*/
#define DEV_TYPE_UNDEF 0
-#define DEV_TYPE_NULL 1
#defi= ne DEV_TYPE_TUN 2 /* point-to-point IP tunnel */
#def= ine DEV_TYPE_TAP 3 /* ethernet (802.3) tunnel */

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
<= span>index 3f5f450..c6f14c3 100644
--- a/src/openvpn/tun.c<= /span>
+++ b/src/openvpn/tun.c
@@ -78,6 +78,9 @@
case DRIVER_AFUNIX:
re= turn "unix";

+ case DRIVER_NULL:
+ return "null";
<= span style=3D"color: hsl(120, 100%, 40%);">+

#ifdef HAVE_N= ET_IF_UTUN_H
case DRIVER_UTUN:
= return "utun";
@@ -468,7 +471,9 @@
int
dev_type_enum(const char *dev, const char= *dev_type)
{
- if (is_dev_type(dev, dev_type, "tun"))
+ /* We pretend that the null d= evice is also a tun device but it does not

+ * really matter as it will discard evertything = anyway */
+ if (is= _dev_type(dev, dev_type, "tun") || is_dev_type(dev, dev_type, &qu= ot;null"))
{
return DEV_= TYPE_TUN;
}
@@ -476,10 +481,6 @@
{
return DEV_TYPE_TAP;
<= span> }

- else i= f (is_dev_type(dev, dev_type, "null"))
- {
- return DEV_TYPE_NULL;
- }
else
{
return DEV_TYPE_UNDEF;
@@ -497,9 +4= 98,6 @@
case DEV_TYPE_TAP:
= return "tap";

- case DEV_TYPE_NULL:
- return "null";=
-
de= fault:
return "[unknown-dev-type]";<= /span>
}
@@ -773,8 +771,7 @@
= bool tun_p2p =3D false;

if (tt-= >type =3D=3D DEV_TYPE_TAP
- || (tt->type =3D=3D DEV_TYPE_TUN && tt->topolo= gy =3D=3D TOP_SUBNET)
-= || tt->type =3D=3D DEV_TYPE_NULL)
+ || (tt->type =3D=3D DEV_TYPE_TUN &&= amp; tt->topology =3D=3D TOP_SUBNET))
{
<= span> tun_p2p =3D false;

}
@@ = -785,7 +782,6 @@
else
{ msg(M_FATAL, "Error: problem with tun vs. tap setting&= quot;); /* JYFIXME -- needs to be caught earlier, in init_tun? */-
}<= br> return tun_p2p;
}
@@ -1751,7= +1747,7 @@
void
undo_ifconfig(struct tun= tap *tt, openvpn_net_ctx_t *ctx)
{
- if (tt->type !=3D DEV_TYPE_NULL)
+ if (tt->backend_= driver !=3D DRIVER_AFUNIX && tt->backend_driver !=3D DRIVER_NULL= )
{
if (tt->did_ifconfig_s= etup)
{
@@ -1782,13 +1778,6 @@
#endif
}

-static void
-open_null(struct tuntap *tt)
-{
- tt->actual_name =3D string_alloc("null", NULL= );
-}
-
-
#if defined (TARGET_OPENBSD) || (defined(T= ARGET_DARWIN) && HAVE_NET_IF_UTUN_H)

/*

@@ -1904,78 +1893,72 @@
char d= ynamic_name[256];
bool dynamic_opened =3D false;

- if (t= t->type =3D=3D DEV_TYPE_NULL)
+ /*
+= * --dev-node specified, so open an explicit device node
+ */

+ if (dev_node)
{
- open_null(tt);
+ snprintf(tunname= , sizeof(tunname), "%s", dev_node);
}=
else
{
/*
- * --dev-node spec= ified, so open an explicit device node
+ * dynamic open is indicated by --dev specified = without
+ * e= xplicit unit number. Try opening /dev/[dev]n
+ * where n =3D [0, 255].
= */
- i= f (dev_node)
+=
+ if (!tun_name_is_f= ixed(dev))
{
- snprintf(tunname, sizeof(tunname), "%s&quo= t;, dev_node);
+ = for (int i =3D 0; i < 256; ++i)
+ {
+ snprintf(tunname, sizeof(tunname),+ &qu= ot;/dev/%s%d", dev, i);
+ snprintf(dynamic_name, sizeof(dynamic_name),
+ = "%s%d", dev, i);
+ if ((tt->fd =3D open(tunname, O_RDWR)) > 0)
+ {
+ dyna= mic_opened =3D true;
= + break;
+ }
+ msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (f= ailed)", tunname);
+ }
+ = if (!dynamic_opened)
+ {
+ msg(M_FATAL, "Cannot allocate TUN/TAP dev dynamic= ally");
+ = }
}
+ /*
+ * explicit unit number specified
+ */
else=
{
- = /*
- = * dynamic open is indicated by --dev specified without
- * explicit unit number. = Try opening /dev/[dev]n

- */
-
- = if (!tun_name_is_fixed(dev))
- {
- for (int i =3D 0; i < 256; ++i)
- {
- snprintf(tunname, sizeof(tu= nname),
- = "/dev/%s%d", dev, i);
- snprintf(dynamic_name, sizeof(= dynamic_name),
- = "%s%d", dev, i);
- if ((tt->fd =3D open(tunn= ame, O_RDWR)) > 0)
-= {
-= dynamic_opened =3D true;
- break;
- }
- msg(D_READ_WRITE | = M_ERRNO, "Tried opening %s (failed)", tunname);
- }
- if (!dynamic_opened)=
- {
= - msg(M_FATAL,= "Cannot allocate TUN/TAP dev dynamically");
- }
- }
- /*
- * explicit unit number specified
- */

- else
- {
- snprintf(tunname, sizeof(tunname), "= ;/dev/%s", dev);
-= }
+ = snprintf(tunname, sizeof(tunname), "/dev/%s", dev);<= br> }
-
- if (!dynamic_op= ened)
- {=
- /* has named dev= ice existed before? if so, don't destroy at end */
- if (if_nametoindex( dev ) >= 0)
- {
- msg(M_INFO= , "TUN/TAP device %s exists previously, keep at program end", dev= );
- tt= ->persistent_if =3D true;
- }
-<= /span>
- if ((tt-&g= t;fd =3D open(tunname, O_RDWR)) < 0)
- {
- msg(M_ERR, "Cannot open TUN/TAP dev %s"= , tunname);
- = }
- }-
- set_nonblock(tt->fd);
- set_cloexec(tt->fd); /* don&#= 39;t pass fd to scripts */
- msg(M_INFO, "TUN/TAP device %s opened", tunname);
-
- /* tt->actual_name is passed to = up and down scripts and used as the ifconfig dev name */
- tt->actual_name =3D string_al= loc(dynamic_opened ? dynamic_name : dev, NULL);
}
+
+ if (!dynamic_opened)
+ {
+ /* has named device existed before? if so,= don't destroy at end */
+ if (if_nametoindex( dev ) > 0)
+ {
+ msg(M_INFO, "TUN/TAP device %s exists= previously, keep at program end", dev );
+ tt->persistent_if =3D true;
+ }
+

+ if ((tt->fd =3D open(tunname, O_RDWR)) <= 0)
+ {=
+ msg(M_ERR, &qu= ot;Cannot open TUN/TAP dev %s", tunname);
+ }
+ }
+ set_nonblock= (tt->fd);
+ set= _cloexec(tt->fd); /* don't pass fd to scripts */
+ msg(M_INFO, "TUN/TAP device %s= opened", tunname);
+
+ /* tt->= actual_name is passed to up and down scripts and used as the ifconfig dev n= ame */
+ tt->ac= tual_name =3D string_alloc(dynamic_opened ? dynamic_name : dev, NULL);
+
}
#endif /* !_WIN32 && !TARGET_LINUX && !TARGET_= FREEBSD*/

@@ -1987,12 +1970,6 @@ char dynamic_name[256];
bool dynamic_open= ed =3D false;

- if (tt->type =3D=3D DEV_TYPE_NULL)
- {
- open_null(tt);
- return;
- }
-
/*
* unlike "open_tun_generic()= ", DCO on Linux and FreeBSD follows
* the device= naming model of "non-DCO linux", that is:
@@ -21= 75,14 +2152,7 @@
{
struct ifreq ifr;<= /span>

- = /*
- * We handle --= dev null specially, we do not open /dev/null for this.
- */
- if (tt->type =3D=3D DEV_TYPE_NULL)
- {

- open_null(tt);
- }
- else if (tun_dco_enabled(tt))
+ if (tun_dco_enabled(tt))
{
open_tun_dco_generic(dev, dev_type, tt, ctx);
}
@@ -2407,12 +2377,6 @@
= */
CLEAR(ifr);

- if (tt->type =3D=3D DEV_TYPE_NUL= L)
- {
- open_null(tt);

- return;

- }
-
if (tt->type =3D=3D DEV_TYPE_TU= N)
{
ip_node =3D "/dev/u= dp";
@@ -3491,12 +3455,6 @@
char = dynamic_name[20];
const char *p;

- if (tt->type =3D= =3D DEV_TYPE_NULL)
- = {
- open_null(t= t);
- return;
- }
-
if (tt->type = =3D=3D DEV_TYPE_TUN)
{
msg(M_= FATAL, "no support for 'tun' devices on AIX" );@@ -6838,12 +6796,7 @@

msg( M= _INFO, "open_tun");

- if (tt->type =3D=3D DEV_TYPE_NULL)<= br>- {
- open_null(tt);
- return;
- }
- else if (tt->type !=3D DEV_TYPE_TAP && tt->typ= e !=3D DEV_TYPE_TUN)
= + if (tt->type !=3D DEV_TYPE_TAP && tt->type !=3D DEV_TYPE= _TUN)
{
msg(M_FATAL|M_NOPREFI= X, "Unknown virtual device type: '%s'", dev);
<= span> }

diff --git a/src/openvpn/tun.h b/src/openvpn/tu= n.h
index 75a4218..5287e0c 100644
--- a/src= /openvpn/tun.h
+++ b/src/openvpn/tun.h
@@ -= 54,6 +54,7 @@
* this is always defined. We error out= if a user tries to open this type
* on unsupported = platforms*/
DRIVER_AFUNIX,
+ DRIVER_NULL,
DRIVER_DC= O,
#ifdef HAVE_NET_IF_UTUN_H
DRIVER_U= TUN
@@ -790,4 +791,10 @@
{
return tt && tt->type !=3D DEV_TYPE_UNDEF;

}

+
+static inline void

+open_tun_null(struct tuntap *tt)
+{
+ tt->actual_name =3D string_alloc(&= quot;null", NULL);
+}
#endif /* TUN_H */

=

To view, visit change 748. To unsubscribe, or for help writing mail filters,= visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5987ebb7c38ab176eed7efc004e= a54f606a77a12
Gerrit-Change-Number: 748
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newpatchset
--4mxJKwFgRA4=--