Refactor source code patches for dhcp package

3 source patches can be removed.
2 patches adds support for wrs_install_uuid in the dhclient script.
This added script part just copy the whole content of dhclient-enter-hooks.
Following this script part, it will call this hook script if the hook
exist under /etc/. However, our hook file existed in /etc/dhcp/ folder will
be called by sbin/dhclient-script as well. I'd like to use dhcp config
package to creat /etc/dhclient-enter-hooks soft linked to
/etc/dhcp/dhclient-enter-hooks, so that it can call dhclient script and
no need to add this 2 patches.

Support-disable-nsupdate.patch can be removed as we already fixed port
conflict issue in https://review.openstack.org/#/c/622711/

Deployment test pass and related script file check pass!

Story: 2004473
Task: 28164

Change-Id: If50ae697062a7d0c8a2831fbcc0f5641aaa41ec7
Signed-off-by: zhipengl <zhipengs.liu@intel.com>
This commit is contained in:
zhipengl 2018-12-11 00:30:56 +08:00 committed by zhipeng liu
parent 0dd574e635
commit acc1863b26
6 changed files with 12 additions and 142 deletions

View File

@ -1,2 +1,2 @@
SRC_DIR="files"
TIS_PATCH_VER=1
TIS_PATCH_VER=2

View File

@ -27,10 +27,11 @@ package StarlingX configuration files of dhcp to system folder.
%{__install} -d %{buildroot}%{dhcpconfdir}
%{__install} -p -m 0755 dhclient-enter-hooks %{buildroot}%{dhcpconfdir}/dhclient-enter-hooks
%{__install} -p -m 0644 dhclient.conf %{buildroot}%{dhcpconfdir}/dhclient.conf
ln -s %{dhcpconfdir}/dhclient-enter-hooks %{buildroot}%{_sysconfdir}/dhclient-enter-hooks
%post
%files
%config(noreplace) %{dhcpconfdir}/dhclient.conf
%{dhcpconfdir}/dhclient-enter-hooks
%{_sysconfdir}/dhclient-enter-hooks

View File

@ -11,36 +11,30 @@ diff --git a/SPECS/dhcp.spec b/SPECS/dhcp.spec
index 14da097..904e3ad 100644
--- a/SPECS/dhcp.spec
+++ b/SPECS/dhcp.spec
@@ -111,6 +115,14 @@ Patch70: dhcp-4.2.5-reference_count_overflow.patch
@@ -111,6 +115,11 @@ Patch70: dhcp-4.2.5-reference_count_overflow.patch
Patch71: dhcp-4.2.5-centos-branding.patch
+# WRS
+Patch101: support-disable-nsupdate.patch
+Patch102: dhclient-restrict-interfaces-to-command-line.patch
+Patch103: dhclient-ipv6-bind-to-interface.patch
+Patch104: dhclient-ipv6-conditionally-set-hostname.patch
+Patch105: dhclient-handle-wrs-install-uuid.patch
+Patch106: dhclient-dhcp6-wrs-install-uuid.patch
+Patch101: dhclient-restrict-interfaces-to-command-line.patch
+Patch102: dhclient-ipv6-bind-to-interface.patch
+Patch103: dhclient-ipv6-conditionally-set-hostname.patch
+
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
@@ -439,6 +451,14 @@ rm -rf includes/isc-dhcp
@@ -439,6 +451,11 @@ rm -rf includes/isc-dhcp
%patch70 -p1 -b .reference_overflow
%patch71 -p1
+# WRS
+%patch101 -p1
+%patch102 -p1
+%patch103 -p1
+%patch104 -p1
+%patch105 -p1
+%patch106 -p1
+
# Update paths in all man pages
for page in client/dhclient.conf.5 client/dhclient.leases.5 \
client/dhclient-script.8 client/dhclient.8 ; do
--
--
2.7.4

View File

