}
}
- if (options->timeout > 0) {
+ if (options->timeout > 0 && !(state->options & DHCPCD_BACKGROUND)) {
tv.tv_sec = options->timeout;
tv.tv_usec = 0;
if (state->options & DHCPCD_IPV4LL) {
timeradd(&state->start, &tv, &state->stop);
- if (!(state->options & DHCPCD_BACKGROUND)) {
- tv.tv_sec = 10;
- timeradd(&state->stop, &tv, &state->exit);
- }
- } else if (!(state->options & DHCPCD_BACKGROUND))
+ tv.tv_sec = 10;
+ timeradd(&state->stop, &tv, &state->exit);
+ } else
timeradd(&state->start, &tv, &state->exit);
}
return 0;
timerclear(&tv);
timerclear(&state->stop);
+ timerclear(&state->exit);
state->messages = 0;
switch (state->state) {
state->claims = 0;
state->probes = 0;
state->conflicts = 0;
- /* Fallthrough */
- state->timeout.tv_sec = 1;
return 0;
}
#endif
if (!(state->options & DHCPCD_DAEMONISED) &&
(state->options & DHCPCD_DAEMONISE))
return -1;
- if (state->carrier == LINK_DOWN)
- return 0;
- state->state = STATE_INIT;
- break;
+ state->state = STATE_RENEW_REQUESTED;
+ return 0;
case STATE_BOUND:
logger(LOG_INFO, "renewing lease of %s",inet_ntoa(lease->addr));
state->state = STATE_RENEWING;
#ifdef ENABLE_ARP
struct in_addr addr;
+ timerclear(&state->timeout);
if (timerisset(&state->exit)) {
get_time(&tv);
if (timercmp(&tv, &state->exit, >))
return handle_timeout_fail(state, options);
}
-
- timerclear(&state->timeout);
timerclear(&tv);
#ifdef ENABLE_IPV4LL
state->probes = 0;
state->claims = 0;
timerclear(&state->stop);
+ logger(LOG_INFO, "broadcasting for a lease");
goto dhcp_timeout;
} else {
state->state = STATE_BOUND;
case STATE_RENEW_REQUESTED:
get_time(&state->start);
timerclear(&state->stop);
- case STATE_INIT: /* FALLTHROUGH */
+ /* FALLTHROUGH */
+ case STATE_INIT:
up_interface(iface->name);
do_socket(state, SOCKET_OPEN);
state->xid = arc4random();