kernel-interface: Add destination prefix to get_nexthop()
This allows to determine the next hop to reach a subnet, for instance, when installing routes for shunt policies.
This commit is contained in:
@@ -562,7 +562,7 @@ METHOD(kernel_net_t, get_source_addr, host_t*,
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, get_nexthop, host_t*,
|
||||
private_kernel_iph_net_t *this, host_t *dest, host_t *src)
|
||||
private_kernel_iph_net_t *this, host_t *dest, int prefix, host_t *src)
|
||||
{
|
||||
MIB_IPFORWARD_ROW2 route;
|
||||
SOCKADDR_INET best, *sai_dst, *sai_src = NULL;
|
||||
|
||||
@@ -314,7 +314,7 @@ static void add_exclude_route(private_kernel_libipsec_ipsec_t *this,
|
||||
{
|
||||
DBG2(DBG_KNL, "installing new exclude route for %H src %H", dst, src);
|
||||
gtw = hydra->kernel_interface->get_nexthop(hydra->kernel_interface,
|
||||
dst, NULL);
|
||||
dst, -1, NULL);
|
||||
if (gtw)
|
||||
{
|
||||
char *if_name = NULL;
|
||||
@@ -445,7 +445,7 @@ static bool install_route(private_kernel_libipsec_ipsec_t *this,
|
||||
#ifndef __linux__
|
||||
/* on Linux we cant't install a gateway */
|
||||
route->gateway = hydra->kernel_interface->get_nexthop(
|
||||
hydra->kernel_interface, dst, src);
|
||||
hydra->kernel_interface, dst, -1, src);
|
||||
#endif
|
||||
|
||||
if (policy->route)
|
||||
|
||||
@@ -1348,7 +1348,7 @@ static bool manage_route(private_kernel_wfp_ipsec_t *this,
|
||||
return FALSE;
|
||||
}
|
||||
gtw = hydra->kernel_interface->get_nexthop(hydra->kernel_interface,
|
||||
remote, local);
|
||||
remote, -1, local);
|
||||
if (add)
|
||||
{
|
||||
done = install_route(this, dst, mask, src, gtw);
|
||||
|
||||
Reference in New Issue
Block a user