@ -1,41 +0,0 @@
From 70d970536ec4312be28c7c39b20fe90199c495e0 Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 15:25:26 -0400
Subject: [PATCH 6/7] WRS: Patch106: dhclient-dhcp6-wrs-install-uuid.patch
---
client/scripts/linux | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/client/scripts/linux b/client/scripts/linux
index ddf50e8..c4ab9a1 100755
--- a/client/scripts/linux
+++ b/client/scripts/linux
@@ -77,15 +77,22 @@ exit_with_hooks() {
exit $exit_status
}
+# Select wrs-install-uuid from ipv4 or ipv6
+if [ -n "$new_dhcp6_wrs_install_uuid" ]; then
+ wrs_install_uuid=$new_dhcp6_wrs_install_uuid
+else
+ wrs_install_uuid=$new_wrs_install_uuid
+fi
+
# Enforce wrs-install-uuid on management and infrastrucure interfaces
source /etc/platform/platform.conf
-if [ -n "$new_wrs_install_uuid" ]; then
+if [ -n "$wrs_install_uuid" ]; then
if [ "$nodetype" == "controller" ]; then
source /etc/build.info
file="/www/pages/feed/rel-$SW_VERSION/install_uuid"
INSTALL_UUID=$(cat "$file")
fi
- if [ "$INSTALL_UUID" != "$new_wrs_install_uuid" ]; then
+ if [ "$INSTALL_UUID" != "$wrs_install_uuid" ]; then
exit 1
fi
elif [ "$interface" == "$management_interface" -o \
--
1.9.1

View File

@ -1,42 +0,0 @@
From d6daacb050008d473b986f574434f9b8ae7139e4 Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 15:25:23 -0400
Subject: [PATCH 5/7] WRS: Patch105: dhclient-handle-wrs-install-uuid.patch
---
client/scripts/linux | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/client/scripts/linux b/client/scripts/linux
index 59e764f..ddf50e8 100755
--- a/client/scripts/linux
+++ b/client/scripts/linux
@@ -77,6 +77,25 @@ exit_with_hooks() {
exit $exit_status
}
+# Enforce wrs-install-uuid on management and infrastrucure interfaces
+source /etc/platform/platform.conf
+if [ -n "$new_wrs_install_uuid" ]; then
+ if [ "$nodetype" == "controller" ]; then
+ source /etc/build.info
+ file="/www/pages/feed/rel-$SW_VERSION/install_uuid"
+ INSTALL_UUID=$(cat "$file")
+ fi
+ if [ "$INSTALL_UUID" != "$new_wrs_install_uuid" ]; then
+ exit 1
+ fi
+elif [ "$interface" == "$management_interface" -o \
+ "$interface" == "$infrastructure_interface" ]; then
+ if [ "$nodetype" != "controller" -o \
+ -e "/etc/platform/.initial_config_complete" ]; then
+ exit 1
+ fi
+fi
+
# Invoke the local dhcp client enter hooks, if they exist.
if [ -f /etc/dhclient-enter-hooks ]; then
exit_status=0
--
1.9.1

View File

@ -1,42 +0,0 @@
From 1a60b6e068a6f6289a48bd8281d116ed6a51f03e Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 15:25:12 -0400
Subject: [PATCH 1/7] WRS: Patch101: support-disable-nsupdate.patch
---
server/dhcpd.c | 2 ++
server/failover.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/server/dhcpd.c b/server/dhcpd.c
index 67fec83..7523093 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -424,8 +424,10 @@ main(int argc, char **argv) {
trace_srandom = trace_type_register ("random-seed", (void *)0,
trace_seed_input,
trace_seed_stop, MDL);
+#if defined (NSUPDATE)
trace_ddns_init();
#endif
+#endif
#if defined (PARANOIA)
/* get user and group info if those options were given */
diff --git a/server/failover.c b/server/failover.c
index 8944102..d26adfa 100644
--- a/server/failover.c
+++ b/server/failover.c
@@ -5290,7 +5290,9 @@ isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *state,
*/
if (msg->binding_status == FTS_ACTIVE &&
(chaddr_changed || ident_changed)) {
+#if defined (NSUPDATE)
(void) ddns_removals(lease, NULL, NULL, ISC_FALSE);
+#endif
if (lease->scope != NULL)
binding_scope_dereference(&lease->scope, MDL);
--
1.9.1