From acc1863b269fa974cd6c19b31c224dd88154e09d Mon Sep 17 00:00:00 2001 From: zhipengl Date: Tue, 11 Dec 2018 00:30:56 +0800 Subject: [PATCH] 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 --- base/dhcp-config/centos/build_srpm.data | 2 +- base/dhcp-config/centos/dhcp-config.spec | 3 +- .../spec-include-TiS-patches.patch | 24 ++++------- .../dhclient-dhcp6-wrs-install-uuid.patch | 41 ------------------ .../dhclient-handle-wrs-install-uuid.patch | 42 ------------------- .../patches/support-disable-nsupdate.patch | 42 ------------------- 6 files changed, 12 insertions(+), 142 deletions(-) delete mode 100644 base/dhcp/centos/patches/dhclient-dhcp6-wrs-install-uuid.patch delete mode 100644 base/dhcp/centos/patches/dhclient-handle-wrs-install-uuid.patch delete mode 100644 base/dhcp/centos/patches/support-disable-nsupdate.patch diff --git a/base/dhcp-config/centos/build_srpm.data b/base/dhcp-config/centos/build_srpm.data index 2c3b2cb8b..75f295c2e 100644 --- a/base/dhcp-config/centos/build_srpm.data +++ b/base/dhcp-config/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="files" -TIS_PATCH_VER=1 +TIS_PATCH_VER=2 diff --git a/base/dhcp-config/centos/dhcp-config.spec b/base/dhcp-config/centos/dhcp-config.spec index 1b9e66196..98fcc88e6 100644 --- a/base/dhcp-config/centos/dhcp-config.spec +++ b/base/dhcp-config/centos/dhcp-config.spec @@ -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 diff --git a/base/dhcp/centos/meta_patches/spec-include-TiS-patches.patch b/base/dhcp/centos/meta_patches/spec-include-TiS-patches.patch index 7d0c8f0f9..de42aab08 100644 --- a/base/dhcp/centos/meta_patches/spec-include-TiS-patches.patch +++ b/base/dhcp/centos/meta_patches/spec-include-TiS-patches.patch @@ -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 diff --git a/base/dhcp/centos/patches/dhclient-dhcp6-wrs-install-uuid.patch b/base/dhcp/centos/patches/dhclient-dhcp6-wrs-install-uuid.patch deleted file mode 100644 index 17bc4a286..000000000 --- a/base/dhcp/centos/patches/dhclient-dhcp6-wrs-install-uuid.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 70d970536ec4312be28c7c39b20fe90199c495e0 Mon Sep 17 00:00:00 2001 -From: Scott Little -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 - diff --git a/base/dhcp/centos/patches/dhclient-handle-wrs-install-uuid.patch b/base/dhcp/centos/patches/dhclient-handle-wrs-install-uuid.patch deleted file mode 100644 index f9db9ac2f..000000000 --- a/base/dhcp/centos/patches/dhclient-handle-wrs-install-uuid.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d6daacb050008d473b986f574434f9b8ae7139e4 Mon Sep 17 00:00:00 2001 -From: Scott Little -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 - diff --git a/base/dhcp/centos/patches/support-disable-nsupdate.patch b/base/dhcp/centos/patches/support-disable-nsupdate.patch deleted file mode 100644 index 9eea0f1d6..000000000 --- a/base/dhcp/centos/patches/support-disable-nsupdate.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 1a60b6e068a6f6289a48bd8281d116ed6a51f03e Mon Sep 17 00:00:00 2001 -From: Scott Little -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 -