From 96ab3e79e8bbdb30ee6ee97ea38e324143cdc7c9 Mon Sep 17 00:00:00 2001 From: dogsheng <960055655@qq.com> Date: Wed, 25 Dec 2019 15:44:33 +0800 Subject: [PATCH] Package init --- adds-address-prefix-len-to-dhclient-cli.patch | 78 +++++++++++++++++++ bugfix-dhcpd-2038-problem.patch | 38 +++++++++ dhcp.spec | 14 +++- 3 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 adds-address-prefix-len-to-dhclient-cli.patch create mode 100644 bugfix-dhcpd-2038-problem.patch diff --git a/adds-address-prefix-len-to-dhclient-cli.patch b/adds-address-prefix-len-to-dhclient-cli.patch new file mode 100644 index 0000000..bd786cb --- /dev/null +++ b/adds-address-prefix-len-to-dhclient-cli.patch @@ -0,0 +1,78 @@ +From 3286e40ff01e78c172dfb0cdb684b58854af7604 Mon Sep 17 00:00:00 2001 +From: liuzhikang +Date: Thu, 31 Oct 2019 16:07:22 +0800 + +Signed-off-by: liuzhikang +--- + client/dhc6.c | 3 ++- + client/dhclient.c | 17 +++++++++++++++-- + 2 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/client/dhc6.c b/client/dhc6.c +index 5460ee1..fe0057c 100644 +--- a/client/dhc6.c ++++ b/client/dhc6.c +@@ -148,6 +148,7 @@ static int dhc6_score_lease(struct client_state *client, + + extern int onetry; + extern int stateless; ++extern int address_prefix_len; + + /* + * Assign DHCPv6 port numbers as a client. +@@ -4364,7 +4365,7 @@ dhc6_marshall_values(const char *prefix, struct client_state *client, + (unsigned) addr->plen); + } else { + client_envadd(client, prefix, "ip6_prefixlen", +- "%d", DHCLIENT_DEFAULT_PREFIX_LEN); ++ "%d", address_prefix_len); + client_envadd(client, prefix, "ip6_address", + "%s", piaddr(addr->address)); + } +diff --git a/client/dhclient.c b/client/dhclient.c +index 62b90cf..9f8ba06 100644 +--- a/client/dhclient.c ++++ b/client/dhclient.c +@@ -108,6 +108,7 @@ int require_all_ias = 0; /* If the user requires all of the IAs to + be available before accepting a lease + 0 = no, 1 = requries */ + int dad_wait_time = 0; ++int address_prefix_len = DHCLIENT_DEFAULT_PREFIX_LEN; + char *mockup_relay = NULL; + + char *progname = NULL; +@@ -190,9 +191,11 @@ usage(const char *sfmt, const char *sarg) + #ifdef DHCP4o6 + "[-4|-6] [-SNTPRI1dvrxi] [-nw] -4o6 ] [-p ]\n" + " [-D LL|LLT] [--dad-wait-time seconds]\n" ++ " [--address-prefix-len length]\n" + #else /* DHCP4o6 */ + "[-4|-6] [-SNTPRI1dvrxi] [-nw] [-p ]\n" +- " [-D LL|LLT] [--dad-wait-time seconds]\n" ++ " [-D LL|LLT] [--dad-wait-time seconds]\n" ++ " [--address-prefix-len length]\n" + #endif + #else /* DHCPv6 */ + "[-I1dvrxi] [-nw] [-p ] [-D LL|LLT] \n" +@@ -452,7 +455,17 @@ main(int argc, char **argv) { + if (errno || (*s != '\0') || (dad_wait_time < 0)) { + usage("Invalid value for --dad-wait-time: %s", argv[i]); + } +- ++ } else if (!strcmp(argv[i], "--address-prefix-len")) { ++ if (++i == argc) { ++ usage(use_noarg, argv[i-1]); ++ } ++ errno = 0; ++ address_prefix_len = (int)strtol(argv[i], &s, 10); ++ if (errno || (*s != '\0') || ++ (address_prefix_len < 0)) { ++ usage("Invalid value for" ++ " --address-prefix-len: %s", argv[i]); ++ } + #endif /* DHCPv6 */ + } else if (!strcmp(argv[i], "-D")) { + duid_v4 = 1; +-- +2.19.1 + diff --git a/bugfix-dhcpd-2038-problem.patch b/bugfix-dhcpd-2038-problem.patch new file mode 100644 index 0000000..f02003a --- /dev/null +++ b/bugfix-dhcpd-2038-problem.patch @@ -0,0 +1,38 @@ +From 4159defd501cccf095481b661b8a98f4effbe077 Mon Sep 17 00:00:00 2001 +From: zhanglu37 +Date: Fri, 25 Oct 2019 16:19:13 +0800 +Subject: [PATCH] Dhcpd: 64 bit cpu not troubled by 2038 problem + +commit_type: bugfix +reason: 64 bit cpu not troubled by 2038 problem + +Signed-off-by: zhanglu37 +--- + common/parse.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/common/parse.c b/common/parse.c +index 729d442..c58b13c 100644 +--- a/common/parse.c ++++ b/common/parse.c +@@ -1145,12 +1145,15 @@ parse_date_core(cfile) + return((TIME)0); + } + ++ /* 64Bit architecture do not bother by integer overflow 2038 problem */ ++ if (sizeof(TIME) != 8) { + /* If the year is 2038 or greater return the max time to avoid + * overflow issues. We could try and be more precise but there + * doesn't seem to be a good reason to worry about it and waste + * the cpu looking at the rest of the date. */ +- if (year >= 138) +- return(MAX_TIME); ++ if (year >= 138) ++ return(MAX_TIME); ++ } + + /* Guess the time value... */ + guess = ((((((365 * (year - 70) + /* Days in years since '70 */ +-- +2.19.1 + diff --git a/dhcp.spec b/dhcp.spec index 18eda25..9debb1d 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -3,7 +3,7 @@ Name: dhcp Version: 4.3.6 -Release: 31 +Release: 32 Summary: Dynamic host configuration protocol software #Please don't change the epoch on this package Epoch: 12 @@ -20,7 +20,7 @@ Source6: dhcpd.service Source7: dhcpd6.service Source8: dhcrelay.service -#patch18,20,39,40,41,,42,43 backport from upstream,other from fedora +#patch18,20,39,40,41,,42,43 from upstream,other from fedora Patch0: dhcp-remove-bind.patch Patch1: dhcp-sharedlib.patch @@ -62,7 +62,6 @@ Patch30: dhcp-4.3.6-options_overflow.patch Patch31: dhcp-4.3.6-reference_count_overflow.patch Patch32: dhcp-iface_hwaddr_discovery.patch -#patches for backport Patch6000: Correct-BIND9-dns-API-call-constant.patch Patch6001: Corrected-dhclient-command-line-parsing-of-dad-wait-.patch Patch6002: CVE-2019-6470.patch @@ -70,6 +69,8 @@ Patch6003: bugfix-dhcp-4.2.5-check-dhclient-pid.patch Patch6004: bugfix-reduce-getifaddr-calls.patch Patch9000: dhcp-fix-dhclient-default-len-64-to-128.patch +Patch9001: bugfix-dhcpd-2038-problem.patch +Patch9002: adds-address-prefix-len-to-dhclient-cli.patch BuildRequires: gcc autoconf automake libtool openldap-devel krb5-devel libcap-ng-devel bind-export-devel BuildRequires: systemd systemd-devel @@ -313,6 +314,13 @@ exit 0 %{_mandir}/man3/omapi.3.gz %changelog +* Sat Dec 21 2019 openEuler Buildteam - 4.3.6-32 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix dhcpd 2038 problem; + Adds address prefix len to dhclient cli + * Wed Sep 25 2019 openEuler Buildteam - 4.3.6-31 - Type:bugfix - ID:NA