diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-09-20 08:49:36 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-09-20 08:49:36 +0000 |
commit | bf2ecffe96e2185085322fc49e14ac3f7b6ef9b4 (patch) | |
tree | d59a4b4736f85e1ac28ecc325ab948ba8deafb83 /usr.sbin | |
parent | e87c2ae806a6eaa60f4882e240d7cb9a2d3be647 (diff) |
add -1 option: Try once, if we fail, EXIT
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient.8 | 3 | ||||
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient.c | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/dhcp/dhclient/dhclient.8 b/usr.sbin/dhcp/dhclient/dhclient.8 index dd8c12777cb..3439bf7ce18 100644 --- a/usr.sbin/dhcp/dhclient/dhclient.8 +++ b/usr.sbin/dhcp/dhclient/dhclient.8 @@ -45,6 +45,9 @@ dhclient - Dynamic Host Configuration Protocol Client .I port ] [ +.B -1 +] +[ .B -d ] [ diff --git a/usr.sbin/dhcp/dhclient/dhclient.c b/usr.sbin/dhcp/dhclient/dhclient.c index 161389c0744..719dc7a7ed5 100644 --- a/usr.sbin/dhcp/dhclient/dhclient.c +++ b/usr.sbin/dhcp/dhclient/dhclient.c @@ -56,7 +56,7 @@ #ifndef lint static char copyright[] = -"$Id: dhclient.c,v 1.1 1998/09/12 08:55:14 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.2 1998/09/20 08:49:35 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -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 { @@ -244,7 +247,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 () @@ -1094,6 +1097,8 @@ 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 ("No working leases in persistent database - sleeping.\n"); script_init (ip, "FAIL", (struct string_list *)0); if (ip -> client -> alias) |