kernel-netlink: Ignore local routes in any table

Such routes seem to show up in tables other than local with recent kernels.

Fixes #2555.
This commit is contained in:
Tobias Brunner 2018-02-26 15:07:15 +01:00
parent 9189aec666
commit 2f5d6be5a0
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}