summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch')
-rw-r--r--meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch b/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch
new file mode 100644
index 0000000000..8d1ed6671a
--- /dev/null
+++ b/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch
@@ -0,0 +1,82 @@
1From 02acc4d875ee81e6fd19ef66d69c9f55b4b4a7e7 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 9 Nov 2022 16:33:18 +0800
4Subject: [PATCH] 20-resolv.conf: improve the sitation of working with systemd
5
6systemd's resolvconf implementation ignores the protocol part.
7See https://github.com/systemd/systemd/issues/25032.
8
9When using 'dhcp server + dns server + dhcpcd + systemd', we
10get an integration issue, that is dhcpcd runs 'resolvconf -d eth0.ra',
11yet systemd's resolvconf treats it as eth0. This will delete the
12DNS information set by 'resolvconf -a eth0.dhcp'.
13
14Fortunately, 20-resolv.conf has the ability to build the resolv.conf
15file contents itself. We can just pass the generated contents to
16systemd's resolvconf. This way, the DNS information is not incorrectly
17deleted. Also, it does not cause behavior regression for dhcpcd
18in other cases.
19
20Upstream-Status: Inappropriate [OE Specific]
21This patch has been rejected by dhcpcd upstream.
22See details in https://github.com/NetworkConfiguration/dhcpcd/pull/152
23
24Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
25---
26 hooks/20-resolv.conf | 17 +++++++++++++----
27 1 file changed, 13 insertions(+), 4 deletions(-)
28
29diff --git a/hooks/20-resolv.conf b/hooks/20-resolv.conf
30index 7c29e276..becc019f 100644
31--- a/hooks/20-resolv.conf
32+++ b/hooks/20-resolv.conf
33@@ -11,8 +11,12 @@ nocarrier_roaming_dir="$state_dir/roaming"
34 NL="
35 "
36 : ${resolvconf:=resolvconf}
37+resolvconf_from_systemd=false
38 if command -v "$resolvconf" >/dev/null 2>&1; then
39 have_resolvconf=true
40+ if [ $(basename $(readlink -f $(which $resolvconf))) = resolvectl ]; then
41+ resolvconf_from_systemd=true
42+ fi
43 else
44 have_resolvconf=false
45 fi
46@@ -69,8 +73,13 @@ build_resolv_conf()
47 else
48 echo "# /etc/resolv.conf.tail can replace this line" >> "$cf"
49 fi
50- if change_file /etc/resolv.conf "$cf"; then
51- chmod 644 /etc/resolv.conf
52+ if $resolvconf_from_systemd; then
53+ [ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
54+ "$resolvconf" -a "$ifname" <"$cf"
55+ else
56+ if change_file /etc/resolv.conf "$cf"; then
57+ chmod 644 /etc/resolv.conf
58+ fi
59 fi
60 rm -f "$cf"
61 }
62@@ -170,7 +179,7 @@ add_resolv_conf()
63 for x in ${new_domain_name_servers}; do
64 conf="${conf}nameserver $x$NL"
65 done
66- if $have_resolvconf; then
67+ if $have_resolvconf && ! $resolvconf_from_systemd; then
68 [ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
69 printf %s "$conf" | "$resolvconf" -a "$ifname"
70 return $?
71@@ -186,7 +195,7 @@ add_resolv_conf()
72
73 remove_resolv_conf()
74 {
75- if $have_resolvconf; then
76+ if $have_resolvconf && ($if_down || ! $resolvconf_from_systemd); then
77 "$resolvconf" -d "$ifname" -f
78 else
79 if [ -e "$resolv_conf_dir/$ifname" ]; then
80--
812.17.1
82