summaryrefslogtreecommitdiffstats
path: root/contrib/isc-dhcp/client
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-09-02 11:01:27 +0000
committermbr <mbr@FreeBSD.org>2003-09-02 11:01:27 +0000
commit01d6785b064ff1c167a88559ba3b063da88c9001 (patch)
tree580e79c7b338ca1e7d43b1f0f9b8b7aa66395f02 /contrib/isc-dhcp/client
parent4a18459fb2d726b5dea9b7fbc0fa073ceca7579a (diff)
downloadFreeBSD-src-01d6785b064ff1c167a88559ba3b063da88c9001.zip
FreeBSD-src-01d6785b064ff1c167a88559ba3b063da88c9001.tar.gz
Import ISC DHCP 3.0.1 RC12 client.
Diffstat (limited to 'contrib/isc-dhcp/client')
-rw-r--r--contrib/isc-dhcp/client/clparse.c27
-rw-r--r--contrib/isc-dhcp/client/dhclient.c72
-rw-r--r--contrib/isc-dhcp/client/dhclient.conf.54
-rwxr-xr-xcontrib/isc-dhcp/client/scripts/freebsd16
4 files changed, 81 insertions, 38 deletions
diff --git a/contrib/isc-dhcp/client/clparse.c b/contrib/isc-dhcp/client/clparse.c
index 2ec186e..c0c1866 100644
--- a/contrib/isc-dhcp/client/clparse.c
+++ b/contrib/isc-dhcp/client/clparse.c
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.62.2.3 2002/11/17 02:25:43 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.62.2.4 2003/02/10 00:39:57 dhankins Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -617,34 +617,41 @@ void parse_option_list (cfile, list)
struct parse *cfile;
u_int32_t **list;
{
- int ix, i;
+ int ix;
int token;
const char *val;
pair p = (pair)0, q, r;
+ struct option *option;
ix = 0;
do {
- token = next_token (&val, (unsigned *)0, cfile);
- if (token == SEMI)
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == SEMI) {
+ token = next_token (&val, (unsigned *)0, cfile);
break;
+ }
if (!is_identifier (token)) {
parse_warn (cfile, "%s: expected option name.", val);
+ token = next_token (&val, (unsigned *)0, cfile);
skip_to_semi (cfile);
return;
}
- for (i = 0; i < 256; i++) {
- if (!strcasecmp (dhcp_options [i].name, val))
- break;
- }
- if (i == 256) {
+ option = parse_option_name (cfile, 0, NULL);
+ if (!option) {
parse_warn (cfile, "%s: expected option name.", val);
+ return;
+ }
+ if (option -> universe != &dhcp_universe) {
+ parse_warn (cfile,
+ "%s.%s: Only global options allowed.",
+ option -> universe -> name, option->name );
skip_to_semi (cfile);
return;
}
r = new_pair (MDL);
if (!r)
log_fatal ("can't allocate pair for option code.");
- r -> car = (caddr_t)(long)i;
+ r -> car = (caddr_t)(long)option -> code;
r -> cdr = (pair)0;
if (p)
q -> cdr = r;
diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c
index d2e1342..817a9e2 100644
--- a/contrib/isc-dhcp/client/dhclient.c
+++ b/contrib/isc-dhcp/client/dhclient.c
@@ -41,7 +41,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.129.2.12 2002/11/07 23:26:38 dhankins Exp $ Copyright (c) 1995-2002 Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.129.2.16 2003/04/26 21:51:39 dhankins Exp $ Copyright (c) 1995-2002 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -192,6 +192,8 @@ int main (argc, argv, envp)
if (++i == argc)
usage ();
relay = argv [i];
+ } else if (!strcmp (argv [i], "-nw")) {
+ nowait = 1;
} else if (!strcmp (argv [i], "-n")) {
/* do not start up any interfaces */
interfaces_requested = 1;
@@ -212,8 +214,6 @@ int main (argc, argv, envp)
} else if (!strcmp (argv [i], "--version")) {
log_info ("isc-dhclient-%s", DHCP_VERSION);
exit (0);
- } else if (!strcmp (argv [i], "-nw")) {
- nowait = 1;
} else if (argv [i][0] == '-') {
usage ();
} else {
@@ -252,15 +252,24 @@ int main (argc, argv, envp)
/* first kill of any currently running client */
if (release_mode) {
- /* XXX inelegant hack to prove concept */
- char command[1024];
-
-#if !defined (NO_SNPRINTF)
- snprintf (command, 1024, "kill `cat %s`", path_dhclient_pid);
-#else
- sprintf (command, "kill `cat %s`", path_dhclient_pid);
-#endif
- system (command);
+ FILE *pidfd;
+ pid_t oldpid;
+ long temp;
+ int e;
+
+ oldpid = 0;
+ if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
+ e = fscanf(pidfd, "%ld\n", &temp);
+ oldpid = (pid_t)temp;
+
+ if (e != 0 && e != EOF) {
+ if (oldpid) {
+ if (kill(oldpid, SIGTERM) == 0)
+ unlink(path_dhclient_pid);
+ }
+ }
+ fclose(pidfd);
+ }
}
if (!quiet) {
@@ -1869,10 +1878,17 @@ void make_discover (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet,
- (struct lease *)0, client, 0,
- (struct option_state *)0, options,
- &global_scope, 0, 0, 0, (struct data_string *)0,
+ (struct lease *)0, client,
+ /* maximum packet size */1500,
+ (struct option_state *)0,
+ options,
+ /* scope */ &global_scope,
+ /* overload */ 0,
+ /* terminate */0,
+ /* bootpp */0,
+ (struct data_string *)0,
client -> config -> vendor_space_name);
+
option_state_dereference (&options, MDL);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -1936,10 +1952,17 @@ void make_request (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet,
- (struct lease *)0, client, 0,
- (struct option_state *)0, client -> sent_options,
- &global_scope, 0, 0, 0, (struct data_string *)0,
+ (struct lease *)0, client,
+ /* maximum packet size */1500,
+ (struct option_state *)0,
+ client -> sent_options,
+ /* scope */ &global_scope,
+ /* overload */ 0,
+ /* terminate */0,
+ /* bootpp */0,
+ (struct data_string *)0,
client -> config -> vendor_space_name);
+
option_state_dereference (&client -> sent_options, MDL);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -2065,10 +2088,17 @@ void make_release (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet,
- (struct lease *)0, client, 0,
- (struct option_state *)0, options,
- &global_scope, 0, 0, 0, (struct data_string *)0,
+ (struct lease *)0, client,
+ /* maximum packet size */1500,
+ (struct option_state *)0,
+ options,
+ /* scope */ &global_scope,
+ /* overload */ 0,
+ /* terminate */0,
+ /* bootpp */0,
+ (struct data_string *)0,
client -> config -> vendor_space_name);
+
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
option_state_dereference (&options, MDL);
diff --git a/contrib/isc-dhcp/client/dhclient.conf.5 b/contrib/isc-dhcp/client/dhclient.conf.5
index 2cf5fe8..9b3b200 100644
--- a/contrib/isc-dhcp/client/dhclient.conf.5
+++ b/contrib/isc-dhcp/client/dhclient.conf.5
@@ -35,7 +35,7 @@
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
.\" ``http://www.nominum.com''.
.\"
-.\" $Id: dhclient.conf.5,v 1.12.2.8 2002/11/17 02:25:43 dhankins Exp $
+.\" $Id: dhclient.conf.5,v 1.12.2.9 2003/02/23 03:27:26 dhankins Exp $
.\"
.TH dhclient.conf 5
.SH NAME
@@ -446,7 +446,7 @@ automatically determine the type of network to which they are
connected. The media setup string is a system-dependent parameter
which is passed to the dhcp client configuration script when
initializing the interface. On Unix and Unix-like systems, the
-argument is passed on the ifconfig command line when configuring te
+argument is passed on the ifconfig command line when configuring the
interface.
.PP
The dhcp client automatically declares this parameter if it uses a
diff --git a/contrib/isc-dhcp/client/scripts/freebsd b/contrib/isc-dhcp/client/scripts/freebsd
index f9d61b5..824efae 100755
--- a/contrib/isc-dhcp/client/scripts/freebsd
+++ b/contrib/isc-dhcp/client/scripts/freebsd
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
+# $Id: freebsd,v 1.13.2.5 2003/04/27 19:44:01 dhankins Exp $
#
# $FreeBSD$
@@ -13,13 +13,19 @@ fi
make_resolv_conf() {
if [ x"$new_domain_name_servers" != x ]; then
if [ "x$new_domain_name" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
+ ( echo search $new_domain_name >/etc/resolv.conf )
+ exit_status=$?
else
rm /etc/resolv.conf
+ exit_status=$?
+ fi
+ if [ $exit_status -ne 0 ]; then
+ $LOGGER "WARNING: Unable to update resolv.conf: Error $exit_status"
+ else
+ for nameserver in $new_domain_name_servers; do
+ ( echo nameserver $nameserver >>/etc/resolv.conf )
+ done
fi
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
fi
}
OpenPOWER on IntegriCloud