summaryrefslogtreecommitdiff
path: root/src/openvpn/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/route.c')
-rw-r--r--src/openvpn/route.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index a1811f4..8c71e6e 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -518,14 +518,14 @@ add_route_ipv6_to_option_list(struct route_ipv6_option_list *l,
l->routes_ipv6 = ro;
}
-void
+static void
clear_route_list(struct route_list *rl)
{
gc_free(&rl->gc);
CLEAR(*rl);
}
-void
+static void
clear_route_ipv6_list(struct route_ipv6_list *rl6)
{
gc_free(&rl6->gc);
@@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,
struct gc_arena gc;
struct argv argv = argv_new();
const char *network;
+#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)
const char *netmask;
+#endif
const char *gateway;
bool status = false;
int is_local_route;
@@ -1543,7 +1545,9 @@ add_route(struct route_ipv4 *r,
gc_init(&gc);
network = print_in_addr_t(r->network, 0, &gc);
+#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)
netmask = print_in_addr_t(r->netmask, 0, &gc);
+#endif
gateway = print_in_addr_t(r->gateway, 0, &gc);
is_local_route = local_route(r->network, r->netmask, r->gateway, rgi);
@@ -2132,8 +2136,12 @@ delete_route(struct route_ipv4 *r,
struct gc_arena gc;
struct argv argv = argv_new();
const char *network;
+#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)
const char *netmask;
+#endif
+#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
const char *gateway;
+#endif
int is_local_route;
if ((r->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
@@ -2144,8 +2152,12 @@ delete_route(struct route_ipv4 *r,
gc_init(&gc);
network = print_in_addr_t(r->network, 0, &gc);
+#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)
netmask = print_in_addr_t(r->netmask, 0, &gc);
+#endif
+#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
gateway = print_in_addr_t(r->gateway, 0, &gc);
+#endif
is_local_route = local_route(r->network, r->netmask, r->gateway, rgi);
if (is_local_route == LR_ERROR)
@@ -3441,7 +3453,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;
}