struct interface *ifp = arg;
struct dhcp_state *state = D_STATE(ifp);
struct if_options *ifo = ifp->options;
- time_t timeout = ifo->timeout;
-
- /* If we're rebooting then we need to shorten the normal timeout
- * to ensure we try for a fallback or IPv4LL address. */
- if (state->state == DHS_REBOOT) {
- if (ifo->reboot >= timeout)
- timeout = 2;
- else
- timeout = ifo->reboot;
- }
state->state = DHS_DISCOVER;
state->xid = dhcp_xid(ifp);
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
if (ifo->fallback)
eloop_timeout_add_sec(ifp->ctx->eloop,
- timeout, dhcp_fallback, ifp);
+ ifo->reboot, dhcp_fallback, ifp);
else if (ifo->options & DHCPCD_IPV4LL &&
!IN_LINKLOCAL(htonl(state->addr.s_addr)))
eloop_timeout_add_sec(ifp->ctx->eloop,
- timeout, ipv4ll_start, ifp);
+ ifo->reboot, ipv4ll_start, ifp);
if (ifo->options & DHCPCD_REQUEST)
syslog(LOG_INFO, "%s: soliciting a DHCP lease (requesting %s)",
ifp->name, inet_ntoa(ifo->req_addr));
dhcp_static(ifp);
return;
}
- if (ifo->reboot == 0 || state->offer == NULL) {
- dhcp_discover(ifp);
- return;
- }
if (ifo->options & DHCPCD_INFORM) {
syslog(LOG_INFO, "%s: informing address of %s",
ifp->name, inet_ntoa(state->lease.addr));
- } else if (state->offer->cookie == 0) {
+ dhcp_inform(ifp);
+ return;
+ }
+ if (ifo->reboot == 0 || state->offer == NULL) {
+ dhcp_discover(ifp);
return;
- } else {
- syslog(LOG_INFO, "%s: rebinding lease of %s",
- ifp->name, inet_ntoa(state->lease.addr));
}
+ if (state->offer->cookie == 0)
+ return;
+
+ syslog(LOG_INFO, "%s: rebinding lease of %s",
+ ifp->name, inet_ntoa(state->lease.addr));
state->xid = dhcp_xid(ifp);
state->lease.server.s_addr = 0;
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
/* Need to add this before dhcp_expire and friends. */
- if (!ifo->fallback && ifo->reboot && ifo->options & DHCPCD_IPV4LL &&
+ if (!ifo->fallback && ifo->options & DHCPCD_IPV4LL &&
!IN_LINKLOCAL(htonl(state->addr.s_addr)))
eloop_timeout_add_sec(ifp->ctx->eloop,
ifo->reboot, ipv4ll_start, ifp);
- if (ifo->fallback)
- eloop_timeout_add_sec(ifp->ctx->eloop,
- ifo->reboot, dhcp_fallback, ifp);
- else if (ifo->options & DHCPCD_LASTLEASE && state->lease.frominfo)
+ if (ifo->options & DHCPCD_LASTLEASE && state->lease.frominfo)
eloop_timeout_add_sec(ifp->ctx->eloop,
ifo->reboot, dhcp_timeout, ifp);
- else if (!(ifo->options & DHCPCD_INFORM &&
- ifp->ctx->options & (DHCPCD_MASTER | DHCPCD_DAEMONISED)))
+ else if (!(ifo->options & DHCPCD_INFORM))
eloop_timeout_add_sec(ifp->ctx->eloop,
ifo->reboot, dhcp_expire, ifp);
- /* Don't bother ARP checking as the server could NAK us first. */
- if (ifo->options & DHCPCD_INFORM)
- dhcp_inform(ifp);
- else {
- /* Don't call dhcp_request as that would change the state */
- send_request(ifp);
- }
+
+ /* Don't bother ARP checking as the server could NAK us first.
+ * Don't call dhcp_request as that would change the state */
+ send_request(ifp);
}
void
will exit when a timeout occurs, otherwise
.Nm
will fork into the background.
-If using IPv4LL then
-.Nm
-start the IPv4LL process after the timeout and then wait a little longer
-before really timing out.
.It Fl u , Fl Fl userclass Ar class
Tags the DHCPv4 message with the userclass
.Ar class .
Allow
.Ar reboot
seconds before moving to the discover phase if we have an old lease to use.
+Allow
+.Ar reboot
+seconds before starting fallback states from the discover phase.
+IPv4LL is started when the first
+.Ar reboot
+timeout is reached.
The default is 5 seconds.
A setting of 0 seconds causes
.Nm
to skip the reboot phase and go straight into discover.
+This has no effect on DHCPv6 other than skipping the reboot phase.
.El
.Ss Restricting behaviour
.Nm