udhcpc: ensure at least one unicast renew attempt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a541314b1f
commit
c05aa6a776
@ -1738,8 +1738,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
/* note: "int timeout" will not overflow even with 0xffffffff inputs here: */
|
/* note: "int timeout" will not overflow even with 0xffffffff inputs here: */
|
||||||
timeout = (prefix_timeout < address_timeout ? prefix_timeout : address_timeout) / 2;
|
timeout = (prefix_timeout < address_timeout ? prefix_timeout : address_timeout) / 2;
|
||||||
/* paranoia: must not be too small */
|
/* paranoia: must not be too small */
|
||||||
if (timeout < 0x10)
|
/* timeout > 60 - ensures at least one unicast renew attempt */
|
||||||
timeout = 0x10;
|
if (timeout < 61)
|
||||||
|
timeout = 61;
|
||||||
/* enter bound state */
|
/* enter bound state */
|
||||||
d6_run_script(packet.d6_options, packet_end,
|
d6_run_script(packet.d6_options, packet_end,
|
||||||
(state == REQUESTING ? "bound" : "renew"));
|
(state == REQUESTING ? "bound" : "renew"));
|
||||||
|
@ -1725,8 +1725,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
move_from_unaligned32(lease_seconds, temp);
|
move_from_unaligned32(lease_seconds, temp);
|
||||||
lease_seconds = ntohl(lease_seconds);
|
lease_seconds = ntohl(lease_seconds);
|
||||||
/* paranoia: must not be too small and not prone to overflows */
|
/* paranoia: must not be too small and not prone to overflows */
|
||||||
if (lease_seconds < 0x10)
|
/* timeout > 60 - ensures at least one unicast renew attempt */
|
||||||
lease_seconds = 0x10;
|
if (lease_seconds < 2 * 61)
|
||||||
|
lease_seconds = 2 * 61;
|
||||||
//if (lease_seconds > 0x7fffffff)
|
//if (lease_seconds > 0x7fffffff)
|
||||||
// lease_seconds = 0x7fffffff;
|
// lease_seconds = 0x7fffffff;
|
||||||
//^^^not necessary since "timeout = lease_seconds / 2"
|
//^^^not necessary since "timeout = lease_seconds / 2"
|
||||||
|
Loading…
Reference in New Issue
Block a user