From: Antonio Quartulli
Date: Thu, 20 Jul 2017 08:23:38 +0000 (+0800)
Subject: route: improve error message
X-Git-Tag: v2.5_beta1~634
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=20d98427ef37e3b748dbcca2174cd243dcc963dc;p=thirdparty%2Fopenvpn.git
route: improve error message
- fix typ0 in message: NLSMG -> NLMSG
- use strerror() to print a human readable message
- don't print error message if error is ENETUNREACH: it means no route
found
Signed-off-by: Antonio Quartulli
Acked-by: Gert Doering
Message-Id: <20170720082338.1302-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15101.html
Signed-off-by: Gert Doering
---
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index a1811f41d..a8a4c66de 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -3441,7 +3441,14 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6,
if (nh->nlmsg_type == NLMSG_ERROR)
{
struct nlmsgerr *ne = (struct nlmsgerr *)NLMSG_DATA(nh);
- msg(M_WARN, "GDG6: NLSMG_ERROR: error %d\n", ne->error);
+
+ /* since linux-4.11 -ENETUNREACH is returned when no route can be
+ * found. Don't print any error message in this case */
+ if (ne->error != -ENETUNREACH)
+ {
+ msg(M_WARN, "GDG6: NLMSG_ERROR: error %s\n",
+ strerror(-ne->error));
+ }
break;
}