a RDNSS option.
This involves changing our options to an unsigned long long so we can use
more than 32 bits.
* Otherwise we add static routes and then routers. */
struct rt *
get_option_routes(const struct dhcp_message *dhcp,
- const char *ifname, int *opts)
+ const char *ifname, unsigned long long *opts)
{
const uint8_t *p;
const uint8_t *e;
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 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
#define is_bootp(m) (m && \
!IN_LINKLOCAL(htonl((m)->yiaddr)) && \
get_option_uint8(NULL, m, DHO_MESSAGETYPE) == -1)
-struct rt *get_option_routes(const struct dhcp_message *, const char *, int *);
+struct rt *get_option_routes(const struct dhcp_message *, const char *,
+ unsigned long long *);
ssize_t decode_rfc3397(char *, ssize_t, int, const uint8_t *);
ssize_t configure_env(char **, const char *, const struct dhcp_message *,
const struct if_options *);
#define RELEASE_DELAY_S 0
#define RELEASE_DELAY_NS 10000000
-int options = 0;
+unsigned long long options = 0;
int pidfd = -1;
struct interface *ifaces = NULL;
int ifac = 0;
-.\" Copyright (c) 2006-2011 Roy Marples
+.\" Copyright (c) 2006-2012 Roy Marples
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 15, 2011
+.Dd March 7, 2012
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
.It Ic interface Ar interface
Subsequent options are only parsed for this
.Ar interface .
+.It Ic ipv6ra_fork
+By default, when
+.Nm dhcpcd
+receives an IPv6 RA,
+.Nm dhcpcd
+will only fork to the background if the RA contains at least one unexpired
+RDNSS option.
+Set this option so to make
+.Nm dhcpcd
+always fork on an RA.
.It Ic leasetime Ar seconds
Request a leasetime of
.Ar seconds .
};
extern int pidfd;
-extern int options;
+extern unsigned long long options;
extern int ifac;
extern char **ifav;
extern int ifdc;
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 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
#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'},
{"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'}
};
ifo->fallback = xstrdup(arg);
break;
case O_NOIPV6RS:
- ifo->options &=~ DHCPCD_IPV6RS;
+ ifo->options &= ~DHCPCD_IPV6RS;
+ break;
+ case O_IPV6_RA_FORK:
+ ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS;
break;
default:
return 0;
/* Seed our default options */
ifo = xzalloc(sizeof(*ifo));
ifo->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE | DHCPCD_LINK;
- ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL | DHCPCD_IPV6RS;
+ ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL;
+ ifo->options |= DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS;
ifo->timeout = DEFAULT_TIMEOUT;
ifo->reboot = DEFAULT_REBOOT;
ifo->metric = -1;
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 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
#define USERCLASS_MAX_LEN 255
#define VENDOR_MAX_LEN 255
-#define DHCPCD_ARP (1 << 0)
-#define DHCPCD_RELEASE (1 << 1)
-#define DHCPCD_DOMAIN (1 << 2)
-#define DHCPCD_GATEWAY (1 << 3)
-#define DHCPCD_STATIC (1 << 4)
-#define DHCPCD_DEBUG (1 << 5)
-#define DHCPCD_LASTLEASE (1 << 7)
-#define DHCPCD_INFORM (1 << 8)
-#define DHCPCD_REQUEST (1 << 9)
-#define DHCPCD_IPV4LL (1 << 10)
-#define DHCPCD_DUID (1 << 11)
-#define DHCPCD_PERSISTENT (1 << 12)
-#define DHCPCD_DAEMONISE (1 << 14)
-#define DHCPCD_DAEMONISED (1 << 15)
-#define DHCPCD_TEST (1 << 16)
-#define DHCPCD_MASTER (1 << 17)
-#define DHCPCD_HOSTNAME (1 << 18)
-#define DHCPCD_CLIENTID (1 << 19)
-#define DHCPCD_LINK (1 << 20)
-#define DHCPCD_QUIET (1 << 21)
-#define DHCPCD_BACKGROUND (1 << 22)
-#define DHCPCD_VENDORRAW (1 << 23)
-#define DHCPCD_TIMEOUT_IPV4LL (1 << 24)
-#define DHCPCD_WAITIP (1 << 25)
-#define DHCPCD_WAITUP (1 << 26)
-#define DHCPCD_CSR_WARNED (1 << 27)
-#define DHCPCD_XID_HWADDR (1 << 28)
-#define DHCPCD_BROADCAST (1 << 29)
-#define DHCPCD_DUMPLEASE (1 << 30)
-#define DHCPCD_IPV6RS (1 << 31)
+#define DHCPCD_ARP (1ULL << 0)
+#define DHCPCD_RELEASE (1ULL << 1)
+#define DHCPCD_DOMAIN (1ULL << 2)
+#define DHCPCD_GATEWAY (1ULL << 3)
+#define DHCPCD_STATIC (1ULL << 4)
+#define DHCPCD_DEBUG (1ULL << 5)
+#define DHCPCD_LASTLEASE (1ULL << 7)
+#define DHCPCD_INFORM (1ULL << 8)
+#define DHCPCD_REQUEST (1ULL << 9)
+#define DHCPCD_IPV4LL (1ULL << 10)
+#define DHCPCD_DUID (1ULL << 11)
+#define DHCPCD_PERSISTENT (1ULL << 12)
+#define DHCPCD_DAEMONISE (1ULL << 14)
+#define DHCPCD_DAEMONISED (1ULL << 15)
+#define DHCPCD_TEST (1ULL << 16)
+#define DHCPCD_MASTER (1ULL << 17)
+#define DHCPCD_HOSTNAME (1ULL << 18)
+#define DHCPCD_CLIENTID (1ULL << 19)
+#define DHCPCD_LINK (1ULL << 20)
+#define DHCPCD_QUIET (1ULL << 21)
+#define DHCPCD_BACKGROUND (1ULL << 22)
+#define DHCPCD_VENDORRAW (1ULL << 23)
+#define DHCPCD_TIMEOUT_IPV4LL (1ULL << 24)
+#define DHCPCD_WAITIP (1ULL << 25)
+#define DHCPCD_WAITUP (1ULL << 26)
+#define DHCPCD_CSR_WARNED (1ULL << 27)
+#define DHCPCD_XID_HWADDR (1ULL << 28)
+#define DHCPCD_BROADCAST (1ULL << 29)
+#define DHCPCD_DUMPLEASE (1ULL << 30)
+#define DHCPCD_IPV6RS (1ULL << 31)
+#define DHCPCD_IPV6RA_REQRDNSS (1ULL << 32)
extern const struct option cf_options[];
uint32_t leasetime;
time_t timeout;
time_t reboot;
- int options;
+ unsigned long long options;
struct in_addr req_addr;
struct in_addr req_mask;
'\0';
} else
opt = xstrdup(cbp);
- has_dns = 1;
+ if (lifetime > 0)
+ has_dns = 1;
}
op += sizeof(addr.s6_addr);
}
if (options & DHCPCD_TEST)
exit(EXIT_SUCCESS);
+ /* If we don't require RDNSS then set has_dns = 1 so we fork */
+ if (!(ifp->state->options->options & DHCPCD_IPV6RA_REQRDNSS))
+ has_dns = 1;
+
if (has_dns)
delete_q_timeout(0, handle_exit_timeout, NULL);
delete_timeouts(ifp, NULL);