summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2024-04-12 15:43:17 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-04-14 06:25:47 +0100
commit858eb2bac132adbde851f6594eac4f2efc9c2f35 (patch)
treea688ddbfe0f91504e83a3ecc8aae439e58986ec0 /meta/recipes-core
parent3f2b5f6c3af04c8ec245aca35224c52230645bf0 (diff)
downloadopenembedded-core-858eb2bac132adbde851f6594eac4f2efc9c2f35.tar.gz
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. Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/systemd/systemd/0001-NamePolicy.patch33
-rw-r--r--meta/recipes-core/systemd/systemd_255.4.bb13
2 files changed, 11 insertions, 35 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-NamePolicy.patch b/meta/recipes-core/systemd/systemd/0001-NamePolicy.patch
deleted file mode 100644
index 46955cbcbb..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-NamePolicy.patch
+++ /dev/null
@@ -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
-
diff --git a/meta/recipes-core/systemd/systemd_255.4.bb b/meta/recipes-core/systemd/systemd_255.4.bb
index 8a816c4bc1..e7498c802d 100644
--- a/meta/recipes-core/systemd/systemd_255.4.bb
+++ b/meta/recipes-core/systemd/systemd_255.4.bb
@@ -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 (){