X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=src%2Fodhcp6c.c;h=2668d949bdedc9050572f3497ab06e62d04b9870;hb=b4a0f3d74b04074eae21e88fbf5b8f2ddc150f86;hp=1e8e2bc9a4023da3381578b7d56f304d959bf858;hpb=6bc0cfdb63197040a0f40e4323b3e3c48f3ed6cb;p=odhcp6c.git diff --git a/src/odhcp6c.c b/src/odhcp6c.c index 1e8e2bc..2668d94 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -1,5 +1,5 @@ /** - * Copyright (C) 2012-2013 Steven Barth + * Copyright (C) 2012-2014 Steven Barth * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2 as published by @@ -62,7 +62,7 @@ int main(_unused int argc, char* const argv[]) char *optpos; uint16_t opttype; enum odhcp6c_ia_mode ia_na_mode = IA_MODE_TRY; - enum odhcp6c_ia_mode ia_pd_mode = IA_MODE_TRY; + enum odhcp6c_ia_mode ia_pd_mode = IA_MODE_NONE; int ia_pd_iaid_index = 0; static struct in6_addr ifid = IN6ADDR_ANY_INIT; int sol_timeout = DHCPV6_SOL_MAX_RT; @@ -104,6 +104,9 @@ int main(_unused int argc, char* const argv[]) break; case 'P': + if (ia_pd_mode == IA_MODE_NONE) + ia_pd_mode = IA_MODE_TRY; + if (allow_slaac_only >= 0 && allow_slaac_only < 10) allow_slaac_only = 10; @@ -112,7 +115,7 @@ int main(_unused int argc, char* const argv[]) int prefix_length = strtoul(optarg, &iaid_begin, 10); - if (*iaid_begin != '\0' && *iaid_begin != ',') { + if (*iaid_begin != '\0' && *iaid_begin != ',' && *iaid_begin != ':') { syslog(LOG_ERR, "invalid argument: '%s'", optarg); return 1; } @@ -121,8 +124,10 @@ int main(_unused int argc, char* const argv[]) if (*iaid_begin == ',' && (iaid_len = strlen(iaid_begin)) > 1) memcpy(&prefix.iaid, iaid_begin + 1, iaid_len > 4 ? 4 : iaid_len); + else if (*iaid_begin == ':') + prefix.iaid = htonl((uint32_t)strtoul(&iaid_begin[1], NULL, 16)); else - prefix.iaid = ++ia_pd_iaid_index; + prefix.iaid = htonl(++ia_pd_iaid_index); odhcp6c_add_state(STATE_IA_PD_INIT, &prefix, sizeof(prefix)); @@ -436,7 +441,7 @@ static int usage(void) " -k Don't send a RELEASE when stopping\n" " -t Maximum timeout for DHCPv6-SOLICIT (120)\n" "\nInvocation options:\n" - " -p Set pidfile (/var/run/6relayd.pid)\n" + " -p Set pidfile (/var/run/odhcp6c.pid)\n" " -d Daemonize\n" " -e Write logmessages to stderr\n" //" -v Increase logging verbosity\n"