[Openvpn-devel,2/3] open_tun_generic(): Do not consider open_tun_dco() returning 0 to be an error

Message ID 20220222132824.18935-3-kprovost@netgate.com
State Not Applicable
Headers show
Series [Openvpn-devel,1/3] dco: dco_meesage_peer_id -> dco_message_peer_id | expand

Commit Message

Kristof Provost via Openvpn-devel Feb. 22, 2022, 2:28 a.m. UTC
From: Kristof Provost <kp@FreeBSD.org>

It seems clear that the intent here is to special case the EEXIST error,
not the consider anything else (i.e. 0) to also be an error.

Signed-off-by: Kristof Provost <kp@FreeBSD.org>
---
 src/openvpn/tun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index f9ba3858..d8f2dea7 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1841,7 +1841,7 @@  open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,
                         dynamic_name);
                     tt->persistent_if = true;
                 }
-                else
+                else if (ret != 0)
                 {
                     msg(M_ERR, "Cannot open TUN/TAP dev %s: %d", dynamic_name, ret);
                 }