diff options
| author | Marcel Moolenaar <marcel@FreeBSD.org> | 2001-12-06 09:04:24 +0000 |
|---|---|---|
| committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2001-12-06 09:04:24 +0000 |
| commit | eeee887a3f9f8a380e225dcb063e38fb69c468c4 (patch) | |
| tree | 725d60a8efe530bb977bfdaa8c76f2f316e4f597 /sys/compat/linux/linux_ioctl.c | |
| parent | 18c1802e42ae6db47550f4d4a93be990649de1a3 (diff) | |
Notes
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
| -rw-r--r-- | sys/compat/linux/linux_ioctl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index cdee4428ec39..c84838335752 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -1381,6 +1381,7 @@ ifname_linux_to_bsd(const char *lxname, char *bsdname) struct ifnet *ifp; int len, unit; char *ep; + int is_eth, index; for (len = 0; len < LINUX_IFNAMSIZ; ++len) if (!isalpha(lxname[len])) @@ -1390,13 +1391,18 @@ ifname_linux_to_bsd(const char *lxname, char *bsdname) unit = (int)strtoul(lxname + len, &ep, 10); if (ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) return (NULL); + index = 0; + is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; TAILQ_FOREACH(ifp, &ifnet, if_link) { - /* allow Linux programs to use FreeBSD names */ + /* + * Allow Linux programs to use FreeBSD names. Don't presume + * we never have an interface named "eth", so don't make + * the test optional based on is_eth. + */ if (ifp->if_unit == unit && ifp->if_name[len] == '\0' && strncmp(ifp->if_name, lxname, len) == 0) break; - if (ifp->if_index == unit && IFP_IS_ETH(ifp) && - strncmp(lxname, "eth", len) == 0) + if (is_eth && IFP_IS_ETH(ifp) && unit == index++) break; } if (ifp != NULL) |
