From 5a3b4300f89805af384b7765fd26757c44fc43c2 Mon Sep 17 00:00:00 2001 From: Alexander Sverdlin Date: Tue, 10 Dec 2024 14:25:03 +0100 Subject: [PATCH] systemd: actively disable Predictable Network Interface Names if !pni-names Currently pni-names PACKAGECONFIG option adds "mac" names policy if selected, but nothing otherwise. In systemd Predictable Network Interface Names are applied by default which leads to inconsistend behaviour. One could think that pni-names in DISTRO_FEATURES would enable or disable Predictable Network Interface Names, but currently if not present it's only actively disabled for QEMU via kernel command line (commit 9e9c33d51e40 ("qemuboot/runqemu: Fix 6.2 and later kernel network device naming")). It has no effect on the real HW. If the option is present, it merely adds "mac" into default NamePolicy, which may or may not have observable effects. Make pni-names semantics more consistent by actively suppressing Predictable Network Interface Names if the feature is not present. (From OE-Core rev: 37b98bc93bc404823cc4bbf9039e4d114aac33fa) Signed-off-by: Alexander Sverdlin Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/recipes-core/systemd/systemd_256.8.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/recipes-core/systemd/systemd_256.8.bb b/meta/recipes-core/systemd/systemd_256.8.bb index c1915d7e94..2b5a90aacb 100644 --- a/meta/recipes-core/systemd/systemd_256.8.bb +++ b/meta/recipes-core/systemd/systemd_256.8.bb @@ -390,6 +390,9 @@ do_install() { if ! grep -q 'AlternativeNamesPolicy=.*mac' ${D}${nonarch_libdir}/systemd/network/99-default.link; then sed -i '/AlternativeNamesPolicy=/s/$/ mac/' ${D}${nonarch_libdir}/systemd/network/99-default.link fi + else + # Actively disable Predictable Network Interface Names + sed -i 's/^NamePolicy=.*/NamePolicy=/;s/^AlternativeNamesPolicy=.*/AlternativeNamesPolicy=/' ${D}${nonarch_libdir}/systemd/network/99-default.link fi }