]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Use print_tun_backend_driver instead of custom code to print type
authorArne Schwabe <arne@rfc2549.org>
Tue, 24 Sep 2024 12:55:13 +0000 (14:55 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 24 Sep 2024 13:11:41 +0000 (15:11 +0200)
Also show the device type that we opened always instead of certain
conditions only.

Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20240924125513.10710-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29386.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c
src/openvpn/tun.c
src/openvpn/tun.h

index fbf2c5b3b0ec563821110084963c06b24c89715c..cd9203a7e343d50ef3f33e9d1204e26d14ea7909 100644 (file)
@@ -1876,6 +1876,7 @@ open_tun_backend(struct context *c)
         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 @@ static void
 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)
     {
index 770e8064ec9a222c03d75e2e9f19644c6b30fd12..206ddc086cfdfc084de980f186dd7589045ca71b 100644 (file)
@@ -6678,7 +6678,6 @@ next:
      * 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);
 }
 
index b2c1b01335c8a2e7f4fb4b3d15442256bd37a57f..329cd1054d0606d3b9582e3613d7cfa63101e031 100644 (file)
@@ -361,6 +361,12 @@ void check_subnet_conflict(const in_addr_t ip,
 
 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 @@ tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
     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