diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-09-28 14:44:09 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-09-28 14:44:09 +0200 |
| commit | aae428f0bf0fcd6cd0a2503b3a50de43785b8fd0 (patch) | |
| tree | ea72c9526278a93caa1d73c1a469e00fba3b980a | |
| parent | 702d865fe6ab84c1179275beda6c31f7adaeafa1 (diff) | |
| download | busybox-w32-aae428f0bf0fcd6cd0a2503b3a50de43785b8fd0.tar.gz busybox-w32-aae428f0bf0fcd6cd0a2503b3a50de43785b8fd0.tar.bz2 busybox-w32-aae428f0bf0fcd6cd0a2503b3a50de43785b8fd0.zip | |
udhcpc: give SIGUSR1-induced renew one chance of unicast renew
The caps were inconsistent: timeout to renew was capped at 20 seconds,
and any renews with timeout <= 60 seconds were forced to broadcast.
function old new delta
udhcpc_main 2683 2680 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | networking/udhcp/d6_dhcpc.c | 8 | ||||
| -rw-r--r-- | networking/udhcp/dhcpc.c | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index ed2255ef3..66e4b6c6a 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c | |||
| @@ -1405,7 +1405,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) | |||
| 1405 | case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ | 1405 | case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ |
| 1406 | case_RENEW_REQUESTED: | 1406 | case_RENEW_REQUESTED: |
| 1407 | case RENEWING: | 1407 | case RENEWING: |
| 1408 | if (timeout > 60) { | 1408 | if (timeout >= 60) { |
| 1409 | /* send an unicast renew request */ | 1409 | /* send an unicast renew request */ |
| 1410 | /* Sometimes observed to fail (EADDRNOTAVAIL) to bind | 1410 | /* Sometimes observed to fail (EADDRNOTAVAIL) to bind |
| 1411 | * a new UDP socket for sending inside send_renew. | 1411 | * a new UDP socket for sending inside send_renew. |
| @@ -1465,11 +1465,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) | |||
| 1465 | * For the second case, must make sure timeout | 1465 | * For the second case, must make sure timeout |
| 1466 | * is not too big, or else we can send | 1466 | * is not too big, or else we can send |
| 1467 | * futile renew requests for hours. | 1467 | * futile renew requests for hours. |
| 1468 | * (Ab)use -A TIMEOUT value (usually 20 sec) | ||
| 1469 | * as a cap on the timeout. | ||
| 1470 | */ | 1468 | */ |
| 1471 | if (timeout > tryagain_timeout) | 1469 | if (timeout > 60) |
| 1472 | timeout = tryagain_timeout; | 1470 | timeout = 60; |
| 1473 | goto case_RENEW_REQUESTED; | 1471 | goto case_RENEW_REQUESTED; |
| 1474 | } | 1472 | } |
| 1475 | /* Start things over */ | 1473 | /* Start things over */ |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 0310663e0..ab3e5a463 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
| @@ -1519,7 +1519,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
| 1519 | case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ | 1519 | case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ |
| 1520 | case_RENEW_REQUESTED: | 1520 | case_RENEW_REQUESTED: |
| 1521 | case RENEWING: | 1521 | case RENEWING: |
| 1522 | if (timeout > 60) { | 1522 | if (timeout >= 60) { |
| 1523 | /* send an unicast renew request */ | 1523 | /* send an unicast renew request */ |
| 1524 | /* Sometimes observed to fail (EADDRNOTAVAIL) to bind | 1524 | /* Sometimes observed to fail (EADDRNOTAVAIL) to bind |
| 1525 | * a new UDP socket for sending inside send_renew. | 1525 | * a new UDP socket for sending inside send_renew. |
| @@ -1592,11 +1592,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
| 1592 | * For the second case, must make sure timeout | 1592 | * For the second case, must make sure timeout |
| 1593 | * is not too big, or else we can send | 1593 | * is not too big, or else we can send |
| 1594 | * futile renew requests for hours. | 1594 | * futile renew requests for hours. |
| 1595 | * (Ab)use -A TIMEOUT value (usually 20 sec) | ||
| 1596 | * as a cap on the timeout. | ||
| 1597 | */ | 1595 | */ |
| 1598 | if (timeout > tryagain_timeout) | 1596 | if (timeout > 60) |
| 1599 | timeout = tryagain_timeout; | 1597 | timeout = 60; |
| 1600 | goto case_RENEW_REQUESTED; | 1598 | goto case_RENEW_REQUESTED; |
| 1601 | } | 1599 | } |
| 1602 | /* Start things over */ | 1600 | /* Start things over */ |
