Skip to contentSkip to conversation

sitnl: fix TUN/TAP confusion in error messages

PATCH In review Antonio Quartulli 2 participants 2 messages Apr 18, 2020 – Apr 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sitnl: fix TUN/TAP confusion in error messages

The is_tun_p2p() function can return false for both TAP or TUN interfaces (under certain conditions), therefore we should not assume any TUN/TAP type when printing related messages.

Remove reference to TUN/TAP when printing messages under conditions based on is_tun_p2p().

---
 src/openvpn/tun.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/openvpn/tun.c +4 -4
index 79d92ea6..8e692977 100644
@@ -1093,7 +1093,7 @@ do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu,
         if (net_addr_ptp_v4_add(ctx, ifname, &tt->local,
                                 &tt->remote_netmask) < 0)
         {
-            msg(M_FATAL, "Linux can't add IP to TUN interface %s", ifname);
+            msg(M_FATAL, "Linux can't add IP to interface %s", ifname);
         }
     }
     else
@@ -1101,7 +1101,7 @@ do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu,
         if (net_addr_v4_add(ctx, ifname, &tt->local,
                             netmask_to_netbits2(tt->remote_netmask)) < 0)
         {
-            msg(M_FATAL, "Linux can't add IP to TAP interface %s", ifname);
+            msg(M_FATAL, "Linux can't add IP to interface %s", ifname);
         }
     }
 #elif defined(TARGET_ANDROID)
@@ -1970,7 +1970,7 @@ undo_ifconfig_ipv4(struct tuntap *tt, openvpn_net_ctx_t *ctx)
         if (net_addr_ptp_v4_del(ctx, tt->actual_name, &tt->local,
                                 &tt->remote_netmask) < 0)
         {
-            msg(M_WARN, "Linux can't del IP from TUN iface %s",
+            msg(M_WARN, "Linux can't del IP from iface %s",
                 tt->actual_name);
         }
     }
@@ -1978,7 +1978,7 @@ undo_ifconfig_ipv4(struct tuntap *tt, openvpn_net_ctx_t *ctx)
     {
         if (net_addr_v4_del(ctx, tt->actual_name, &tt->local, netbits) < 0)
         {
-            msg(M_WARN, "Linux can't del IP from TAP iface %s",
+            msg(M_WARN, "Linux can't del IP from iface %s",
                 tt->actual_name);
         }
     }
Signature · 1 line
2.26.1
Acked-by on v1 1/1
#1 lore raw

Yeah, "is_tun_p2p()" has always been misleading... one could argue for "can't add IP to *p2p* interface..." vs "*network* interface" (or something like that), but then, it's not really adding that much extra value. Out it goes.

Your patch has been applied to the master branch.

commit b9ff398884aa4576f2d9f75f2e2b54cd9688d122

Author: Antonio Quartulli
Date:   Sat Apr 18 03:31:23 2020 +0200
     sitnl: fix TUN/TAP confusion in error messages

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

--
kind regards,

Gert Doering