return 0;
}
+static void
+start_fallback(void *arg)
+{
+ struct interface *iface;
+
+ iface = (struct interface *)arg;
+ select_profile(iface, iface->state->options->fallback);
+ configure_interface1(iface);
+ start_interface(iface);
+}
+
static void
configure_interface(struct interface *iface, int argc, char **argv)
{
configure_interface1(iface);
}
-
static void
handle_carrier(const char *ifname)
{
struct interface *iface;
+ if (!(options & DHCPCD_LINK))
+ return;
for (iface = ifaces; iface; iface = iface->next)
if (strcmp(iface->name, ifname) == 0)
break;
iface->state->xid = arc4random();
open_sockets(iface);
delete_timeout(NULL, iface);
- if (ifo->options & DHCPCD_IPV4LL &&
+ if (ifo->fallback)
+ add_timeout_sec(ifo->timeout, start_fallback, iface);
+ else if (ifo->options & DHCPCD_IPV4LL &&
!IN_LINKLOCAL(htonl(iface->addr.s_addr)))
{
if (IN_LINKLOCAL(htonl(iface->state->fail.s_addr)))
iface->state->xid = arc4random();
iface->state->lease.server.s_addr = 0;
delete_timeout(NULL, iface);
- if (ifo->options & DHCPCD_LASTLEASE && iface->state->lease.frominfo)
+ if (ifo->fallback)
+ add_timeout_sec(ifo->reboot, start_fallback, iface);
+ else if (ifo->options & DHCPCD_LASTLEASE &&
+ iface->state->lease.frominfo)
add_timeout_sec(ifo->reboot, start_timeout, iface);
else if (!(ifo->options & DHCPCD_INFORM &&
options & (DHCPCD_MASTER | DHCPCD_DAEMONISED)))
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 31, 2009
+.Dd April 18, 2009
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
.Xr fnmatch 3 .
.It Ic arping Ar address Op address
.Nm dhcpcd
-will arping each address in order.
+will arping each address in order before attempting DHCP.
If an address is found, we will select the replying hardware address as the
profile, otherwise the ip address.
Example:
The duid generated will be held in
.Pa @SYSCONFDIR@/dhcpcd.duid
and should not be copied to other hosts.
+.It Ic fallback Ar profile
+Fallback to using this profile if DHCP fails.
+This allows you to configure a static profile instead of using ZeroConf.
.It Ic hostname Ar name
Sends specified
-.Ar hostname
+.Ar hostname
to the DHCP server so it can be registered in DNS. If
.Ar hostname
if a FQDN (ie, contains a .) then it will be encoded as such.
valid short options for them */
#define O_BASE MAX('z', 'Z') + 1
#define O_ARPING O_BASE + 1
+#define O_FALLBACK O_BASE + 2
const struct option cf_options[] = {
{"background", no_argument, NULL, 'b'},
{"blacklist", required_argument, NULL, 'X'},
{"denyinterfaces", required_argument, NULL, 'Z'},
{"arping", required_argument, NULL, O_ARPING},
+ {"fallback", required_argument, NULL, O_FALLBACK},
{NULL, 0, NULL, '\0'}
};
sizeof(in_addr_t) * (ifo->arping_len + 1));
ifo->arping[ifo->arping_len++] = addr.s_addr;
break;
+ case O_FALLBACK:
+ free(ifo->fallback);
+ ifo->fallback = xstrdup(arg);
+ break;
default:
return 0;
}
free(ifo->config);
}
free_routes(ifo->routes);
+ free(ifo->arping);
free(ifo->blacklist);
+ free(ifo->fallback);
free(ifo);
}
}
in_addr_t *blacklist;
size_t arping_len;
in_addr_t *arping;
+ char *fallback;
};
struct if_options *read_config(const char *,