aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_util.c
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2022-01-08 15:41:53 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2022-03-28 08:49:23 +0000
commitc7655e1f3671a9ce7d963cb577b4548173469053 (patch)
tree794bc0576b3692e88d02d7bc14f95947aad61ea7 /sys/compat/linux/linux_util.c
parent0b6161db7eff92a37bc6d410ff9c9d5c3ac6f443 (diff)
linux: add sysctl to pass untranslated interface names
Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33792 (cherry picked from commit 1f70a85b4cbc3ad19cec4a390e8754e54815be85)
Diffstat (limited to 'sys/compat/linux/linux_util.c')
-rw-r--r--sys/compat/linux/linux_util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index 8e5462636705..86266fd3178f 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -52,6 +52,10 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/vnode.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_types.h>
+
#include <machine/stdarg.h>
#include <compat/linux/linux_dtrace.h>
@@ -86,6 +90,11 @@ SYSCTL_STRING(_compat_linux, OID_AUTO, emul_path, CTLFLAG_RWTUN,
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 FreeBSD interface names instead of generating ethN aliases");
+
/*
* Search an alternate path before passing pathname arguments on to
* system calls. Useful for keeping a separate 'emulation tree'.
@@ -319,3 +328,9 @@ linux_device_unregister_handler(struct linux_device_handler *d)
return (EINVAL);
}
+
+bool
+linux_use_real_ifname(const struct ifnet *ifp)
+{
+ return (use_real_ifnames || !IFP_IS_ETH(ifp));
+}