aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2026-07-07 21:19:17 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2026-07-07 21:19:17 +0000
commit11bd6ade5dfdfb5160dd001542c4cfd44aed98bc (patch)
treea2336ddb1ce51834d3192ff240784a59a52c7b51
parent6cfc526e7f91534db46a3cff3c2dd2744310e24f (diff)
linux: switch off interface name translation and schedule its removal
Modern Linuxes don't use ethX for almost 15 years already, see [1] and [2]. The translation logic has always been a source of bugs and PITA. Switch default to not translate (long due!) and schedule removal of the code for FreeBSD 17. [1] https://systemd.io/PREDICTABLE_INTERFACE_NAMES/ [2] https://www.freedesktop.org/software/systemd/man/latest/systemd.net-naming-scheme.html Reviewed by: iwtcex_gmail.com, vvd, melifaro, dchagin Differential Revision: https://reviews.freebsd.org/D57852
-rw-r--r--sys/compat/linux/linux_if.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_if.c b/sys/compat/linux/linux_if.c
index ca4e3a4079ed..51a76aa13be3 100644
--- a/sys/compat/linux/linux_if.c
+++ b/sys/compat/linux/linux_if.c
@@ -44,9 +44,24 @@
_Static_assert(LINUX_IFNAMSIZ == IFNAMSIZ, "Linux IFNAMSIZ");
-static bool use_real_ifnames = false;
-SYSCTL_BOOL(_compat_linux, OID_AUTO, use_real_ifnames, CTLFLAG_RWTUN,
- &use_real_ifnames, 0,
+static bool use_real_ifnames = true;
+static int
+sysctl_linux_use_real_ifnames(SYSCTL_HANDLER_ARGS)
+{
+ int error;
+
+ error = sysctl_handle_bool(oidp, &use_real_ifnames, arg2, req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ if (!use_real_ifnames)
+ gone_in(17, "linux(4): %s: conversion of native interface "
+ "names to ethN is not needed to emulate modern Linux. "
+ "See https://systemd.io/PREDICTABLE_INTERFACE_NAMES. ",
+ oidp->oid_name);
+ return (0);
+}
+SYSCTL_PROC(_compat_linux, OID_AUTO, use_real_ifnames,
+ CTLTYPE_U8 | CTLFLAG_RWTUN, 0, 0, sysctl_linux_use_real_ifnames, "CU",
"Use FreeBSD interface names instead of generating ethN aliases");
VNET_DEFINE_STATIC(struct unrhdr *, linux_eth_unr);