Skip to contentSkip to conversation

Change in openvpn[master]: Use print_tun_backend_driver instead of custom code to print type

Openvpn-devel In review plaisthos (Code Review) 2 participants 7 messages Sep 16, 2024 – Sep 24, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1726491830000.Ib8f12516dbe294e21d3fed77478fb7660d4600c1@...2715...

#1 lore raw

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=email

to review the following change.

Change subject: Use print_tun_backend_driver instead of custom code to print 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

---
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

src/openvpn/init.c +2 -1
index 30ebf28..8d37a7f 100644
@@ -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->backend_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)
     {
src/openvpn/tun.c +0 -1
index 8f30c41..cef54d0 100644
@@ -6680,7 +6680,6 @@
      * GUID using the registry */
     tt->actual_name = string_alloc((const char *)actual_buffer, NULL);
 
-    msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
     tt->adapter_index = get_adapter_index(*device_guid);
 }
 
src/openvpn/tun.h +6 -3
index 5287e0c..c52fd22 100644
@@ -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() == 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Gerrit-Change-Number: 749
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/749?usp=email )

Change subject: Use print_tun_backend_driver instead of custom code to print type
......................................................................

Patch Set 10: Code-Review+2

(1 comment)

Patchset:

PS10:
Looks good to me. Does not apply yet.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/749?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Gerrit-Change-Number: 749
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Sep 2024 06:18:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello cron2, flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/749?usp=email

to look at the new patch set (#11).

The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.

Change subject: Use print_tun_backend_driver instead of custom code to print 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

---
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/11

src/openvpn/init.c +2 -1
index fbf2c5b..cd9203a 100644
@@ -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->backend_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)
     {
src/openvpn/tun.c +0 -1
index 770e806..206ddc0 100644
@@ -6678,7 +6678,6 @@
      * GUID using the registry */
     tt->actual_name = string_alloc((const char *)actual_buffer, NULL);
 
-    msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
     tt->adapter_index = get_adapter_index(*device_guid);
 }
 
src/openvpn/tun.h +6 -3
index b2c1b01..329cd10 100644
@@ -361,6 +361,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?
@@ -689,9 +695,6 @@
     return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() == 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Gerrit-Change-Number: 749
Gerrit-PatchSet: 11
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#4 lore raw

PATCH v11 1/1 Use print_tun_backend_driver instead of custom code to print type

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

Also show the device type that we opened always instead of certain conditions only.

Change-Id Ib8f12516dbe294e21d3fed77478fb7660d4600c1

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/749
This mail reflects revision 11 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/init.c +2 -1
index fbf2c5b..cd9203a 100644
@@ -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->backend_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)
     {
src/openvpn/tun.c +0 -1
index 770e806..206ddc0 100644
@@ -6678,7 +6678,6 @@
      * GUID using the registry */
     tt->actual_name = string_alloc((const char *)actual_buffer, NULL);
 
-    msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
     tt->adapter_index = get_adapter_index(*device_guid);
 }
 
src/openvpn/tun.h +6 -3
index b2c1b01..329cd10 100644
@@ -361,6 +361,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?
@@ -689,9 +695,6 @@
     return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() == ERROR_NETNAME_DELETED);
 }
 
-const char *
-print_tun_backend_driver(enum tun_driver_type driver);
-
 #else  /* ifdef _WIN32 */
 
 static inline bool
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Use print_tun_backend_driver instead of custom code to print type

Straight forward code simplification and generalization.

Your patch has been applied to the master branch.

commit 193b4f9dd0b09379c0f8f2be0613a1405bbdac8a

Author: Arne Schwabe
Date:   Tue Sep 24 14:55:13 2024 +0200
     Use print_tun_backend_driver instead of custom code to print type

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

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#12) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/749?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: Use print_tun_backend_driver instead of custom code to print 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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29386.html

---
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/12

src/openvpn/init.c +2 -1
index fbf2c5b..cd9203a 100644
@@ -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->backend_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)
     {
src/openvpn/tun.c +0 -1
index 770e806..206ddc0 100644
@@ -6678,7 +6678,6 @@
      * GUID using the registry */
     tt->actual_name = string_alloc((const char *)actual_buffer, NULL);
 
-    msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
     tt->adapter_index = get_adapter_index(*device_guid);
 }
 
src/openvpn/tun.h +6 -3
index b2c1b01..329cd10 100644
@@ -361,6 +361,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?
@@ -689,9 +695,6 @@
     return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() == 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Gerrit-Change-Number: 749
Gerrit-PatchSet: 12
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/749?usp=email )

Change subject: Use print_tun_backend_driver instead of custom code to print 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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29386.html

---
M src/openvpn/init.c
M src/openvpn/tun.c
M src/openvpn/tun.h

3 files changed, 8 insertions(+), 5 deletions(-)
src/openvpn/init.c +2 -1
index fbf2c5b..cd9203a 100644
@@ -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->backend_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)
     {
src/openvpn/tun.c +0 -1
index 770e806..206ddc0 100644
@@ -6678,7 +6678,6 @@
      * GUID using the registry */
     tt->actual_name = string_alloc((const char *)actual_buffer, NULL);
 
-    msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
     tt->adapter_index = get_adapter_index(*device_guid);
 }
 
src/openvpn/tun.h +6 -3
index b2c1b01..329cd10 100644
@@ -361,6 +361,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?
@@ -689,9 +695,6 @@
     return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() == 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Gerrit-Change-Number: 749
Gerrit-PatchSet: 12
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged