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>
This commit is contained in:
parent
702d865fe6
commit
aae428f0bf
@ -1405,7 +1405,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
|
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
|
||||||
case_RENEW_REQUESTED:
|
case_RENEW_REQUESTED:
|
||||||
case RENEWING:
|
case RENEWING:
|
||||||
if (timeout > 60) {
|
if (timeout >= 60) {
|
||||||
/* send an unicast renew request */
|
/* send an unicast renew request */
|
||||||
/* Sometimes observed to fail (EADDRNOTAVAIL) to bind
|
/* Sometimes observed to fail (EADDRNOTAVAIL) to bind
|
||||||
* a new UDP socket for sending inside send_renew.
|
* a new UDP socket for sending inside send_renew.
|
||||||
@ -1465,11 +1465,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
* For the second case, must make sure timeout
|
* For the second case, must make sure timeout
|
||||||
* is not too big, or else we can send
|
* is not too big, or else we can send
|
||||||
* futile renew requests for hours.
|
* futile renew requests for hours.
|
||||||
* (Ab)use -A TIMEOUT value (usually 20 sec)
|
|
||||||
* as a cap on the timeout.
|
|
||||||
*/
|
*/
|
||||||
if (timeout > tryagain_timeout)
|
if (timeout > 60)
|
||||||
timeout = tryagain_timeout;
|
timeout = 60;
|
||||||
goto case_RENEW_REQUESTED;
|
goto case_RENEW_REQUESTED;
|
||||||
}
|
}
|
||||||
/* Start things over */
|
/* Start things over */
|
||||||
|
@ -1519,7 +1519,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
|
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
|
||||||
case_RENEW_REQUESTED:
|
case_RENEW_REQUESTED:
|
||||||
case RENEWING:
|
case RENEWING:
|
||||||
if (timeout > 60) {
|
if (timeout >= 60) {
|
||||||
/* send an unicast renew request */
|
/* send an unicast renew request */
|
||||||
/* Sometimes observed to fail (EADDRNOTAVAIL) to bind
|
/* Sometimes observed to fail (EADDRNOTAVAIL) to bind
|
||||||
* a new UDP socket for sending inside send_renew.
|
* a new UDP socket for sending inside send_renew.
|
||||||
@ -1592,11 +1592,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
* For the second case, must make sure timeout
|
* For the second case, must make sure timeout
|
||||||
* is not too big, or else we can send
|
* is not too big, or else we can send
|
||||||
* futile renew requests for hours.
|
* futile renew requests for hours.
|
||||||
* (Ab)use -A TIMEOUT value (usually 20 sec)
|
|
||||||
* as a cap on the timeout.
|
|
||||||
*/
|
*/
|
||||||
if (timeout > tryagain_timeout)
|
if (timeout > 60)
|
||||||
timeout = tryagain_timeout;
|
timeout = 60;
|
||||||
goto case_RENEW_REQUESTED;
|
goto case_RENEW_REQUESTED;
|
||||||
}
|
}
|
||||||
/* Start things over */
|
/* Start things over */
|
||||||
|
Loading…
Reference in New Issue
Block a user