]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
route: improve error message
authorAntonio Quartulli <a@unstable.cc>
Thu, 20 Jul 2017 08:23:38 +0000 (16:23 +0800)
committerGert Doering <gert@greenie.muc.de>
Thu, 20 Jul 2017 20:44:47 +0000 (22:44 +0200)
- 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 <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>
src/openvpn/route.c

index a1811f41dfddb8afaa782ee3832c203d3c2de748..a8a4c66deaa5d1b8d7dacb8762c88bb032aab854 100644 (file)
@@ -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;
         }