kernel-pfkey: Use address in TS to determine interface for shunt routes

This commit is contained in:
Tobias Brunner
2014-06-26 18:13:17 +02:00
parent 60f5fb2318
commit f22add05f6
@@ -2230,13 +2230,6 @@ static bool install_route(private_kernel_pfkey_ipsec_t *this,
{ {
route->gateway = hydra->kernel_interface->get_nexthop( route->gateway = hydra->kernel_interface->get_nexthop(
hydra->kernel_interface, dst, -1, src); hydra->kernel_interface, dst, -1, src);
}
else
{ /* for shunt policies */
route->gateway = hydra->kernel_interface->get_nexthop(
hydra->kernel_interface, policy->src.net,
policy->src.mask, route->src_ip);
}
/* if the IP is virtual, we install the route over the interface it has /* if the IP is virtual, we install the route over the interface it has
* been installed on. Otherwise we use the interface we use for IKE, as * been installed on. Otherwise we use the interface we use for IKE, as
@@ -2245,6 +2238,16 @@ static bool install_route(private_kernel_pfkey_ipsec_t *this,
{ {
src = route->src_ip; src = route->src_ip;
} }
}
else
{ /* for shunt policies */
route->gateway = hydra->kernel_interface->get_nexthop(
hydra->kernel_interface, policy->src.net,
policy->src.mask, route->src_ip);
/* we don't have a source address, use the address we found */
src = route->src_ip;
}
/* get interface for route, using source address */ /* get interface for route, using source address */
if (!hydra->kernel_interface->get_interface(hydra->kernel_interface, if (!hydra->kernel_interface->get_interface(hydra->kernel_interface,