integ/base/dhcp/debian/deb_patches/0002-Update-dn-and-dns-only-with-diff-upon-RENEW.patch
Dan Voiculeasa d12b56267d debian: Update dhclient behavior for RENEW
On Debian we lost the ability to control resolv.conf throughout
ansible bootstrap. It is observed how renewing leases will override
DNSs configured during ansible bootstrap. Problems will surface when
later in the boostrap docker images are downloaded, because
information related to DNSs was overwritten by dhclient.
This behavior is different than on CentOS.

Align behavior with CentOS. In fact align with how the design should
be: control resolv.conf throughout bootstrap and don't let external
factors change it during that time.

Created a patch and updated the format(git am compatible) for an older one.

Test on AIO-SX:
PASS: build-pkgs && build-image
PASS: custom test using dhclient for OAM interface.
  Forcing lease renewal to 10 seconds for quick tests.
  Without this patch it is observed how resolv.conf is updated by
  dhclient after resolv.conf is changed as per requirement to solve
  custom domains.
  With this patch it is observed how resolv.conf is not updated
  anymore.

Story: 2009964
Task: 45093
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: Ic8f5ed7363124f04ff440dc9bf9935270a9ab8c9
2022-04-19 14:13:34 +00:00

36 lines
1.1 KiB
Diff

From ad1e3a89aa561292e745f58508b904cecbf8f928 Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Tue, 19 Apr 2022 12:05:09 +0300
Subject: [PATCH 2/2] Update dn and dns only with diff upon RENEW
This prevents resolv.conf being updated on lease renewal.
This aligns to the behavior exhibited on CentOS.
This prevents resolv.conf being changed during bootstrap, which
is in fact the design.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
debian/dhclient-script.linux | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 895116c..8b29988 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -40,6 +40,12 @@ wait_for_rw() {
make_resolv_conf() {
local new_resolv_conf
+ if [ "${reason}" = "RENEW" ] &&
+ [ "${new_domain_name}" = "${old_domain_name}" ] &&
+ [ "${new_domain_name_servers}" = "${old_domain_name_servers}" ]; then
+ return
+ fi
+
# DHCPv4
if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
[ -n "$new_domain_name_servers" ]; then
--
2.30.0