From dbb9d0302f7f5009a871844d6648ea131a3df6b4 Mon Sep 17 00:00:00 2001 From: renmingshuai Date: Thu, 29 Jun 2023 10:04:49 +0800 Subject: [PATCH] revert the correction about the logic in dhclient Reference:https://gitlab.isc.org/isc-projects/dhcp/-/commit/33e517615f8467a005de2ca2633f52bad323ec2b https://gitlab.isc.org/isc-projects/dhcp/-/commit/e180ae075ecc989b6b75202d58363f96a8ce0167 --- RELNOTES | 4 ---- client/dhclient.c | 19 +++++-------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/RELNOTES b/RELNOTES index 64d45b2..54ad022 100644 --- a/RELNOTES +++ b/RELNOTES @@ -51,10 +51,6 @@ by Eric Young (eay@cryptsoft.com). - Minor corrections were made to allow compilation under gcc 10. [GitLab #117] -- The logic in dhclient that causes it to decline DHCPv4 leases if the - client script exits abnormally (i.e. crashes) has been corrected. - [GitLab #123] - - The limit on the size of a lease file that can be loaded at startup is now only enforced on 32-bit systems. [GitLab #92] diff --git a/client/dhclient.c b/client/dhclient.c index d20ba66..d39cb5c 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -2106,12 +2106,9 @@ void bind_lease (client) script_write_params(client, "alias_", client->alias); /* If the BOUND/RENEW code detects another machine using the - offered address, then per our man page it should exit with - a non-zero status, to which we send a DHCPDECLINE and toss - the lease. A return value of less than zero indicates - the script crashed (e.g. segfault) which script_go will log - but we will ignore here. */ - if (script_go(client) > 0) { + offered address, it exits nonzero. We need to send a + DHCPDECLINE and toss the lease. */ + if (script_go(client)) { make_decline(client, client->new); send_decline(client); destroy_client_lease(client->new); @@ -5184,14 +5181,8 @@ int script_go(struct client_state *client) } dfree (envp, MDL); gettimeofday(&cur_tv, NULL); - - if (!WIFEXITED(wstatus)) { - int sigval = WTERMSIG(wstatus); - log_error ("script_go script: %s was terminated by signal %d", scriptName, sigval); - return (-sigval); - } - - return (WEXITSTATUS(wstatus)); + return (WIFEXITED (wstatus) ? + WEXITSTATUS (wstatus) : -WTERMSIG (wstatus)); } void client_envadd (struct client_state *client, -- 2.23.0