diff options
| -rw-r--r-- | netlink.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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; |
