diff options
| author | Roy Marples <roy@marples.name> | 2009-03-19 17:52:12 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-03-19 17:52:12 +0000 |
| commit | 1abffd5ba55b4e4a2a149001a33349ef39139457 (patch) | |
| tree | 48da83c4a9a64018cfc66e5566531361b7260a9b /if-options.c | |
| parent | 194b1fcb081f274e5759158267bf930f1bf57708 (diff) | |
| download | dhcpcd-1abffd5ba55b4e4a2a149001a33349ef39139457.tar.xz | |
We can now detected primary addresses added or changed in BSD.
As such, we can wait for a 3RDPARTY to configure the interface, such as PPP.
We can then take the destination addess and automatically give it a default
route or any other DHCP option such as DNS servers.
This addresses #159.
Diffstat (limited to 'if-options.c')
| -rw-r--r-- | if-options.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/if-options.c b/if-options.c index c49031df..e7c38d24 100644 --- a/if-options.c +++ b/if-options.c @@ -78,6 +78,7 @@ const struct option cf_options[] = { {"clientid", optional_argument, NULL, 'I'}, {"nolink", no_argument, NULL, 'K'}, {"noipv4ll", no_argument, NULL, 'L'}, + {"destination", required_argument, NULL, 'N'}, {"nooption", optional_argument, NULL, 'O'}, {"require", required_argument, NULL, 'Q'}, {"static", required_argument, NULL, 'S'}, @@ -543,6 +544,16 @@ parse_option(struct if_options *ifo, int opt, const char *arg) case 'L': ifo->options &= ~DHCPCD_IPV4LL; break; + case 'N': + if (make_option_mask(ifo->dstmask, arg, 2) != 0) { + if (errno == EINVAL) + syslog(LOG_ERR, "option `%s' does not take" + " an IPv4 address", arg); + else + syslog(LOG_ERR, "unknown otpion `%s'", arg); + return -1; + } + break; case 'O': if (make_option_mask(ifo->requestmask, arg, -1) != 0 || make_option_mask(ifo->requiremask, arg, -1) != 0 || @@ -608,8 +619,8 @@ parse_option(struct if_options *ifo, int opt, const char *arg) rt->next = xmalloc(sizeof(*rt)); rt = rt->next; } - rt->dest.s_addr = 0; - rt->net.s_addr = 0; + rt->dest.s_addr = INADDR_ANY; + rt->net.s_addr = INADDR_ANY; rt->next = NULL; if (parse_addr(&rt->gate, NULL, p) == -1) return -1; |
