diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 1999-02-10 23:51:25 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 1999-02-10 23:51:25 +0000 |
commit | d2c596b2e720774e8868d599616659656128e8a4 (patch) | |
tree | ae8f57666238202b7785137c261647628c4d9fbe /contrib/isc-dhcp | |
parent | ddb444e895272c96aa60985866a7e62ba69a9bd4 (diff) | |
download | src-d2c596b2e720774e8868d599616659656128e8a4.tar.gz src-d2c596b2e720774e8868d599616659656128e8a4.zip |
add -1 option: Try once, if we fail, EXIT
Obtained from: OpenBSD
Notes
Notes:
svn path=/head/; revision=43861
Diffstat (limited to 'contrib/isc-dhcp')
-rw-r--r-- | contrib/isc-dhcp/client/dhclient.8 | 6 | ||||
-rw-r--r-- | contrib/isc-dhcp/client/dhclient.c | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/contrib/isc-dhcp/client/dhclient.8 b/contrib/isc-dhcp/client/dhclient.8 index 625296d6b4d5..a6f2d5512b08 100644 --- a/contrib/isc-dhcp/client/dhclient.8 +++ b/contrib/isc-dhcp/client/dhclient.8 @@ -45,6 +45,9 @@ dhclient - Dynamic Host Configuration Protocol Client .I port ] [ +.B -1 +] +[ .B -d ] [ @@ -128,6 +131,9 @@ To run force dhclient to always run as a foreground process, the .B -d flag should be specified. This is useful when running dhclient under a debugger, or when running it out of inittab on System V systems. +The +.B -1 +flag cause dhclient to try once to get a lease. If it fails, dhclient exits. .PP .SH CONFIGURATION The syntax of the dhclient.conf(8) file is discussed seperately. diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c index eb4d268f9768..a5fbdbac6cda 100644 --- a/contrib/isc-dhcp/client/dhclient.c +++ b/contrib/isc-dhcp/client/dhclient.c @@ -92,6 +92,7 @@ u_int16_t remote_port; int log_priority; int no_daemon; int save_scripts; +int onetry; static void usage PROTO ((void)); @@ -126,6 +127,8 @@ int main (argc, argv, envp) no_daemon = 1; } else if (!strcmp (argv [i], "-D")) { save_scripts = 1; + } else if (!strcmp (argv [i], "-1")) { + onetry = 1; } else if (argv [i][0] == '-') { usage (); } else { @@ -240,7 +243,7 @@ int main (argc, argv, envp) static void usage () { - error ("Usage: dhclient [-c] [-p <port>] [interface]"); + error ("Usage: dhclient [-1] [-c] [-p <port>] [interface]"); } void cleanup () @@ -1090,6 +1093,10 @@ void state_panic (ipp) /* No leases were available, or what was available didn't work, so tell the shell script that we failed to allocate an address, and try again later. */ + if (onetry) { + exit(1); + note ("Unable to obtain a lease on first try - exiting.\n"); + } note ("No working leases in persistent database - sleeping.\n"); script_init (ip, "FAIL", (struct string_list *)0); if (ip -> client -> alias) |