[Openvpn-devel,v2] close_tun: print interface type consistently in message

Message ID 20221022205521.29406-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel,v2] close_tun: print interface type consistently in message | expand

Commit Message

Antonio Quartulli Oct. 22, 2022, 9:55 a.m. UTC
When closing the tunnel interface we know if we were using DCO or not.
for this reason we can customize the closing message and make it
consistent with the opening one.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Changes from v1:
* use termary if instead of full blown if block
 src/openvpn/init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


Gert Doering Oct. 23, 2022, 5:16 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Tested on Linux with/without --disable-dco, and the expected message
shows up.  Test compiled on FreeBSD (without DCO) and nothing breaks.

Your patch has been applied to the master branch.

commit 77829be280b3b280f35d1ca4947900f3c5e5dd26
Author: Antonio Quartulli
Date:   Sat Oct 22 22:55:21 2022 +0200

     close_tun: print interface type consistently in message

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20221022205521.29406-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25449.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index c48048a1..01d6dab5 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -1946,7 +1946,9 @@  do_open_tun(struct context *c)
 static void
 do_close_tun_simple(struct context *c)
-    msg(D_CLOSE, "Closing TUN/TAP interface");
+    msg(D_CLOSE, "Closing %s interface",
+        dco_enabled(&c->options) ? "DCO": "TUN/TAP");
     if (c->c1.tuntap)
         if (!c->options.ifconfig_noexec)