Message ID | 20220818001358.175361-1-a@unstable.cc |
---|---|
State | Changes Requested |
Headers | show |
Series | [Openvpn-devel] close_tun: print interface type consistently in message | expand |
Hi, On Thu, Aug 18, 2022 at 02:13:58AM +0200, Antonio Quartulli wrote: > 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> > --- > src/openvpn/init.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/src/openvpn/init.c b/src/openvpn/init.c > index e8335c53..92c4cab9 100644 > --- a/src/openvpn/init.c > +++ b/src/openvpn/init.c > @@ -1921,7 +1921,15 @@ do_open_tun(struct context *c) > static void > do_close_tun_simple(struct context *c) > { > - msg(D_CLOSE, "Closing TUN/TAP interface"); > + if (dco_enabled(&c->options)) > + { > + msg(D_CLOSE, "Closing DCO interface"); > + } > + else > + { > + msg(D_CLOSE, "Closing TUN/TAP interface"); > + } I find this is a bit excessive in lines of code... If we really want this, I think we should do + msg(D_CLOSE, "Closing %s interface", dco_enabled(&c->options)? "DCO": "TUN/TAP"); gert
diff --git a/src/openvpn/init.c b/src/openvpn/init.c index e8335c53..92c4cab9 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1921,7 +1921,15 @@ do_open_tun(struct context *c) static void do_close_tun_simple(struct context *c) { - msg(D_CLOSE, "Closing TUN/TAP interface"); + if (dco_enabled(&c->options)) + { + msg(D_CLOSE, "Closing DCO interface"); + } + else + { + msg(D_CLOSE, "Closing TUN/TAP interface"); + } + if (c->c1.tuntap) { close_tun(c->c1.tuntap, &c->net_ctx);
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> --- src/openvpn/init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)