From 5950c63d54228f15a973d8d8c843b0dc9987ab7f Mon Sep 17 00:00:00 2001 From: Peter Marko Date: Fri, 12 Apr 2024 15:43:17 +0200 Subject: 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: d9777e12b518f06657c84a348cc7b1d1b40317e4) Signed-off-by: Peter Marko Signed-off-by: Richard Purdie --- .../systemd/systemd/0001-NamePolicy.patch | 33 ---------------------- meta/recipes-core/systemd/systemd_255.4.bb | 13 +++++++-- 2 files changed, 11 insertions(+), 35 deletions(-) delete mode 100644 meta/recipes-core/systemd/systemd/0001-NamePolicy.patch 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 -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 ---- - 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 (){ -- cgit v1.2.3-54-g00ecf