From: "plaisthos (Code Review)" Date: Mon, 16 Sep 2024 13:04:07 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="B6krI/TGAeA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Use print_tun_backend_driver instead of custom code to print type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --B6krI/TGAeA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/749?usp=3Demail to review the following change. Change subject: Use print_tun_backend_driver instead of custom code to prin= t type ...................................................................... Use print_tun_backend_driver instead of custom code to print type Also show the device type that we opened always instead of certain conditions only. Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1 Signed-off-by: Arne Schwabe --- M src/openvpn/init.c M src/openvpn/tun.c M src/openvpn/tun.h 3 files changed, 8 insertions(+), 5 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/749/1 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 30ebf28..8d37a7f 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1876,6 +1876,7 @@ open_tun(c->options.dev, c->options.dev_type, c->options.dev_node, tt, &c->net_ctx); } + msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->back= end_driver), tt->actual_name); } @@ -2056,7 +2057,7 @@ do_close_tun_simple(struct context *c) { msg(D_CLOSE, "Closing %s interface", - dco_enabled(&c->options) ? "DCO" : "TUN/TAP"); + print_tun_backend_driver(c->c1.tuntap->backend_driver)); if (c->c1.tuntap) { diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 8f30c41..cef54d0 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -6680,7 +6680,6 @@ * GUID using the registry */ tt->actual_name =3D string_alloc((const char *)actual_buffer, NULL); - msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->back= end_driver), tt->actual_name); tt->adapter_index =3D get_adapter_index(*device_guid); } diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 5287e0c..c52fd22 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -363,6 +363,12 @@ void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx); +/** + * Return a string representation of the tun backed driver type + */ +const char * +print_tun_backend_driver(enum tun_driver_type driver); + /* * Should ifconfig be called before or after * tun dev open? @@ -695,9 +701,6 @@ return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() =3D= =3D ERROR_NETNAME_DELETED); } -const char * -print_tun_backend_driver(enum tun_driver_type driver); - #else /* ifdef _WIN32 */ static inline bool -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/749?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: Ib8f12516dbe294e21d3fed77478fb7660d4600c1 Gerrit-Change-Number: 749 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --B6krI/TGAeA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

Use print_tun_backend_driver instead of custom code to print =
type

Also show the device type that we opened always instead of cert= ain
conditions only.

Change-Id: Ib8f12516dbe294e21d3fed77478fb766= 0d4600c1
Signed-off-by: Arne Schwabe <arne@...1227...>
---
M= src/openvpn/init.c
M src/openvpn/tun.c
M src/openvpn/tun.h
3 file= s changed, 8 insertions(+), 5 deletions(-)

git pull ssh://gerrit.=
openvpn.net:29418/openvpn refs/changes/49/749/1
diff --git a/src/op=
envpn/init.c b/src/openvpn/init.c
index 30ebf28..8d37a7f 10= 0644
--- a/src/openvpn/init.c
+++ b/src/ope= nvpn/init.c
@@ -1876,6 +1876,7 @@
= open_tun(c->options.dev, c->options.dev_type, c->options.dev_node,=
tt, &c->net_ctx);
}
+ msg(M_IN= FO, "%s device [%s] opened", print_tun_backend_driver(tt->back= end_driver), tt->actual_name);
}


@@ -2056,7 +2057,7 @@
do_clo= se_tun_simple(struct context *c)
{
ms= g(D_CLOSE, "Closing %s interface",
- dco_enabled(&c->options) ? "DCO&= quot; : "TUN/TAP");
+ print_tun_backend_driver(c->c1.tuntap->backend_driv= er));

if (c->c1.tuntap) {
diff --git a/src/openvpn/tun.c b/src/openvpn/= tun.c
index 8f30c41..cef54d0 100644
--- a/s= rc/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@= -6680,7 +6680,6 @@
* GUID using the registry */
tt->actual_name =3D string_alloc((const char *)actual_b= uffer, NULL);

- msg(M_INFO, "%s device [%s] opened", print_tun_back= end_driver(tt->backend_driver), tt->actual_name);
= tt->adapter_index =3D get_adapter_index(*device_guid);
}


diff --git a/src/openvpn/tun.h b/src/= openvpn/tun.h
index 5287e0c..c52fd22 100644
--- a/src/openvpn/tun.h

+++ b/src/openvpn/tun.h
= @@ -363,6 +363,12 @@

void warn_on_= use_of_common_subnets(openvpn_net_ctx_t *ctx);

= +/**
+ * Return a string representation of the tun b= acked driver type
+ *= /
+const char *

+print_tun_backend_driver(= enum tun_driver_type driver);
+
/*
* Should ifconfig be calle= d before or after
* tun dev open?
@@ -695= ,9 +701,6 @@
return tuntap_is_dco_win(tt) && (= status < 0) && (openvpn_errno() =3D=3D ERROR_NETNAME_DELETED);
}

-const char *
-print_tun_backend_driver(enum tun_driver_type driver);
-

#else /* ifdef _WI= N32 */

static inline bool

To view, visit change 749. To unsubscribe, or for help wri= ting mail filters, visit set= tings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f12516dbe294e21d3fed77478= fb7660d4600c1
Gerrit-Change-Number: 749
Gerrit-PatchSet: 1
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: newchange
--B6krI/TGAeA=--