udhcpc: ensure at least one unicast renew attempt

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2018-10-30 11:56:18 +01:00
parent a541314b1f
commit c05aa6a776
2 changed files with 6 additions and 4 deletions

View File

@@ -1738,8 +1738,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
/* note: "int timeout" will not overflow even with 0xffffffff inputs here: */
timeout = (prefix_timeout < address_timeout ? prefix_timeout : address_timeout) / 2;
/* paranoia: must not be too small */
if (timeout < 0x10)
timeout = 0x10;
/* timeout > 60 - ensures at least one unicast renew attempt */
if (timeout < 61)
timeout = 61;
/* enter bound state */
d6_run_script(packet.d6_options, packet_end,
(state == REQUESTING ? "bound" : "renew"));