Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147430570
D20141.id56961.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D20141.id56961.diff
View Options
Index: sys/compat/linux/linux.c
===================================================================
--- sys/compat/linux/linux.c
+++ sys/compat/linux/linux.c
@@ -227,18 +227,23 @@
struct ifnet *ifp;
int len, unit;
char *ep;
- int is_eth, index;
+ int index;
+ bool is_eth, is_lo;
for (len = 0; len < LINUX_IFNAMSIZ; ++len)
- if (!isalpha(lxname[len]))
+ if (isalpha(lxname[len]) == 0 || lxname[len] == 0)
break;
if (len == 0 || len == LINUX_IFNAMSIZ)
return (NULL);
+ /* Linux loopback interface name is lo (not lo0) */
+ is_lo = (len == 2 && strncmp(lxname, "lo", len) == 0) ? 1 : 0;
unit = (int)strtoul(lxname + len, &ep, 10);
- if (ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ)
+ if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) &&
+ is_lo == 0)
return (NULL);
index = 0;
- is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0;
+ is_eth = (len == 3 && strncmp(lxname, "eth", len) == 0) ? 1 : 0;
+
CURVNET_SET(TD_TO_VNET(td));
IFNET_RLOCK();
CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
@@ -251,10 +256,12 @@
break;
if (is_eth && IFP_IS_ETH(ifp) && unit == index++)
break;
+ if (is_lo && IFP_IS_LOOP(ifp))
+ break;
}
IFNET_RUNLOCK();
CURVNET_RESTORE();
- if (ifp != NULL)
+ if (ifp != NULL && bsdname != NULL)
strlcpy(bsdname, ifp->if_xname, IFNAMSIZ);
return (ifp);
}
@@ -302,6 +309,3 @@
return (ENOENT);
}
-
-
-
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 11, 10:38 PM (1 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29554066
Default Alt Text
D20141.id56961.diff (1 KB)
Attached To
Mode
D20141: Modify ifname_linux_to_bsd() to properly work with Linux loopback interface
Attached
Detach File
Event Timeline
Log In to Comment