From: Nicolas BESNARD Date: Thu, 10 Apr 2025 08:51:54 +0000 (+0000) Subject: odhcp6c: prevent RELEASE at shutdown when -k is set X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=c5237eabeb5ca451354d58a8181013ed1001695e;p=project%2Fodhcp6c.git odhcp6c: prevent RELEASE at shutdown when -k is set Problem: Based on the README, if -k option is set, a RELEASE message should not be sent when the process is stopped. RELEASE messages are also not sent in case of a forced RELEASE or reconfiguration, however. Solution: Stop the transmission of RELEASE messages when the process is stopped but allow it for a forced RELEASE or reconfiguration. Signed-off-by: Nicolas BESNARD Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcp6c/pull/106 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/odhcp6c.c b/src/odhcp6c.c index ac54ec7..b66c5c3 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -698,13 +698,13 @@ int main(_unused int argc, char* const argv[]) notify_state_change("unbound", 0, true); } - if (server_id_len > 0 && (ia_pd_len > 0 || ia_na_len > 0) && config_dhcp->release) + if (server_id_len > 0 && (ia_pd_len > 0 || ia_na_len > 0) && (!signal_term || config_dhcp->release)) dhcpv6_send_request(DHCPV6_MSG_RELEASE); odhcp6c_clear_state(STATE_IA_NA); odhcp6c_clear_state(STATE_IA_PD); - if (!signal_usr2) { + if (signal_term) { terminate = true; } else { signal_usr2 = false;