@@ -241,15 +241,13 @@ int net_route_v6_del(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
*
* @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
@@ -257,14 +255,13 @@ int net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
*
* @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 */
@@ -325,7 +325,7 @@ net_route_v6_del(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
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';
@@ -378,7 +378,7 @@ net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
* 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)
*/
@@ -451,7 +451,7 @@ sitnl_route_save(struct nlmsghdr *n, void *arg)
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;
@@ -468,7 +468,6 @@ sitnl_route_best_gw(sa_family_t af_family, const inet_address_t *dst,
req.n.nlmsg_flags = NLM_F_REQUEST;
req.r.rtm_family = af_family;
- req.r.rtm_dst_len = prefixlen;
switch (af_family)
{
@@ -503,7 +502,7 @@ err:
/* 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];
@@ -514,11 +513,10 @@ net_route_v6_best_gw(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
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;
@@ -544,7 +542,7 @@ net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
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];
@@ -555,10 +553,10 @@ net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
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;
@@ -3172,7 +3172,7 @@ get_default_gateway(struct route_gateway_info *rgi, openvpn_net_ctx_t *ctx)
#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])
@@ -3330,7 +3330,7 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6,
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))