}
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;
{
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;
#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)
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);
}
METHOD(kernel_interface_t, get_nexthop, host_t*,
- private_kernel_interface_t *this, host_t *dest, host_t *src)
+ private_kernel_interface_t *this, host_t *dest, int prefix, host_t *src)
{
if (!this->net)
{
return NULL;
}
- return this->net->get_nexthop(this->net, dest, src);
+ return this->net->get_nexthop(this->net, dest, prefix, src);
}
METHOD(kernel_interface_t, get_interface, bool,
* for the given source to dest.
*
* @param dest target destination address
+ * @param prefix prefix length if dest is a subnet, -1 for auto
+ * @param src source address to check, or NULL
* @return next hop address, NULL if unreachable
*/
- host_t* (*get_nexthop)(kernel_interface_t *this, host_t *dest, host_t *src);
+ host_t* (*get_nexthop)(kernel_interface_t *this, host_t *dest,
+ int prefix, host_t *src);
/**
* Get the interface name of a local address. Interfaces that are down or
* for the given source to dest.
*
* @param dest target destination address
+ * @param prefix prefix length if dest is a subnet, -1 for auto
* @param src source address to check, or NULL
* @return next hop address, NULL if unreachable
*/
- host_t* (*get_nexthop)(kernel_net_t *this, host_t *dest, host_t *src);
+ host_t* (*get_nexthop)(kernel_net_t *this, host_t *dest, int prefix,
+ host_t *src);
/**
* Get the interface name of a local address. Interfaces that are down or
/* get the nexthop to src (src as we are in POLICY_FWD) */
route->gateway = hydra->kernel_interface->get_nexthop(
hydra->kernel_interface, ipsec->src,
- ipsec->dst);
+ -1, ipsec->dst);
route->dst_net = chunk_alloc(policy->sel.family == AF_INET ? 4 : 16);
memcpy(route->dst_net.ptr, &policy->sel.saddr, route->dst_net.len);
}
METHOD(kernel_net_t, get_nexthop, host_t*,
- private_kernel_netlink_net_t *this, host_t *dest, host_t *src)
+ private_kernel_netlink_net_t *this, host_t *dest, int prefix, host_t *src)
{
return get_route(this, dest, TRUE, src, 0);
}
{
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;
.prefixlen = policy->src.mask,
.src_ip = host,
.gateway = hydra->kernel_interface->get_nexthop(
- hydra->kernel_interface, dst, src),
+ hydra->kernel_interface, dst, -1, src),
.dst_net = chunk_clone(policy->src.net->get_address(policy->src.net)),
);
}
METHOD(kernel_net_t, get_nexthop, host_t*,
- private_kernel_pfroute_net_t *this, host_t *dest, host_t *src)
+ private_kernel_pfroute_net_t *this, host_t *dest, int prefix, host_t *src)
{
return get_route(this, TRUE, dest, src);
}