systemd: make predictable name mac policy opt-out

Even the patch says it's inappropriate for upstream,
and it's also inappropriate for some downstream projects, too.
So make it possible to opt-out on it by replacing
the patch by sed and depend on distro feature pni-names.

(From OE-Core rev: 858eb2bac132adbde851f6594eac4f2efc9c2f35)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Marko
2024-04-12 15:43:17 +02:00
committed by Richard Purdie
parent 7c72dc09f0
commit 0900258689
2 changed files with 11 additions and 35 deletions

View File

@@ -1,33 +0,0 @@
From 9bb09886320eb286108fb370b2634a66b3e3b9ff Mon Sep 17 00:00:00 2001
From: Joe Slater <joe.slater@windriver.com>
Date: Thu, 21 Mar 2024 16:28:31 +0000
Subject: [PATCH] systemd: enable mac based names in NamePolicy
The default NamePolicy for network interface names does not
include names based on mac addresses. Some BSPs, though, do
not provide information to compute other names, so we enable
mac names as a last resort.
Upstream-Status: Inappropriate [enable feature]
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
network/99-default.link | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/network/99-default.link b/network/99-default.link
index 429ac31e80..543ce54661 100644
--- a/network/99-default.link
+++ b/network/99-default.link
@@ -15,6 +15,6 @@
OriginalName=*
[Link]
-NamePolicy=keep kernel database onboard slot path
-AlternativeNamesPolicy=database onboard slot path
+NamePolicy=keep kernel database onboard slot path mac
+AlternativeNamesPolicy=database onboard slot path mac
MACAddressPolicy=persistent
--
2.35.5

View File

@@ -28,7 +28,6 @@ SRC_URI += " \
file://systemd-pager.sh \
file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
file://0008-implment-systemd-sysv-install-for-OE.patch \
file://0001-NamePolicy.patch \
"
# patches needed by musl
@@ -66,7 +65,7 @@ PAM_PLUGINS = " \
"
PACKAGECONFIG ??= " \
${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam pni-names selinux smack usrmerge polkit seccomp', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
@@ -197,6 +196,7 @@ PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit"
PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
PACKAGECONFIG[pstore] = "-Dpstore=true,-Dpstore=false"
PACKAGECONFIG[pni-names] = ",,,"
PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode"
PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
@@ -389,6 +389,15 @@ do_install() {
sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
${D}/${sysconfdir}/systemd/system.conf
fi
if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then
if ! grep -q '^NamePolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then
sed -i '/^NamePolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link
fi
if ! grep -q 'AlternativeNamesPolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then
sed -i '/AlternativeNamesPolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link
fi
fi
}
python populate_packages:prepend (){