include default route also in src address evaluation

This commit is contained in:
Andreas Steffen
2007-07-13 09:00:39 +00:00
parent 018219ae3a
commit db61efdbbb
+4 -4
View File
@@ -1530,8 +1530,9 @@ static host_t *get_route(private_kernel_interface_t *this, host_t *dest,
/* apply the route if: /* apply the route if:
* - it is not from our own ipsec routing table * - it is not from our own ipsec routing table
* - its destination net contains our destination
* - is better than a previous one * - is better than a previous one
* - is the default route or
* - its destination net contains our destination
*/ */
if (msg->rtm_table != IPSEC_ROUTING_TABLE if (msg->rtm_table != IPSEC_ROUTING_TABLE
&& msg->rtm_dst_len > best && msg->rtm_dst_len > best
@@ -1567,12 +1568,11 @@ static host_t *get_route(private_kernel_interface_t *this, host_t *dest,
while (addrs->iterate(addrs, (void**)&addr)) while (addrs->iterate(addrs, (void**)&addr))
{ {
chunk_t ip = addr->ip->get_address(addr->ip); chunk_t ip = addr->ip->get_address(addr->ip);
if (rta_dst.ptr if (msg->rtm_dst_len == 0
&& addr_in_subnet(ip, rta_dst, msg->rtm_dst_len)) || addr_in_subnet(ip, rta_dst, msg->rtm_dst_len))
{ {
DESTROY_IF(src); DESTROY_IF(src);
src = addr->ip->clone(addr->ip); src = addr->ip->clone(addr->ip);
best = msg->rtm_dst_len;
break; break;
} }
} }