diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-10-30 11:56:18 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-10-30 11:56:18 +0100 |
commit | c05aa6a776ab2420a42c041a3b5d45db587fd9ef (patch) | |
tree | 43e5120fd6a76e7a7d741a81169ca8da585ecb0c | |
parent | a541314b1f5e7392608cdef91e9098330823ed31 (diff) | |
download | busybox-w32-c05aa6a776ab2420a42c041a3b5d45db587fd9ef.tar.gz busybox-w32-c05aa6a776ab2420a42c041a3b5d45db587fd9ef.tar.bz2 busybox-w32-c05aa6a776ab2420a42c041a3b5d45db587fd9ef.zip |
udhcpc: ensure at least one unicast renew attempt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/udhcp/d6_dhcpc.c | 5 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index 66e4b6c6a..e2f8a6a9c 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c | |||
@@ -1738,8 +1738,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) | |||
1738 | /* note: "int timeout" will not overflow even with 0xffffffff inputs here: */ | 1738 | /* note: "int timeout" will not overflow even with 0xffffffff inputs here: */ |
1739 | timeout = (prefix_timeout < address_timeout ? prefix_timeout : address_timeout) / 2; | 1739 | timeout = (prefix_timeout < address_timeout ? prefix_timeout : address_timeout) / 2; |
1740 | /* paranoia: must not be too small */ | 1740 | /* paranoia: must not be too small */ |
1741 | if (timeout < 0x10) | 1741 | /* timeout > 60 - ensures at least one unicast renew attempt */ |
1742 | timeout = 0x10; | 1742 | if (timeout < 61) |
1743 | timeout = 61; | ||
1743 | /* enter bound state */ | 1744 | /* enter bound state */ |
1744 | d6_run_script(packet.d6_options, packet_end, | 1745 | d6_run_script(packet.d6_options, packet_end, |
1745 | (state == REQUESTING ? "bound" : "renew")); | 1746 | (state == REQUESTING ? "bound" : "renew")); |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index ab3e5a463..d2f165904 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -1725,8 +1725,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
1725 | move_from_unaligned32(lease_seconds, temp); | 1725 | move_from_unaligned32(lease_seconds, temp); |
1726 | lease_seconds = ntohl(lease_seconds); | 1726 | lease_seconds = ntohl(lease_seconds); |
1727 | /* paranoia: must not be too small and not prone to overflows */ | 1727 | /* paranoia: must not be too small and not prone to overflows */ |
1728 | if (lease_seconds < 0x10) | 1728 | /* timeout > 60 - ensures at least one unicast renew attempt */ |
1729 | lease_seconds = 0x10; | 1729 | if (lease_seconds < 2 * 61) |
1730 | lease_seconds = 2 * 61; | ||
1730 | //if (lease_seconds > 0x7fffffff) | 1731 | //if (lease_seconds > 0x7fffffff) |
1731 | // lease_seconds = 0x7fffffff; | 1732 | // lease_seconds = 0x7fffffff; |
1732 | //^^^not necessary since "timeout = lease_seconds / 2" | 1733 | //^^^not necessary since "timeout = lease_seconds / 2" |