From b2c483a8066f1d83dd27fcf84820ef7500565d9b Mon Sep 17 00:00:00 2001 From: Long Li Date: Thu, 21 Nov 2019 13:01:58 +0800 Subject: [PATCH] CentOS 8: Upgrade dhcp to version 4.3.6 (1)Release Version Upgrade (2)Matching code changes with el7 to el8 Set hostname based on ipv6 lease if not set Story: 2006729 Task: 37684 Depends-On: https://review.opendev.org/#/c/696481/ Depends-On: https://review.opendev.org/#/c/696050/ Change-Id: Iba34ddd1cfcdbdcfc152a9b88227c72f398b3b1b Signed-off-by: Long Li --- base/dhcp/PKG-INFO | 2 +- base/dhcp/centos/build_srpm.data | 2 +- ...te-package-versioning-for-TIS-format.patch | 12 ++-- .../dhclient-dhcp6-set-hostname.patch | 8 +-- .../spec-include-TiS-patches.patch | 30 +++++----- .../dhclient-ipv6-bind-to-interface.patch | 10 ++-- ...ient-ipv6-conditionally-set-hostname.patch | 55 +++++++++++-------- ...-restrict-interfaces-to-command-line.patch | 23 ++++---- base/dhcp/centos/srpm_path | 2 +- 9 files changed, 75 insertions(+), 69 deletions(-) diff --git a/base/dhcp/PKG-INFO b/base/dhcp/PKG-INFO index c27d5cf6a..c698c26b9 100644 --- a/base/dhcp/PKG-INFO +++ b/base/dhcp/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: dhcp -Version: 4.2.5 +Version: 4.3.6 Summary: Dynamic host configuration protocol software Home-page: Author: diff --git a/base/dhcp/centos/build_srpm.data b/base/dhcp/centos/build_srpm.data index c428b1f1d..8aeb55368 100644 --- a/base/dhcp/centos/build_srpm.data +++ b/base/dhcp/centos/build_srpm.data @@ -1 +1 @@ -TIS_PATCH_VER=9 +TIS_PATCH_VER=1 diff --git a/base/dhcp/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch b/base/dhcp/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch index fd0b4941a..19d312ec7 100644 --- a/base/dhcp/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch +++ b/base/dhcp/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch @@ -1,7 +1,7 @@ From 1eeae27ddc87dc61928b96baa63fe2ff767e35b0 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:05 -0400 -Subject: [PATCH] WRS: 0001-Update-package-versioning-for-TIS-format.patch +Subject: [PATCH]: 0001-Update-package-versioning-for-TIS-format.patch Conflicts: SPECS/dhcp.spec @@ -10,15 +10,15 @@ Conflicts: 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/dhcp.spec b/SPECS/dhcp.spec -index 42409f6..70c7a6d 100644 +index 4bfbf5c..a07357e 100644 --- a/SPECS/dhcp.spec +++ b/SPECS/dhcp.spec -@@ -18,7 +18,7 @@ +@@ -16,7 +16,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp - Version: 4.2.5 --Release: 68%{?dist}.1 -+Release: 68.el7.centos.1%{?_tis_dist}.%{tis_patch_ver} + Version: 4.3.6 +-Release: 30%{?dist} ++Release: 30.el8%{?_tis_dist}.%{tis_patch_ver} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. diff --git a/base/dhcp/centos/meta_patches/dhclient-dhcp6-set-hostname.patch b/base/dhcp/centos/meta_patches/dhclient-dhcp6-set-hostname.patch index 5e7bf259a..4581677a9 100644 --- a/base/dhcp/centos/meta_patches/dhclient-dhcp6-set-hostname.patch +++ b/base/dhcp/centos/meta_patches/dhclient-dhcp6-set-hostname.patch @@ -1,17 +1,17 @@ From 484178cab006e67cc132eec2587e59c5605edac7 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:05 -0400 -Subject: WRS: dhclient-dhcp6-set-hostname.patch +Subject: dhclient-dhcp6-set-hostname.patch --- SOURCES/dhclient-script | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SOURCES/dhclient-script b/SOURCES/dhclient-script -index 87bad65..fb51eb5 100644 +index 5f58112..8d1adf2 100644 --- a/SOURCES/dhclient-script +++ b/SOURCES/dhclient-script -@@ -653,6 +653,10 @@ dh6config() { +@@ -647,6 +647,10 @@ dh6config() { add_ipv6_addr_with_DAD make_resolv_conf @@ -22,7 +22,7 @@ index 87bad65..fb51eb5 100644 ;; RENEW6|REBIND6) -@@ -670,6 +674,10 @@ dh6config() { +@@ -663,6 +667,10 @@ dh6config() { [ ! "${new_dhcp6_domain_search}" = "${old_dhcp6_domain_search}" ]; then make_resolv_conf fi 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 de42aab08..4330bebaf 100644 --- a/base/dhcp/centos/meta_patches/spec-include-TiS-patches.patch +++ b/base/dhcp/centos/meta_patches/spec-include-TiS-patches.patch @@ -1,21 +1,20 @@ From 7e7a9f1bce5884da1e57d5bdc4f5215b7231924e Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:05 -0400 -Subject: [PATCH] WRS: spec-include-TiS-patches.patch +Subject: [PATCH]: spec-include-TiS-patches.patch --- - SPECS/dhcp.spec | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) + SPECS/dhcp.spec | 8 ++++++++ + 1 file changed, 8 insertions(+) diff --git a/SPECS/dhcp.spec b/SPECS/dhcp.spec -index 14da097..904e3ad 100644 +index 7bbd360..4bfbf5c 100644 --- a/SPECS/dhcp.spec +++ b/SPECS/dhcp.spec -@@ -111,6 +115,11 @@ Patch70: dhcp-4.2.5-reference_count_overflow.patch - Patch71: dhcp-4.2.5-centos-branding.patch +@@ -80,6 +80,10 @@ Patch43: dhcp-4.3.6-reference_count_overflow.patch + Patch44: dhcp-replay_file_limit.patch + Patch45: dhcp-4.2.5-expiry_before_renewal_v2.patch - -+# WRS +Patch101: dhclient-restrict-interfaces-to-command-line.patch +Patch102: dhclient-ipv6-bind-to-interface.patch +Patch103: dhclient-ipv6-conditionally-set-hostname.patch @@ -23,18 +22,17 @@ index 14da097..904e3ad 100644 BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool -@@ -439,6 +451,11 @@ rm -rf includes/isc-dhcp - %patch70 -p1 -b .reference_overflow - %patch71 -p1 +@@ -344,6 +348,10 @@ rm bind/bind.tar.gz + # https://bugzilla.redhat.com/show_bug.cgi?id=1647786 + %patch45 -p1 -b .t2-expirity -+# WRS +%patch101 -p1 +%patch102 -p1 +%patch103 -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 --- + # DHCLIENT_DEFAULT_PREFIX_LEN 64 -> 128 + # https://bugzilla.gnome.org/show_bug.cgi?id=656610 + sed -i -e 's|DHCLIENT_DEFAULT_PREFIX_LEN 64|DHCLIENT_DEFAULT_PREFIX_LEN 128|g' includes/site.h +-- 2.7.4 diff --git a/base/dhcp/centos/patches/dhclient-ipv6-bind-to-interface.patch b/base/dhcp/centos/patches/dhclient-ipv6-bind-to-interface.patch index 55c8c1e8d..de10ce9f6 100644 --- a/base/dhcp/centos/patches/dhclient-ipv6-bind-to-interface.patch +++ b/base/dhcp/centos/patches/dhclient-ipv6-bind-to-interface.patch @@ -1,17 +1,17 @@ From f1df67309b435da1d9e02b77100a793ba0165f04 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:18 -0400 -Subject: [PATCH 3/7] WRS: Patch103: dhclient-ipv6-bind-to-interface.patch +Subject: dhclient-ipv6-bind-to-interface.patch --- common/socket.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/socket.c b/common/socket.c -index f30c171..b236c4a 100644 +index 94ce334..17d32e4 100644 --- a/common/socket.c +++ b/common/socket.c -@@ -236,6 +236,15 @@ if_register_socket(struct interface_info *info, int family, +@@ -234,6 +234,15 @@ if_register_socket(struct interface_info *info, int family, } #endif @@ -27,7 +27,7 @@ index f30c171..b236c4a 100644 /* Bind the socket to this interface's IP address. */ if (bind(sock, (struct sockaddr *)&name, name_len) < 0) { log_error("Can't bind to dhcp address: %m"); -@@ -246,15 +255,6 @@ if_register_socket(struct interface_info *info, int family, +@@ -244,15 +253,6 @@ if_register_socket(struct interface_info *info, int family, log_fatal("includes a bootp server."); } @@ -44,5 +44,5 @@ index f30c171..b236c4a 100644 * IP packets whose destination address is 255.255.255.255. These * will be treated as subnet broadcasts on the interface identified -- -1.9.1 +2.7.4 diff --git a/base/dhcp/centos/patches/dhclient-ipv6-conditionally-set-hostname.patch b/base/dhcp/centos/patches/dhclient-ipv6-conditionally-set-hostname.patch index 83464be99..f40e0c998 100644 --- a/base/dhcp/centos/patches/dhclient-ipv6-conditionally-set-hostname.patch +++ b/base/dhcp/centos/patches/dhclient-ipv6-conditionally-set-hostname.patch @@ -1,37 +1,46 @@ From 04e5bef0d9bb0e1b3c8bbecccf11228ae809dfd2 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:21 -0400 -Subject: [PATCH 4/7] WRS: Patch104: - dhclient-ipv6-conditionally-set-hostname.patch +Subject: dhclient-ipv6-conditionally-set-hostname.patch --- - client/scripts/linux | 13 +++++++++++++ - 1 file changed, 13 insertions(+) + client/scripts/linux | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/client/scripts/linux b/client/scripts/linux -index 14655f0..59e764f 100755 +index 5fb1612..061e00c 100755 --- a/client/scripts/linux +++ b/client/scripts/linux -@@ -254,6 +254,19 @@ if [ x$reason = xPREINIT6 ] ; then - exit_with_hooks 0 - fi +@@ -398,11 +398,24 @@ case "$reason" in -+if [ x$reason = xBOUND6 ] || [ x$reason = xRENEW6 ] || \ -+ [ x$reason = xREBIND6 ] || [ x$reason = xREBOOT6 ]; then -+ current_hostname=`hostname` -+ if [ x$current_hostname = x ] || \ -+ [ x$current_hostname = "x(none)" ] || \ -+ [ x$current_hostname = xlocalhost ] || \ -+ [ x$current_hostname = x$old_fqdn_hostname ]; then -+ if [ x$new_fqdn_hostname != x$old_fqdn_hostname ]; then -+ hostname "$new_fqdn_hostname" -+ fi -+ fi -+fi + ;; + +- BOUND6|RENEW6|REBIND6) +- if [ "${new_ip6_address}" ] && [ "${new_ip6_prefixlen}" ]; then +- # set leased IP +- ${ip} -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \ +- dev ${interface} scope global ++ BOUND6|RENEW6|REBIND6|REBOOT6) ++ current_hostname=$(hostname) ++ if [ -z "${current_hostname}" ] || \ ++ [ "$current_hostname" = '(none)' ] || \ ++ [ "$current_hostname" = 'localhost' ] || \ ++ [ "$current_hostname" = "$old_fqdn_hostname" ]; then ++ if [ "$new_fqdn_hostname" != "$old_fqdn_hostname" ]; then ++ hostname "$new_fqdn_hostname" ++ fi ++ fi + - if [ x${old_ip6_prefix} != x ] || [ x${new_ip6_prefix} != x ] ; then - echo Prefix ${reason} old=${old_ip6_prefix} new=${new_ip6_prefix} ++ # set leased IP ++ if [ "${reason}" = BOUND6 ] || ++ [ "${reason}" = RENEW6 ] || [ "${reason}" = REBIND6 ]; then ++ if [ "${new_ip6_address}" ] && [ "${new_ip6_prefixlen}" ]; then ++ ${ip} -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \ ++ dev ${interface} scope global ++ fi + fi + # update /etc/resolv.conf -- -1.9.1 +2.7.4 diff --git a/base/dhcp/centos/patches/dhclient-restrict-interfaces-to-command-line.patch b/base/dhcp/centos/patches/dhclient-restrict-interfaces-to-command-line.patch index 382f17fd7..a0580d4fa 100644 --- a/base/dhcp/centos/patches/dhclient-restrict-interfaces-to-command-line.patch +++ b/base/dhcp/centos/patches/dhclient-restrict-interfaces-to-command-line.patch @@ -1,8 +1,7 @@ From 15b7057f9b9f2b232cf2f9f674c63140e903e379 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 15:25:15 -0400 -Subject: [PATCH 2/7] WRS: Patch102: - dhclient-restrict-interfaces-to-command-line.patch +Subject: dhclient-restrict-interfaces-to-command-line.patch --- client/clparse.c | 8 ++++++-- @@ -11,10 +10,10 @@ Subject: [PATCH 2/7] WRS: Patch102: 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/clparse.c b/client/clparse.c -index b609caf..3ae632a 100644 +index 076ea6a..983e280 100644 --- a/client/clparse.c +++ b/client/clparse.c -@@ -943,8 +943,12 @@ void parse_interface_declaration (cfile, outer_config, name) +@@ -1022,8 +1022,12 @@ void parse_interface_declaration (cfile, outer_config, name) if (!client -> config) make_client_config (client, outer_config); @@ -30,10 +29,10 @@ index b609caf..3ae632a 100644 token = next_token (&val, (unsigned *)0, cfile); if (token != LBRACE) { diff --git a/client/dhclient.c b/client/dhclient.c -index 0db4703..00b4240 100644 +index b61da43..3f78848 100644 --- a/client/dhclient.c +++ b/client/dhclient.c -@@ -71,6 +71,7 @@ isc_boolean_t no_pid_file = ISC_FALSE; +@@ -67,6 +67,7 @@ isc_boolean_t no_pid_file = ISC_FALSE; int dhcp_max_agent_option_packet_length = 0; int interfaces_requested = 0; @@ -41,7 +40,7 @@ index 0db4703..00b4240 100644 struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } }; -@@ -242,6 +243,8 @@ main(int argc, char **argv) { +@@ -342,6 +343,8 @@ main(int argc, char **argv) { no_dhclient_pid = 1; } else if (!strcmp(argv[i], "--no-pid")) { no_pid_file = ISC_TRUE; @@ -49,19 +48,19 @@ index 0db4703..00b4240 100644 + restrict_interfaces = ISC_TRUE; } else if (!strcmp(argv[i], "-cf")) { if (++i == argc) - usage(); + usage(use_noarg, argv[i-1]); diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index 1d2bf2c..b1f16bf 100644 +index d534f8c..e5cfb26 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h -@@ -2693,6 +2693,7 @@ extern const char *path_dhclient_db; +@@ -2924,6 +2924,7 @@ extern const char *path_dhclient_db; extern const char *path_dhclient_pid; extern char *path_dhclient_script; extern int interfaces_requested; +extern int restrict_interfaces; extern struct data_string default_duid; extern int duid_type; - + extern const char *path_dhclient_duid; -- -1.9.1 +2.7.4 diff --git a/base/dhcp/centos/srpm_path b/base/dhcp/centos/srpm_path index d40f94d20..a923d700a 100644 --- a/base/dhcp/centos/srpm_path +++ b/base/dhcp/centos/srpm_path @@ -1 +1 @@ -mirror:Source/dhcp-4.2.5-68.el7.centos.1.src.rpm +mirror:Source/dhcp-4.3.6-30.el8.src.rpm