Page MenuHomeFreeBSD

D33792.id101140.diff
No OneTemporary

D33792.id101140.diff

Index: sys/compat/linprocfs/linprocfs.c
===================================================================
--- sys/compat/linprocfs/linprocfs.c
+++ sys/compat/linprocfs/linprocfs.c
@@ -1412,11 +1412,6 @@
return (error);
}
-/*
- * Criteria for interface name translation
- */
-#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
-
static int
linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
{
@@ -1426,7 +1421,7 @@
IFNET_RLOCK_ASSERT();
/* Short-circuit non ethernet interfaces */
- if (!IFP_IS_ETH(ifp))
+ if (linux_use_real_ifname(ifp))
return (strlcpy(buffer, ifp->if_xname, buflen));
/* Determine the (relative) unit number for ethernet interfaces */
@@ -1434,7 +1429,7 @@
CK_STAILQ_FOREACH(ifscan, &V_ifnet, if_link) {
if (ifscan == ifp)
return (snprintf(buffer, buflen, "eth%d", ethno));
- if (IFP_IS_ETH(ifscan))
+ if (!linux_use_real_ifname(ifscan))
ethno++;
}
Index: sys/compat/linux/linux.h
===================================================================
--- sys/compat/linux/linux.h
+++ sys/compat/linux/linux.h
@@ -55,12 +55,6 @@
#define LINUX_IFHWADDRLEN 6
#define LINUX_IFNAMSIZ 16
-/*
- * Criteria for interface name translation
- */
-#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
-#define IFP_IS_LOOP(ifp) (ifp->if_type == IFT_LOOP)
-
struct l_sockaddr {
unsigned short sa_family;
char sa_data[14];
Index: sys/compat/linux/linux_ioctl.c
===================================================================
--- sys/compat/linux/linux_ioctl.c
+++ sys/compat/linux/linux_ioctl.c
@@ -2117,7 +2117,7 @@
error = ENODEV;
CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (ifr.ifr_ifindex == index) {
- if (IFP_IS_ETH(ifp))
+ if (!linux_use_real_ifname(ifp))
snprintf(ifr.ifr_name, LINUX_IFNAMSIZ,
"eth%d", ethno);
else
@@ -2126,7 +2126,7 @@
error = 0;
break;
}
- if (IFP_IS_ETH(ifp))
+ if (!linux_use_real_ifname(ifp))
ethno++;
index++;
}
Index: sys/compat/linux/linux_util.h
===================================================================
--- sys/compat/linux/linux_util.h
+++ sys/compat/linux/linux_util.h
@@ -120,6 +120,15 @@
char *linux_get_char_devices(void);
void linux_free_get_char_devices(char *string);
+/*
+ * Criteria for interface name translation
+ */
+#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
+#define IFP_IS_LOOP(ifp) (ifp->if_type == IFT_LOOP)
+
+struct ifnet;
+bool linux_use_real_ifname(const struct ifnet *ifp);
+
#if defined(KTR)
#define KTR_LINUX KTR_SUBSYS
Index: sys/compat/linux/linux_util.c
===================================================================
--- sys/compat/linux/linux_util.c
+++ sys/compat/linux/linux_util.c
@@ -50,6 +50,11 @@
#include <sys/systm.h>
#include <sys/vnode.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+
#include <machine/stdarg.h>
#include <compat/linux/linux_dtrace.h>
@@ -82,6 +87,11 @@
linux_emul_path, sizeof(linux_emul_path),
"Linux runtime environment path");
+static bool use_real_ifnames = false;
+SYSCTL_BOOL(_compat_linux, OID_AUTO, use_real_ifnames, CTLFLAG_RWTUN,
+ &use_real_ifnames, 0,
+ "Use real interface names");
+
/*
* Search an alternate path before passing pathname arguments on to
* system calls. Useful for keeping a separate 'emulation tree'.
@@ -315,3 +325,9 @@
return (EINVAL);
}
+
+bool
+linux_use_real_ifname(const struct ifnet *ifp)
+{
+ return ((use_real_ifnames) || (!IFP_IS_ETH(ifp)));
+}
Index: sys/modules/linux_common/Makefile
===================================================================
--- sys/modules/linux_common/Makefile
+++ sys/modules/linux_common/Makefile
@@ -11,6 +11,7 @@
EXPORT_SYMS+= linux_emul_path
EXPORT_SYMS+= linux_get_osname
EXPORT_SYMS+= linux_get_osrelease
+EXPORT_SYMS+= linux_use_real_ifname
.if !defined(KERNBUILDDIR)
.warning Building Linuxulator outside of a kernel does not make sense

File Metadata

Mime Type
text/plain
Expires
Sun, May 17, 9:39 PM (12 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33211218
Default Alt Text
D33792.id101140.diff (3 KB)

Event Timeline