*
* @param ctx the implementation specific context
* @param dst The destination to lookup
- * @param prefixlen The length of the prefix of the destination
* @param best_gw Location where the retrieved GW has to be stored
* @param best_iface Location where the retrieved interface has to be stored
*
* @return 0 on success, a negative error code otherwise
*/
int net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
- int prefixlen, in_addr_t *best_gw,
- openvpn_net_iface_t *best_iface);
+ in_addr_t *best_gw, openvpn_net_iface_t *best_iface);
/**
* Retrieve the gateway and outgoing interface for the specified IPv6
*
* @param ctx the implementation specific context
* @param dst The destination to lookup
- * @param prefixlen The length of the prefix of the destination
* @param best_gw Location where the retrieved GW has to be stored
* @param best_iface Location where the retrieved interface has to be stored
*
* @return 0 on success, a negative error code otherwise
*/
int net_route_v6_best_gw(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
- int prefixlen, struct in6_addr *best_gw,
+ struct in6_addr *best_gw,
openvpn_net_iface_t *best_iface);
#endif /* ENABLE_SITNL || ENABLE_IPROUTE */
int
net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
- int prefixlen, in_addr_t *best_gw, char *best_iface)
+ in_addr_t *best_gw, char *best_iface)
{
best_iface[0] = '\0';
* uses the sitnl implementation from networking_sitnl.c.
*
* int
- * net_route_v6_best_gw(const struct in6_addr *dst, int prefixlen,
+ * net_route_v6_best_gw(const struct in6_addr *dst,
* struct in6_addr *best_gw, char *best_iface)
*/
static int
sitnl_route_best_gw(sa_family_t af_family, const inet_address_t *dst,
- int prefixlen, void *best_gw, char *best_iface)
+ void *best_gw, char *best_iface)
{
struct sitnl_route_req req;
route_res_t res;
req.n.nlmsg_flags = NLM_F_REQUEST;
req.r.rtm_family = af_family;
- req.r.rtm_dst_len = prefixlen;
switch (af_family)
{
/* used by iproute2 implementation too */
int
net_route_v6_best_gw(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
- int prefixlen, struct in6_addr *best_gw, char *best_iface)
+ struct in6_addr *best_gw, char *best_iface)
{
inet_address_t dst_v6 = {0};
char buf[INET6_ADDRSTRLEN];
dst_v6.ipv6 = *dst;
}
- msg(D_ROUTE, "%s query: dst %s/%d", __func__,
- inet_ntop(AF_INET6, &dst_v6.ipv6, buf, sizeof(buf)), prefixlen);
+ msg(D_ROUTE, "%s query: dst %s", __func__,
+ inet_ntop(AF_INET6, &dst_v6.ipv6, buf, sizeof(buf)));
- ret = sitnl_route_best_gw(AF_INET6, &dst_v6, prefixlen, best_gw,
- best_iface);
+ ret = sitnl_route_best_gw(AF_INET6, &dst_v6, best_gw, best_iface);
if (ret < 0)
{
return ret;
int
net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
- int prefixlen, in_addr_t *best_gw, char *best_iface)
+ in_addr_t *best_gw, char *best_iface)
{
inet_address_t dst_v4 = {0};
char buf[INET_ADDRSTRLEN];
dst_v4.ipv4 = htonl(*dst);
}
- msg(D_ROUTE, "%s query: dst %s/%d", __func__,
- inet_ntop(AF_INET, &dst_v4.ipv4, buf, sizeof(buf)), prefixlen);
+ msg(D_ROUTE, "%s query: dst %s", __func__,
+ inet_ntop(AF_INET, &dst_v4.ipv4, buf, sizeof(buf)));
- ret = sitnl_route_best_gw(AF_INET, &dst_v4, prefixlen, best_gw, best_iface);
+ ret = sitnl_route_best_gw(AF_INET, &dst_v4, best_gw, best_iface);
if (ret < 0)
{
return ret;
#ifndef TARGET_ANDROID
/* get default gateway IP addr */
- if (net_route_v4_best_gw(ctx, NULL, 0, &rgi->gateway.addr, best_name) == 0)
+ if (net_route_v4_best_gw(ctx, NULL, &rgi->gateway.addr, best_name) == 0)
{
rgi->flags |= RGI_ADDR_DEFINED;
if (!rgi->gateway.addr && best_name[0])
CLEAR(*rgi6);
- if (net_route_v6_best_gw(ctx, dest, 0, &rgi6->gateway.addr_ipv6,
+ if (net_route_v6_best_gw(ctx, dest, &rgi6->gateway.addr_ipv6,
rgi6->iface) == 0)
{
if (!IN6_IS_ADDR_UNSPECIFIED(rgi6->gateway.addr_ipv6.s6_addr))