diff options
Diffstat (limited to 'if-options.c')
-rw-r--r-- | if-options.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/if-options.c b/if-options.c index 9e77f2b..3f52bfe 100644 --- a/if-options.c +++ b/if-options.c @@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2010 Roy Marples <roy@marples.name> + * Copyright (c) 2006-2012 Roy Marples <roy@marples.name> * All rights reserved * Redistribution and use in source and binary forms, with or without @@ -53,6 +53,8 @@ #define O_ARPING O_BASE + 1 #define O_FALLBACK O_BASE + 2 #define O_DESTINATION O_BASE + 3 +#define O_NOIPV6RS O_BASE + 4 +#define O_IPV6_RA_FORK O_BASE + 5 const struct option cf_options[] = { {"background", no_argument, NULL, 'b'}, @@ -103,6 +105,8 @@ const struct option cf_options[] = { {"arping", required_argument, NULL, O_ARPING}, {"destination", required_argument, NULL, O_DESTINATION}, {"fallback", required_argument, NULL, O_FALLBACK}, + {"noipv6rs", no_argument, NULL, O_NOIPV6RS}, + {"ipv6ra_fork", no_argument, NULL, O_IPV6_RA_FORK}, {NULL, 0, NULL, '\0'} }; @@ -626,11 +630,16 @@ parse_option(struct if_options *ifo, int opt, const char *arg) } p++; if (strncmp(arg, "ip_address=", strlen("ip_address=")) == 0) { - if (parse_addr(&ifo->req_addr, &ifo->req_mask, p) != 0) + if (parse_addr(&ifo->req_addr, + ifo->req_mask.s_addr == 0 ? &ifo->req_mask : NULL, + p) != 0) return -1; ifo->options |= DHCPCD_STATIC; ifo->options &= ~DHCPCD_INFORM; + } else if (strncmp(arg, "subnet_mask=", strlen("subnet_mask=")) == 0) { + if (parse_addr(&ifo->req_mask, NULL, p) != 0) + return -1; } else if (strncmp(arg, "routes=", strlen("routes=")) == 0 || strncmp(arg, "static_routes=", strlen("static_routes=")) == 0 || strncmp(arg, "classless_static_routes=", strlen("classless_static_routes=")) == 0 || @@ -736,6 +745,12 @@ parse_option(struct if_options *ifo, int opt, const char *arg) free(ifo->fallback); ifo->fallback = xstrdup(arg); break; + case O_NOIPV6RS: + ifo->options &= ~DHCPCD_IPV6RS; + break; + case O_IPV6_RA_FORK: + ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS; + break; default: return 0; } @@ -779,8 +794,9 @@ read_config(const char *file, /* Seed our default options */ ifo = xzalloc(sizeof(*ifo)); - ifo->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE; - ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL | DHCPCD_LINK; + ifo->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE | DHCPCD_LINK; + ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL; + ifo->options |= DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS; ifo->timeout = DEFAULT_TIMEOUT; ifo->reboot = DEFAULT_REBOOT; ifo->metric = -1; |