Check routes with equal prefix if preferred source is specified

This commit is contained in:
Tobias Brunner 2011-09-30 17:41:01 +02:00
parent 9d6b02d6c1
commit cef0a8118e
1 changed files with 4 additions and 2 deletions

View File

@ -1236,8 +1236,10 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
}
rta = RTA_NEXT(rta, rtasize);
}
if (msg->rtm_dst_len <= best)
{ /* not better than a previous one */
if (msg->rtm_dst_len < best ||
msg->rtm_dst_len == best && (nexthop || !candidate))
{ /* not better than a previous one, but if a preferred source
* address is specified, we still check equal routes */
continue;
}
enumerator = this->rt_exclude->create_enumerator(this->rt_exclude);