From: Filip Schauer <f.schauer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH lxc v3 1/2] patch dhclient-script to allow ignoring DNS settings
Date: Tue, 1 Dec 2026 16:33:43 +0100 [thread overview]
Message-ID: <20261201153346.163922-2-f.schauer@proxmox.com> (raw)
In-Reply-To: <20261201153346.163922-1-f.schauer@proxmox.com>
Patch dhclient-script such that DNS settings offered by the DHCP server
can be ignored.
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
...fig-deny-rw-mounting-of-sys-and-proc.patch | 2 +-
...-PVE-Config-attach-always-use-getent.patch | 2 +-
...-script-set-RFC3442-classless-routes.patch | 2 +-
...4-dhclient-script-allow-ignoring-dns.patch | 63 +++++++++++++++++++
debian/patches/series | 1 +
5 files changed, 67 insertions(+), 3 deletions(-)
create mode 100644 debian/patches/pve/0004-dhclient-script-allow-ignoring-dns.patch
diff --git a/debian/patches/pve/0001-PVE-Config-deny-rw-mounting-of-sys-and-proc.patch b/debian/patches/pve/0001-PVE-Config-deny-rw-mounting-of-sys-and-proc.patch
index d2194d6..9096f72 100644
--- a/debian/patches/pve/0001-PVE-Config-deny-rw-mounting-of-sys-and-proc.patch
+++ b/debian/patches/pve/0001-PVE-Config-deny-rw-mounting-of-sys-and-proc.patch
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
Date: Wed, 9 Nov 2016 09:14:26 +0100
-Subject: [PATCH 1/3] PVE: [Config] deny rw mounting of /sys and /proc
+Subject: [PATCH 1/4] PVE: [Config] deny rw mounting of /sys and /proc
Note that we don't actually make use of this anymore, since
we switched to the generated profiles which already do this.
diff --git a/debian/patches/pve/0002-PVE-Config-attach-always-use-getent.patch b/debian/patches/pve/0002-PVE-Config-attach-always-use-getent.patch
index 190837d..7a09d52 100644
--- a/debian/patches/pve/0002-PVE-Config-attach-always-use-getent.patch
+++ b/debian/patches/pve/0002-PVE-Config-attach-always-use-getent.patch
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
Date: Tue, 13 Aug 2019 13:57:22 +0200
-Subject: [PATCH 2/3] PVE: [Config] attach: always use getent
+Subject: [PATCH 2/4] PVE: [Config] attach: always use getent
In debian buster, some libnss plugins (if installed) can
cause getpwent to segfault instead of erroring out cleanly.
diff --git a/debian/patches/pve/0003-dhclient-script-set-RFC3442-classless-routes.patch b/debian/patches/pve/0003-dhclient-script-set-RFC3442-classless-routes.patch
index 9dd2fb9..d466c76 100644
--- a/debian/patches/pve/0003-dhclient-script-set-RFC3442-classless-routes.patch
+++ b/debian/patches/pve/0003-dhclient-script-set-RFC3442-classless-routes.patch
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Filip Schauer <f.schauer@proxmox.com>
Date: Wed, 3 Dec 2025 15:03:50 +0100
-Subject: [PATCH 3/3] dhclient-script: set RFC3442 classless routes
+Subject: [PATCH 3/4] dhclient-script: set RFC3442 classless routes
Due to the removal of hooks in the LXC fork of dhclient-script, the
rfc3442-classless-routes hook did not run. As a result, classless static
diff --git a/debian/patches/pve/0004-dhclient-script-allow-ignoring-dns.patch b/debian/patches/pve/0004-dhclient-script-allow-ignoring-dns.patch
new file mode 100644
index 0000000..249044d
--- /dev/null
+++ b/debian/patches/pve/0004-dhclient-script-allow-ignoring-dns.patch
@@ -0,0 +1,63 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Filip Schauer <f.schauer@proxmox.com>
+Date: Tue, 1 Dec 2026 15:28:13 +0100
+Subject: [PATCH 4/4] dhclient-script: allow ignoring DNS settings
+
+IF IGNORE_DHCP_SEARCHDOMAINS or IGNORE_DHCP_NAMESERVERS are set in the
+environment of the script, ignore the respective DNS settings offered by
+the DHCP server.
+
+Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
+---
+ hooks/dhclient-script | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/hooks/dhclient-script b/hooks/dhclient-script
+index c87792707..627a5d575 100755
+--- a/hooks/dhclient-script
++++ b/hooks/dhclient-script
+@@ -45,11 +45,30 @@ make_resolv_conf() {
+ local resolv_conf="${ROOTFS}/etc/resolv.conf"
+ local new_resolv_conf="${ROOTFS}/etc/resolv.conf.dhclient-new"
+
++ local old_search=""
++ if [ -n "$IGNORE_DHCP_SEARCHDOMAINS" ]; then
++ if [ -f "$resolv_conf" ]; then
++ old_search=$(sed -n '/^[[:space:]]*\(search\|domain\)[[:space:]]/p' "$resolv_conf")
++ fi
++ local new_domain_name=""
++ local new_domain_search=""
++ local new_dhcp6_domain_search=""
++ fi
++
++ if [ -n "$IGNORE_DHCP_NAMESERVERS" ]; then
++ local new_domain_name_servers=""
++ local new_dhcp6_name_servers=""
++ fi
++
+ # DHCPv4
+ if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
+ [ -n "$new_domain_name_servers" ]; then
+ rm -f $new_resolv_conf
+
++ if [ -n "$old_search" ]; then
++ echo "$old_search" >>$new_resolv_conf
++ fi
++
+ if [ -n "$new_domain_name" ]; then
+ echo domain ${new_domain_name%% *} >>$new_resolv_conf
+ fi
+@@ -89,6 +108,10 @@ make_resolv_conf() {
+ elif [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
+ rm -f $new_resolv_conf
+
++ if [ -n "$old_search" ]; then
++ echo "$old_search" >>$new_resolv_conf
++ fi
++
+ if [ -n "$new_dhcp6_domain_search" ]; then
+ echo "search ${new_dhcp6_domain_search}" >> $new_resolv_conf
+ fi
+--
+2.47.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 8a37d9b..0025afb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,5 +3,6 @@ apparmor/0002-apparmor-use-abi-directive-in-apparmor-profiles.patch
pve/0001-PVE-Config-deny-rw-mounting-of-sys-and-proc.patch
pve/0002-PVE-Config-attach-always-use-getent.patch
pve/0003-dhclient-script-set-RFC3442-classless-routes.patch
+pve/0004-dhclient-script-allow-ignoring-dns.patch
cgroupv1-warnings/0001-PVE-Revert-lxc-conf-drop-cgroup1-config-options-lxc..patch
cgroupv1-warnings/0002-PVE-ignore-cgroupv1-settings-with-a-warning.patch
--
2.47.3
next prev parent reply other threads:[~2026-12-01 15:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 15:33 [PATCH container/lxc v3 0/2] fix #7388: prefer container DNS config over host-managed DHCP Filip Schauer
2026-12-01 15:33 ` Filip Schauer [this message]
2026-12-01 15:33 ` [PATCH container v3 2/2] " Filip Schauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201153346.163922-2-f.schauer@proxmox.com \
--to=f.schauer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox