aboutgitcodebugslistschat
path: root/netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'netlink.c')
-rw-r--r--netlink.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/netlink.c b/netlink.c
index 37c55cc..e91507d 100644
--- a/netlink.c
+++ b/netlink.c
@@ -287,6 +287,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
struct rtmsg *rtm = (struct rtmsg *)NLMSG_DATA(nh);
const void *dst = NULL;
unsigned thisifi = 0;
+ bool via = false;
if (rtm->rtm_family != af)
continue;
@@ -302,12 +303,22 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
thisifi = rtnh->rtnh_ifindex;
} else if (rta->rta_type == RTA_DST) {
dst = RTA_DATA(rta);
+ } else if (rta->rta_type == RTA_VIA) {
+ const struct rtvia *v = RTA_DATA(rta);
+
+ via = v->rtvia_family != af;
}
}
if (!thisifi)
continue; /* No interface for this route */
+ /* Skip routes with a gateway from another address family, such
+ * as IPv4 routes via IPv6 gateways in CLAT setups.
+ */
+ if (via)
+ continue;
+
/* Skip 'lo': we should test IFF_LOOPBACK, but keep it simple */
if (thisifi == 1)
continue;