summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-02-10 23:51:25 +0000
committerobrien <obrien@FreeBSD.org>1999-02-10 23:51:25 +0000
commit436c49a681de263ab25a60035c0e535345ffb00c (patch)
tree50939f02c94c1f9e41e9552f75f02355ccbd39e9 /contrib
parent1c3a6910099e50f4f934a5b8bd0b21750509232d (diff)
downloadFreeBSD-src-436c49a681de263ab25a60035c0e535345ffb00c.zip
FreeBSD-src-436c49a681de263ab25a60035c0e535345ffb00c.tar.gz
add -1 option: Try once, if we fail, EXIT
Obtained from: OpenBSD
Diffstat (limited to 'contrib')
-rw-r--r--contrib/isc-dhcp/client/dhclient.86
-rw-r--r--contrib/isc-dhcp/client/dhclient.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/contrib/isc-dhcp/client/dhclient.8 b/contrib/isc-dhcp/client/dhclient.8
index 625296d..a6f2d55 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 eb4d268..a5fbdba 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)
OpenPOWER on IntegriCloud