From d09e94fff82440cedf04f2e0cfe1ede8a0ab0600 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 5 May 2013 15:56:42 +0200 Subject: [PATCH] Set a global default DHCPv6 exchange timeout This delays SLAAC-updates before any DHCPv6-binding is established. --- src/odhcp6c.c | 23 +++++++++++------------ src/odhcp6c.h | 1 + src/script.c | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/odhcp6c.c b/src/odhcp6c.c index a97e4c9..6ce9adf 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -40,8 +40,8 @@ static uint8_t *state_data[_STATE_MAX] = {NULL}; static size_t state_len[_STATE_MAX] = {0}; static volatile int do_signal = 0; -static int urandom_fd = -1; -static bool bound = false, allow_slaac_only = true, release = true; +static int urandom_fd = -1, allow_slaac_only = 15; +static bool bound = false, release = true; int main(_unused int argc, char* const argv[]) @@ -58,10 +58,10 @@ int main(_unused int argc, char* const argv[]) bool help = false, daemonize = false; int logopt = LOG_PID; int c, request_pd = 0; - while ((c = getopt(argc, argv, "SN:P:c:r:s:khedp:")) != -1) { + while ((c = getopt(argc, argv, "S::N:P:c:r:s:khedp:")) != -1) { switch (c) { case 'S': - allow_slaac_only = false; + allow_slaac_only = (optarg) ? atoi(optarg) : -1; break; case 'N': @@ -76,7 +76,6 @@ int main(_unused int argc, char* const argv[]) break; case 'P': - allow_slaac_only = false; request_pd = strtoul(optarg, NULL, 10); if (request_pd == 0) request_pd = -1; @@ -307,7 +306,7 @@ static int usage(void) const char buf[] = "Usage: odhcp6c [options] \n" "\nFeature options:\n" - " -S Don't allow SLAAC-only (implied by -P)\n" + " -S