From: Steven Barth Date: Fri, 8 Mar 2013 07:58:28 +0000 (+0100) Subject: Add option to not send RELEASE when stopping X-Git-Tag: debian/1.1+git20160131-1~173 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=e8b07f018cbdf8f2a08f93af46904e7ffb9eb123;p=odhcp6c.git Add option to not send RELEASE when stopping --- diff --git a/src/odhcp6c.c b/src/odhcp6c.c index b67ed11..50404af 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -41,7 +41,7 @@ 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; +static bool bound = false, allow_slaac_only = true, release = true; int main(_unused int argc, char* const argv[]) @@ -59,7 +59,7 @@ int main(_unused int argc, char* const argv[]) bool help = false, daemonize = false; int c, request_pd = 0; - while ((c = getopt(argc, argv, "SN:P:c:r:s:hdp:")) != -1) { + while ((c = getopt(argc, argv, "SN:P:c:r:s:khdp:")) != -1) { switch (c) { case 'S': allow_slaac_only = false; @@ -112,6 +112,10 @@ int main(_unused int argc, char* const argv[]) script = optarg; break; + case 'k': + release = false; + break; + case 'd': daemonize = true; break; @@ -282,7 +286,7 @@ int main(_unused int argc, char* const argv[]) bound = false; script_call("unbound"); - if (server_id_len > 0 && (ia_pd_len > 0 || ia_na_len > 0)) + if (server_id_len > 0 && (ia_pd_len > 0 || ia_na_len > 0) && release) dhcpv6_request(DHCPV6_MSG_RELEASE); odhcp6c_clear_state(STATE_IA_NA); @@ -305,6 +309,7 @@ static int usage(void) " -c Override client-ID (base-16 encoded)\n" " -r Options to be requested (comma-separated)\n" " -s