From: Tobias Brunner Date: Mon, 26 Feb 2018 14:07:15 +0000 (+0100) Subject: kernel-netlink: Ignore local routes in any table X-Git-Tag: 5.6.3dr1~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f5d6be5a026411e37c638e5aef730c7fc4f77af;p=thirdparty%2Fstrongswan.git kernel-netlink: Ignore local routes in any table Such routes seem to show up in tables other than local with recent kernels. Fixes #2555. --- diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c index ce3b9e01f2..931646a814 100644 --- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c +++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c @@ -1797,7 +1797,7 @@ static void rt_entry_destroy(rt_entry_t *this) /** * Check if the route received with RTM_NEWROUTE is usable based on its type. */ -static bool route_usable(struct nlmsghdr *hdr) +static bool route_usable(struct nlmsghdr *hdr, bool allow_local) { struct rtmsg *msg; @@ -1809,6 +1809,8 @@ static bool route_usable(struct nlmsghdr *hdr) case RTN_PROHIBIT: case RTN_THROW: return FALSE; + case RTN_LOCAL: + return allow_local; default: return TRUE; } @@ -1984,7 +1986,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest, rt_entry_t *other; uintptr_t table; - if (!route_usable(current)) + if (!route_usable(current, TRUE)) { continue; } @@ -2258,7 +2260,7 @@ METHOD(enumerator_t, enumerate_subnets, bool, { rt_entry_t route; - if (!route_usable(this->current)) + if (!route_usable(this->current, FALSE)) { break; }