From: Alexander Sverdlin Date: Tue, 10 Dec 2024 13:25:03 +0000 (+0100) Subject: systemd: actively disable Predictable Network Interface Names if !pni-names X-Git-Tag: uninative-4.7~591 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37b98bc93bc404823cc4bbf9039e4d114aac33fa;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git 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. Signed-off-by: Alexander Sverdlin Signed-off-by: Mathieu Dubois-Briand --- diff --git a/meta/recipes-core/systemd/systemd_256.8.bb b/meta/recipes-core/systemd/systemd_256.8.bb index c1915d7e941..2b5a90aacbc 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 }