diff options
| author | Roy Marples <roy@marples.name> | 2008-09-15 15:23:46 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-09-15 15:23:46 +0000 |
| commit | a2a9a498da4327ecf2fdec8560bb9a3557490fa9 (patch) | |
| tree | 5d89cf7c1883f60b5151b188f9220e070e910efe /if-options.c | |
| parent | 78c8e969a552d0076faab4065ed627e5f14cb814 (diff) | |
| download | dhcpcd-a2a9a498da4327ecf2fdec8560bb9a3557490fa9.tar.xz | |
Reboot off the last lease and use the last lease if not expired and user has asked for it. Also, add a reboot timeout toggle (default 10 seconds).
Diffstat (limited to 'if-options.c')
| -rw-r--r-- | if-options.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/if-options.c b/if-options.c index 7e2d4faa..da16e4c2 100644 --- a/if-options.c +++ b/if-options.c @@ -48,7 +48,7 @@ /* Don't set any optional arguments here so we retain POSIX * compatibility with getopt */ -#define OPTS "bc:df:h:i:kl:m:no:pqr:s:t:u:v:xABC:DEF:GI:KLO:Q:TVX:" +#define OPTS "bc:df:h:i:kl:m:no:pqr:s:t:u:v:xy:z:ABC:DEF:GI:KLO:Q:TVX:Z:" const struct option cf_options[] = { {"background", no_argument, NULL, 'b'}, @@ -70,6 +70,7 @@ const struct option cf_options[] = { {"userclass", required_argument, NULL, 'u'}, {"vendor", required_argument, NULL, 'v'}, {"exit", no_argument, NULL, 'x'}, + {"reboot", required_argument, NULL, 'y'}, {"allowinterfaces", required_argument, NULL, 'z'}, {"noarp", no_argument, NULL, 'A'}, {"nobackground", no_argument, NULL, 'B'}, @@ -382,7 +383,7 @@ parse_option(struct if_options *ifo, int opt, const char *arg) case 't': ifo->timeout = atoint(arg); if (ifo->timeout < 0) { - syslog (LOG_ERR, "timeout must be a positive value"); + syslog(LOG_ERR, "timeout must be a positive value"); return -1; } break; @@ -435,6 +436,13 @@ parse_option(struct if_options *ifo, int opt, const char *arg) ifo->vendor[0] += s + 2; } break; + case 'y': + ifo->reboot = atoint(arg); + if (ifo->reboot < 0) { + syslog(LOG_ERR, "reboot must be a positive value"); + return -1; + } + break; case 'z': /* We only set this if we haven't got any interfaces */ if (!ifaces) @@ -587,6 +595,7 @@ read_config(const char *file, const char *ifname) ifo->options |= DHCPCD_CLIENTID | DHCPCD_GATEWAY | DHCPCD_DAEMONISE; ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL | DHCPCD_LINK; ifo->timeout = DEFAULT_TIMEOUT; + ifo->reboot = DEFAULT_REBOOT; ifo->metric = -1; gethostname(ifo->hostname + 1, sizeof(ifo->hostname)); if (strcmp(ifo->hostname + 1, "(none)") == 0 || |
