Commit 845c8522 authored by Thomas Markwalder's avatar Thomas Markwalder

[#123] dhclient no longer declines on client script crashes

modified:   RELNOTES
modified:   client/dhclient.c
parent c666652e
......@@ -103,6 +103,12 @@ ISC DHCP is open source software maintained by Internet Systems
Consortium. This product includes cryptographic software written
by Eric Young (eay@cryptsoft.com).
Changes since 4.4.2 (Bug Fixes)
- Corrected logic in dhclient that causes it to decline DHCPv4 leases if the
client script exits abnormally (i.e. crashes).
[Gitlab #123]
Changes since 4.4.2b1 (Bug Fixes)
- Added a clarification on DHCPINFORMs and server authority to
......
......@@ -1524,9 +1524,12 @@ void bind_lease (client)
script_write_params(client, "alias_", client->alias);
/* If the BOUND/RENEW code detects another machine using the
offered address, it exits nonzero. We need to send a
DHCPDECLINE and toss the lease. */
if (script_go(client)) {
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) {
make_decline(client, client->new);
send_decline(client);
destroy_client_lease(client->new);
......@@ -4434,8 +4437,14 @@ int script_go(struct client_state *client)
}
dfree (envp, MDL);
gettimeofday(&cur_tv, NULL);
return (WIFEXITED (wstatus) ?
WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
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));
}
void client_envadd (struct client_state *client,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment