base-files, systemd: add nss-resolve plugin

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.

(From OE-Core rev: 81da1d6eecee9fd036121298abba6fdcffc3969d)

Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Eero Aaltonen 2023-10-19 14:11:51 +03:00 committed by Richard Purdie
parent 37dc9faae0
commit 6f30e3586e
3 changed files with 36 additions and 0 deletions

View File

@ -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

View File

@ -23,6 +23,8 @@ SRC_URI = "file://rotation \
file://share/dot.profile \ file://share/dot.profile \
file://licenses/GPL-2 \ 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}" S = "${WORKDIR}"
INHIBIT_DEFAULT_DEPS = "1" INHIBIT_DEFAULT_DEPS = "1"

View File

@ -793,6 +793,9 @@ python __anonymous() {
if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") 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): 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]") bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")