diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2016-12-10 16:42:10 +0300 |
---|---|---|
committer | Vladislav Grishenko <themiron@mail.ru> | 2016-12-10 16:42:10 +0300 |
commit | 64630e030574b5d864727dbd557fb26a83557181 (patch) | |
tree | 93dbaa0829146fa37985493843397b7a63680a22 | |
parent | e8dcb55c0e6c853d2efd3161f984d9cc420d0a8e (diff) |
budybox: udhcpc: run deconfig script in manual renew too
Upstream commits
44399e00 udhcpc: run "deconfig" script in manual renew state too. closes 9061
b6355e2b udhcpc: Unconditionally call deconfig script, not only if lease is active
-rw-r--r-- | release/src/router/busybox/networking/udhcp/d6_dhcpc.c | 15 | ||||
-rw-r--r-- | release/src/router/busybox/networking/udhcp/dhcpc.c | 19 |
2 files changed, 26 insertions, 8 deletions
diff --git a/release/src/router/busybox/networking/udhcp/d6_dhcpc.c b/release/src/router/busybox/networking/udhcp/d6_dhcpc.c index 1f7d0e13e4..ca678dc3d3 100644 --- a/release/src/router/busybox/networking/udhcp/d6_dhcpc.c +++ b/release/src/router/busybox/networking/udhcp/d6_dhcpc.c @@ -793,13 +793,22 @@ static void perform_renew(void) static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cur_ipv6) { /* send release packet */ - if (state == BOUND || state == RENEWING || state == REBINDING) { + if (state == BOUND + || state == RENEWING + || state == REBINDING + || state == RENEW_REQUESTED + ) { bb_error_msg("unicasting a release"); send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */ - d6_run_script(NULL, "deconfig"); } bb_error_msg("entering released state"); - +/* + * We can be here on: SIGUSR2, + * or on exit (SIGTERM) and -R "release on quit" is specified. + * Users requested to be notified in all cases, even if not in one + * of the states above. + */ + d6_run_script(NULL, "deconfig"); change_listen_mode(LISTEN_NONE); state = RELEASED; } diff --git a/release/src/router/busybox/networking/udhcp/dhcpc.c b/release/src/router/busybox/networking/udhcp/dhcpc.c index a361e07240..827a4cda49 100644 --- a/release/src/router/busybox/networking/udhcp/dhcpc.c +++ b/release/src/router/busybox/networking/udhcp/dhcpc.c @@ -1123,16 +1123,26 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip) struct in_addr temp_addr; /* send release packet */ - if (state == BOUND || state == RENEWING || state == REBINDING) { + if (state == BOUND + || state == RENEWING + || state == REBINDING + || state == RENEW_REQUESTED + ) { temp_addr.s_addr = server_addr; strcpy(buffer, inet_ntoa(temp_addr)); temp_addr.s_addr = requested_ip; bb_error_msg("unicasting a release of %s to %s", inet_ntoa(temp_addr), buffer); send_release(server_addr, requested_ip); /* unicast */ - udhcp_run_script(NULL, "deconfig"); } bb_error_msg("entering released state"); +/* + * We can be here on: SIGUSR2, + * or on exit (SIGTERM) and -R "release on quit" is specified. + * Users requested to be notified in all cases, even if not in one + * of the states above. + */ + udhcp_run_script(NULL, "deconfig"); change_listen_mode(LISTEN_NONE); state = RELEASED; @@ -1826,9 +1836,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) temp = udhcp_get_option(&packet, DHCP_SERVER_ID); if (!temp) { non_matching_svid: - log1("%s with wrong server ID, ignoring packet", - "Received DHCP NAK" - ); + log1("received DHCP NAK with wrong" + " server ID, ignoring packet"); continue; } move_from_unaligned32(svid, temp); |