]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
base-files, systemd: add nss-resolve plugin
authorEero Aaltonen <eero.aaltonen@vaisala.com>
Thu, 19 Oct 2023 11:11:51 +0000 (14:11 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Oct 2023 09:45:26 +0000 (10:45 +0100)
Add nss-resolve plugin to the glibc Name Service Switch (NSS) with
systemd-resolved DISTRO_FEATURE so that systemd-resolved is used in DNS
name resolution.

This enables the resolution of Multicast DNS and Link-Local Multicast
Name Resolution names, depending on the selected options.

Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/recipes-core/base-files/base-files/0001-add-nss-resolve-to-nsswitch.patch [new file with mode: 0644]
meta/recipes-core/base-files/base-files_3.0.14.bb
meta/recipes-core/systemd/systemd_254.4.bb

diff --git a/meta/recipes-core/base-files/base-files/0001-add-nss-resolve-to-nsswitch.patch b/meta/recipes-core/base-files/base-files/0001-add-nss-resolve-to-nsswitch.patch
new file mode 100644 (file)
index 0000000..a6e39e0
--- /dev/null
@@ -0,0 +1,31 @@
+From 830abe652428d9d31780c3ace121635ad7b64274 Mon Sep 17 00:00:00 2001
+From: Eero Aaltonen <eero.aaltonen@vaisala.com>
+Date: Wed Sep 27 15:50:48 2023 +0300
+Subject: [PATCH] Add nss-resolve to the Name Service Switch (NSS)
+
+Add `nss-resolve` so that `systemd-resolved` is used for name
+resolution with glibc `gethostbyname` calls.
+
+Upstream-Status: Inappropriate [no upstream, configuration].
+
+Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
+---
+ nsswitch.conf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nsswitch.conf b/nsswitch.conf
+index 06f03d2..34b165c 100644
+--- a/nsswitch.conf
++++ b/nsswitch.conf
+@@ -8,7 +8,7 @@ passwd:         compat
+ group:          compat
+ shadow:         compat
+-hosts:          files dns
++hosts:          resolve [!UNAVAIL=return] files dns
+ networks:       files
+ protocols:      db files
+-- 
+2.25.1
+
index 4d246126a291d7ca0c032c26a6d9aaad3018601c..9fab53ce63c24901fe2848223180c4a1ac776b83 100644 (file)
@@ -23,6 +23,8 @@ SRC_URI = "file://rotation \
            file://share/dot.profile \
            file://licenses/GPL-2 \
            "
+SRC_URI:append:libc-glibc = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd systemd-resolved', ' file://0001-add-nss-resolve-to-nsswitch.patch', '', d)}"
+
 S = "${WORKDIR}"
 
 INHIBIT_DEFAULT_DEPS = "1"
index d888efdece7a255aa88886666a6cb489720ef325..76cc07e86f535f87534642a4b0d9bbe42fa665d1 100644 (file)
@@ -793,6 +793,9 @@ python __anonymous() {
     if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
         d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
 
+    if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d):
+        bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]")
+
     if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d):
         bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")