mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-30 13:44:55 +00:00
Fix conflicts.
This commit is contained in:
parent
84c2add343
commit
76505dc90c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46279
|
@ -1,6 +1,6 @@
|
|||
# ex:ts=8
|
||||
|
||||
ISC DHCP client 2.0b1pl18
|
||||
ISC DHCP client 2.0b1pl27
|
||||
originals can be found at: ftp://ftp.isc.org/isc/dhcp/
|
||||
|
||||
|
||||
|
@ -20,17 +20,18 @@ For the import of ISC-dhclient the following files were removed:
|
|||
Makefile.dist dhcp-options.cat5 dlpi.c
|
||||
|
||||
include/cf/
|
||||
alphaosf.h bsdos.h cygwin32.h
|
||||
hpux.h linux.h netbsd.h
|
||||
nextstep.h qnx.h rhapsody.h
|
||||
sample.h sco.h sunos4.h
|
||||
sunos5-5.h ultrix.h
|
||||
aix.h alphaosf.h bsdos.h
|
||||
cygwin32.h hpux.h irix.h
|
||||
linux.h netbsd.h nextstep.h
|
||||
qnx.h rhapsody.h sample.h
|
||||
sco.h sunos4.h sunos5-5.h
|
||||
ultrix.h
|
||||
|
||||
|
||||
Imported by:
|
||||
|
||||
cvs import -ko -m 'Virgin import of ISC-DHCP v2.0b1pl18' \
|
||||
src/contrib/isc-dhcp ISC isc_dhcp_2_0_b_1_pl_18
|
||||
cvs import -ko -m 'Virgin import of ISC-DHCP v2.0b1pl27' \
|
||||
src/contrib/isc-dhcp ISC isc_dhcp_2_0_b_1_pl_27
|
||||
|
||||
|
||||
To make local changes to isc-dhcp, simply patch and commit to the main
|
||||
|
@ -40,4 +41,4 @@ All local changes should be submitted to the ISC for inclusion in the
|
|||
next vendor release.
|
||||
|
||||
obrien@NUXI.com
|
||||
28-Feburary-1999
|
||||
1-May-1999
|
||||
|
|
|
@ -42,16 +42,13 @@
|
|||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: clparse.c,v 1.13.2.2 1998/07/10 23:17:00 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: clparse.c,v 1.13.2.4 1999/03/29 21:21:37 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
#include "dhctoken.h"
|
||||
|
||||
static TIME parsed_time;
|
||||
|
||||
struct client_config top_level_config;
|
||||
u_int32_t requested_lease_time;
|
||||
|
||||
/* client-conf-file :== client-declarations EOF
|
||||
client-declarations :== <nil>
|
||||
|
@ -63,9 +60,7 @@ int read_client_conf ()
|
|||
FILE *cfile;
|
||||
char *val;
|
||||
int token;
|
||||
int declaration = 0;
|
||||
struct client_config *config;
|
||||
struct client_state *state;
|
||||
struct interface_info *ip;
|
||||
|
||||
new_parse (path_dhclient_conf);
|
||||
|
@ -81,8 +76,8 @@ int read_client_conf ()
|
|||
top_level_config.select_interval = 0;
|
||||
top_level_config.reboot_timeout = 10;
|
||||
top_level_config.retry_interval = 300;
|
||||
top_level_config.backoff_cutoff = 120;
|
||||
top_level_config.initial_interval = 10;
|
||||
top_level_config.backoff_cutoff = 15;
|
||||
top_level_config.initial_interval = 3;
|
||||
top_level_config.bootp_policy = ACCEPT;
|
||||
top_level_config.script_name = "/sbin/dhclient-script";
|
||||
top_level_config.requested_options
|
||||
|
@ -106,11 +101,6 @@ int read_client_conf ()
|
|||
top_level_config.requested_options
|
||||
[top_level_config.requested_option_count++] =
|
||||
DHO_HOST_NAME;
|
||||
requested_lease_time = 7200;
|
||||
top_level_config.send_options [DHO_DHCP_LEASE_TIME].data
|
||||
= (unsigned char *)&requested_lease_time;
|
||||
top_level_config.send_options [DHO_DHCP_LEASE_TIME].len
|
||||
= sizeof requested_lease_time;
|
||||
|
||||
if ((cfile = fopen (path_dhclient_conf, "r")) != NULL) {
|
||||
do {
|
||||
|
@ -333,7 +323,6 @@ int parse_X (cfile, buf, max)
|
|||
int token;
|
||||
char *val;
|
||||
int len;
|
||||
u_int8_t *s;
|
||||
|
||||
token = peek_token (&val, cfile);
|
||||
if (token == NUMBER_OR_NAME || token == NUMBER) {
|
||||
|
@ -427,9 +416,7 @@ void parse_interface_declaration (cfile, outer_config)
|
|||
int token;
|
||||
char *val;
|
||||
|
||||
struct interface_info dummy_interface, *ip;
|
||||
struct client_state dummy_state;
|
||||
struct client_config dummy_config;
|
||||
struct interface_info *ip;
|
||||
|
||||
token = next_token (&val, cfile);
|
||||
if (token != STRING) {
|
||||
|
@ -664,7 +651,6 @@ void parse_client_lease_declaration (cfile, lease, ipp)
|
|||
{
|
||||
int token;
|
||||
char *val;
|
||||
char *t, *n;
|
||||
struct interface_info *ip;
|
||||
|
||||
switch (next_token (&val, cfile)) {
|
||||
|
@ -810,11 +796,6 @@ struct option *parse_option_decl (cfile, options)
|
|||
|
||||
/* Parse the option data... */
|
||||
do {
|
||||
/* Set a flag if this is an array of a simple type (i.e.,
|
||||
not an array of pairs of IP addresses, or something
|
||||
like that. */
|
||||
int uniform = option -> format [1] == 'A';
|
||||
|
||||
for (fmt = option -> format; *fmt; fmt++) {
|
||||
if (*fmt == 'A')
|
||||
break;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
.\" Enterprises. To learn more about the Internet Software Consortium,
|
||||
.\" see ``http://www.isc.org/isc''. To learn more about Vixie
|
||||
.\" Enterprises, see ``http://www.vix.com''.
|
||||
.TH dhclient 8
|
||||
.TH dhclient-script 8
|
||||
.SH NAME
|
||||
dhclient-script - DHCP client network configuration script
|
||||
.SH DESCRIPTION
|
||||
|
@ -47,15 +47,49 @@ interface's final configuration once a lease has been acquired. If no
|
|||
lease is acquired, the script is used to test predefined leases, if
|
||||
any, and also called once if no valid lease can be identified.
|
||||
.PP
|
||||
This script is not meant to be customized by the end user. However,
|
||||
the script may not work on particular versions of particular operating
|
||||
systems (indeed, no standard script exists for some operating
|
||||
systems), so a pioneering user may well need to create a new script or
|
||||
modify an existing one. In general, customizations specific to a
|
||||
particular computer should be done in the
|
||||
.B /etc/dhclient.conf
|
||||
script. If you find that you can't make such a customization without
|
||||
customizing dhclient-script, please submit a bug report.
|
||||
This script is not meant to be customized by the end user. If local
|
||||
customizations are needed, they should be possible using the enter and
|
||||
exit hooks provided (see HOOKS for details). These hooks will allow the
|
||||
user to override the default behaviour of the client in creating a
|
||||
.B /etc/resolv.conf
|
||||
file.
|
||||
.PP
|
||||
No standard client script exists for some operating systems, even though
|
||||
the actual client may work, so a pioneering user may well need to create
|
||||
a new script or modify an existing one. In general, customizations specific
|
||||
to a particular computer should be done in the
|
||||
.B /sbin/dhclient.conf
|
||||
file. If you find that you can't make such a customization without
|
||||
customizing
|
||||
.B /sbin/dhclient.conf
|
||||
or using the enter and exit hooks, please submit a bug report.
|
||||
.SH HOOKS
|
||||
When it starts, the client script first defines a shell function,
|
||||
.B make_resolv_conf ,
|
||||
which is later used to create the
|
||||
.B /etc/resolv.conf
|
||||
file. To override the default behaviour, redefine this function in
|
||||
the enter hook script.
|
||||
.PP
|
||||
On after defining the make_resolv_conf function, the client script checks
|
||||
for the presence of an executable
|
||||
.B /etc/dhclient-enter-hooks
|
||||
script, and if present, it invokes the script inline, using the Bourne
|
||||
shell '.' command. The entire environment documented under OPERATION
|
||||
is available to this script, which may modify the environment if needed
|
||||
to change the behaviour of the script. If an error occurs during the
|
||||
execution of the script, it can set the exit_status variable to a nonzero
|
||||
value, and
|
||||
.B /sbin/dhclient-script
|
||||
will exit with that error code immediately after the client script exits.
|
||||
.PP
|
||||
After all processing has completed,
|
||||
.B /sbin/dhclient-script
|
||||
checks for the presence of an executable
|
||||
.B /sbin/dhclient-exit-hooks
|
||||
script, which if present is invoked using the '.' command. The exit status
|
||||
is passed in the exit_status shell variable, and will always be zero if the
|
||||
script succeeded at the task for which it was invoked.
|
||||
.SH OPERATION
|
||||
When dhclient needs to invoke the client configuration script, it
|
||||
writes a shell script into /tmp which defines a variety of variables.
|
||||
|
@ -177,7 +211,7 @@ the other. Assuming the information provided by both servers is
|
|||
valid, this shouldn't cause any real problems, but it could be
|
||||
confusing.
|
||||
.SH SEE ALSO
|
||||
dhclient.conf(5), dhclient.leases(5), dhclient(8)
|
||||
dhclient.conf(5), dhclient.leases(5), dhclient(8), dhcpd(8), and dhcrelay(8).
|
||||
.SH AUTHOR
|
||||
.B dhclient-script(8)
|
||||
has been written for the Internet Software Consortium
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static char ocopyright[] =
|
||||
"$Id: dhclient.c,v 1.44.2.25 1999/03/05 16:13:54 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dhclient.c,v 1.44.2.37 1999/04/24 16:55:19 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
@ -93,11 +93,11 @@ int onetry;
|
|||
static char copyright[] =
|
||||
"Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
||||
static char arr [] = "All rights reserved.";
|
||||
static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl18";
|
||||
static char contrib [] = "\nPlease contribute if you find this software useful.";
|
||||
static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n";
|
||||
static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl27";
|
||||
static char contrib [] = "Please contribute if you find this software useful.";
|
||||
static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html";
|
||||
|
||||
static void usage PROTO ((void));
|
||||
static void usage PROTO ((char *));
|
||||
|
||||
int main (argc, argv, envp)
|
||||
int argc;
|
||||
|
@ -108,12 +108,20 @@ int main (argc, argv, envp)
|
|||
struct interface_info *ip;
|
||||
int seed;
|
||||
int quiet = 1;
|
||||
char *s;
|
||||
|
||||
s = strchr (argv [0], '/');
|
||||
if (!s)
|
||||
s = argv [0];
|
||||
else
|
||||
s++;
|
||||
|
||||
/* Initially, log errors to stderr as well as to syslogd. */
|
||||
#ifdef SYSLOG_4_2
|
||||
openlog ("dhclient", LOG_NDELAY);
|
||||
log_priority = LOG_DAEMON;
|
||||
openlog (s, LOG_NDELAY);
|
||||
log_priority = DHCPD_LOG_FACILITY;
|
||||
#else
|
||||
openlog ("dhclient", LOG_NDELAY, LOG_DAEMON);
|
||||
openlog (s, LOG_NDELAY, DHCPD_LOG_FACILITY);
|
||||
#endif
|
||||
|
||||
#if !(defined (DEBUG) || defined (SYSLOG_4_2) || defined (__CYGWIN32__))
|
||||
|
@ -123,7 +131,7 @@ int main (argc, argv, envp)
|
|||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp (argv [i], "-p")) {
|
||||
if (++i == argc)
|
||||
usage ();
|
||||
usage (s);
|
||||
local_port = htons (atoi (argv [i]));
|
||||
debug ("binding to user-specified port %d",
|
||||
ntohs (local_port));
|
||||
|
@ -131,17 +139,21 @@ 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 (!strcmp (argv [i], "-pf")) {
|
||||
if (++i == argc)
|
||||
usage (s);
|
||||
path_dhclient_pid = argv [i];
|
||||
} else if (!strcmp (argv [i], "-lf")) {
|
||||
if (++i == argc)
|
||||
usage ();
|
||||
usage (s);
|
||||
path_dhclient_db = argv [i];
|
||||
} else if (!strcmp (argv [i], "-q")) {
|
||||
quiet = 1;
|
||||
quiet_interface_discovery = 1;
|
||||
} else if (!strcmp (argv [i], "-1")) {
|
||||
onetry = 1;
|
||||
} else if (argv [i][0] == '-') {
|
||||
usage ();
|
||||
usage (s);
|
||||
} else {
|
||||
struct interface_info *tmp =
|
||||
((struct interface_info *)
|
||||
|
@ -162,8 +174,10 @@ int main (argc, argv, envp)
|
|||
note (message);
|
||||
note (copyright);
|
||||
note (arr);
|
||||
note ("");
|
||||
note (contrib);
|
||||
note (url);
|
||||
note ("");
|
||||
}
|
||||
|
||||
/* Default to the DHCP/BOOTP port. */
|
||||
|
@ -269,9 +283,19 @@ int main (argc, argv, envp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void usage ()
|
||||
static void usage (appname)
|
||||
char *appname;
|
||||
{
|
||||
error ("Usage: dhclient [-1] [-c] [-p <port>] [-lf lease-file] [interface]");
|
||||
note (message);
|
||||
note (copyright);
|
||||
note (arr);
|
||||
note ("");
|
||||
note (contrib);
|
||||
note (url);
|
||||
note ("");
|
||||
|
||||
warn ("Usage: %s [-c] [-p <port>] [-lf lease-file]", appname);
|
||||
error (" [-pf pidfile] [-1] [interface]");
|
||||
}
|
||||
|
||||
void cleanup ()
|
||||
|
@ -463,7 +487,6 @@ void dhcpack (packet)
|
|||
{
|
||||
struct interface_info *ip = packet -> interface;
|
||||
struct client_lease *lease;
|
||||
int i;
|
||||
|
||||
/* If we're not receptive to an offer right now, or if the offer
|
||||
has an unrecognizable transaction id, then just drop it. */
|
||||
|
@ -472,7 +495,9 @@ void dhcpack (packet)
|
|||
packet -> raw -> hlen) ||
|
||||
(memcmp (packet -> interface -> hw_address.haddr,
|
||||
packet -> raw -> chaddr, packet -> raw -> hlen))) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPACK in wrong transaction.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -480,7 +505,9 @@ void dhcpack (packet)
|
|||
ip -> client -> state != S_REQUESTING &&
|
||||
ip -> client -> state != S_RENEWING &&
|
||||
ip -> client -> state != S_REBINDING) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPACK in wrong state.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -703,7 +730,6 @@ void dhcpoffer (packet)
|
|||
int arp_timeout_needed, stop_selecting;
|
||||
char *name = (packet -> options [DHO_DHCP_MESSAGE_TYPE].len
|
||||
? "DHCPOFFER" : "BOOTREPLY");
|
||||
struct iaddrlist *ap;
|
||||
|
||||
#ifdef DEBUG_PACKET
|
||||
dump_packet (packet);
|
||||
|
@ -717,7 +743,9 @@ void dhcpoffer (packet)
|
|||
packet -> raw -> hlen) ||
|
||||
(memcmp (packet -> interface -> hw_address.haddr,
|
||||
packet -> raw -> chaddr, packet -> raw -> hlen))) {
|
||||
#if defined (DEBUG)
|
||||
debug ("%s in wrong transaction.", name);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -920,7 +948,9 @@ void dhcpnak (packet)
|
|||
packet -> raw -> hlen) ||
|
||||
(memcmp (packet -> interface -> hw_address.haddr,
|
||||
packet -> raw -> chaddr, packet -> raw -> hlen))) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPNAK in wrong transaction.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -928,7 +958,9 @@ void dhcpnak (packet)
|
|||
ip -> client -> state != S_REQUESTING &&
|
||||
ip -> client -> state != S_RENEWING &&
|
||||
ip -> client -> state != S_REBINDING) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPNAK in wrong state.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1036,10 +1068,11 @@ void send_discover (ipp)
|
|||
ip -> client -> config -> timeout) - cur_time + 1;
|
||||
|
||||
/* Record the number of seconds since we started sending. */
|
||||
if (interval < 255)
|
||||
ip -> client -> packet.secs = interval;
|
||||
if (interval < 65536)
|
||||
ip -> client -> packet.secs = htons (interval);
|
||||
else
|
||||
ip -> client -> packet.secs = 255;
|
||||
ip -> client -> packet.secs = htons (65535);
|
||||
ip -> client -> secs = ip -> client -> packet.secs;
|
||||
|
||||
note ("DHCPDISCOVER on %s to %s port %d interval %ld",
|
||||
ip -> name,
|
||||
|
@ -1283,10 +1316,14 @@ void send_request (ipp)
|
|||
from.s_addr = INADDR_ANY;
|
||||
|
||||
/* Record the number of seconds since we started sending. */
|
||||
if (interval < 255)
|
||||
ip -> client -> packet.secs = interval;
|
||||
else
|
||||
ip -> client -> packet.secs = 255;
|
||||
if (ip -> client -> state == S_REQUESTING)
|
||||
ip -> client -> packet.secs = ip -> client -> secs;
|
||||
else {
|
||||
if (interval < 65536)
|
||||
ip -> client -> packet.secs = htons (interval);
|
||||
else
|
||||
ip -> client -> packet.secs = htons (65535);
|
||||
}
|
||||
|
||||
note ("DHCPREQUEST on %s to %s port %d", ip -> name,
|
||||
inet_ntoa (destination.sin_addr),
|
||||
|
@ -1354,7 +1391,6 @@ void make_discover (ip, lease)
|
|||
struct interface_info *ip;
|
||||
struct client_lease *lease;
|
||||
{
|
||||
struct dhcp_packet *raw;
|
||||
unsigned char discover = DHCPDISCOVER;
|
||||
int i;
|
||||
|
||||
|
@ -1416,8 +1452,8 @@ void make_discover (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1427,7 +1463,12 @@ void make_discover (ip, lease)
|
|||
ip -> client -> packet.hops = 0;
|
||||
ip -> client -> packet.xid = random ();
|
||||
ip -> client -> packet.secs = 0; /* filled in by send_discover. */
|
||||
ip -> client -> packet.flags = htons (BOOTP_BROADCAST); /* XXX */
|
||||
|
||||
if (can_receive_unicast_unconfigured (ip))
|
||||
ip -> client -> packet.flags = 0;
|
||||
else
|
||||
ip -> client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
|
||||
memset (&(ip -> client -> packet.ciaddr),
|
||||
0, sizeof ip -> client -> packet.ciaddr);
|
||||
memset (&(ip -> client -> packet.yiaddr),
|
||||
|
@ -1523,8 +1564,8 @@ void make_request (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1546,7 +1587,10 @@ void make_request (ip, lease)
|
|||
} else {
|
||||
memset (&ip -> client -> packet.ciaddr, 0,
|
||||
sizeof ip -> client -> packet.ciaddr);
|
||||
ip -> client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
if (can_receive_unicast_unconfigured (ip))
|
||||
ip -> client -> packet.flags = 0;
|
||||
else
|
||||
ip -> client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
}
|
||||
|
||||
memset (&ip -> client -> packet.yiaddr, 0,
|
||||
|
@ -1624,8 +1668,8 @@ void make_decline (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1635,7 +1679,7 @@ void make_decline (ip, lease)
|
|||
ip -> client -> packet.hops = 0;
|
||||
ip -> client -> packet.xid = ip -> client -> xid;
|
||||
ip -> client -> packet.secs = 0; /* Filled in by send_request. */
|
||||
ip -> client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
ip -> client -> packet.flags = 0;
|
||||
|
||||
/* ciaddr must always be zero. */
|
||||
memset (&ip -> client -> packet.ciaddr, 0,
|
||||
|
@ -1664,7 +1708,6 @@ void make_release (ip, lease)
|
|||
|
||||
struct tree_cache *options [256];
|
||||
struct tree_cache message_type_tree;
|
||||
struct tree_cache requested_address_tree;
|
||||
struct tree_cache server_id_tree;
|
||||
|
||||
memset (options, 0, sizeof options);
|
||||
|
@ -1690,8 +1733,8 @@ void make_release (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1702,8 +1745,9 @@ void make_release (ip, lease)
|
|||
ip -> client -> packet.xid = random ();
|
||||
ip -> client -> packet.secs = 0;
|
||||
ip -> client -> packet.flags = 0;
|
||||
memcpy (&ip -> client -> packet.ciaddr,
|
||||
lease -> address.iabuf, lease -> address.len);
|
||||
|
||||
memset (&ip -> client -> packet.ciaddr, 0,
|
||||
sizeof ip -> client -> packet.ciaddr);
|
||||
memset (&ip -> client -> packet.yiaddr, 0,
|
||||
sizeof ip -> client -> packet.yiaddr);
|
||||
memset (&ip -> client -> packet.siaddr, 0,
|
||||
|
@ -1999,20 +2043,19 @@ void script_write_params (ip, prefix, lease)
|
|||
lease -> options [i].len);
|
||||
if (len > sizeof dbuf) {
|
||||
warn ("no space to %s %s",
|
||||
"prepend option",
|
||||
"append option",
|
||||
dhcp_options [i].name);
|
||||
goto supersede;
|
||||
}
|
||||
dp = dbuf;
|
||||
memcpy (dp,
|
||||
lease -> options [i].data,
|
||||
lease -> options [i].len);
|
||||
memcpy (dp + lease -> options [i].len,
|
||||
ip -> client ->
|
||||
config -> defaults [i].data,
|
||||
ip -> client ->
|
||||
config -> defaults [i].len);
|
||||
memcpy (dp + ip -> client ->
|
||||
config -> defaults [i].len,
|
||||
lease -> options [i].data,
|
||||
lease -> options [i].len);
|
||||
}
|
||||
} else {
|
||||
dp = ip -> client ->
|
||||
|
|
|
@ -259,14 +259,15 @@ statement.
|
|||
\fBprepend { [ \fIoption declaration\fR ]
|
||||
[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR
|
||||
.PP
|
||||
If for some set of options the client should first a value it
|
||||
supplies, and then use the values supplied by
|
||||
If for some set of options the client should use a value you
|
||||
supply, and then use the values supplied by
|
||||
the server, if any, these values can be defined in the
|
||||
.B prepend
|
||||
statement. The
|
||||
.B prepend
|
||||
statement can only be used for options which
|
||||
allow more than one value to be given.
|
||||
allow more than one value to be given. This restriction is not
|
||||
enforced - if violated, the results are unpredictable.
|
||||
.PP
|
||||
.I The
|
||||
.B append
|
||||
|
@ -275,14 +276,15 @@ allow more than one value to be given.
|
|||
\fBappend { [ \fIoption declaration\fR ]
|
||||
[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR
|
||||
.PP
|
||||
If for some set of options the client should first a value it
|
||||
supplies, and then use the values supplied by
|
||||
the server, if any, these values can be defined in the
|
||||
If for some set of options the client should first use the values
|
||||
supplied by the server, if any, and then use values you supply, these
|
||||
values can be defined in the
|
||||
.B append
|
||||
statement. The
|
||||
.B append
|
||||
statement can only be used for options which
|
||||
allow more than one value to be given.
|
||||
allow more than one value to be given. This restriction is not
|
||||
enforced - if you ignore it, the behaviour will be unpredictable.
|
||||
.SH LEASE DECLARATIONS
|
||||
.PP
|
||||
.I The
|
||||
|
|
|
@ -1,5 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
make_resolv_conf() {
|
||||
echo search $new_domain_name >/etc/resolv.conf
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
echo nameserver $nameserver >>/etc/resolv.conf
|
||||
done
|
||||
}
|
||||
|
||||
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
|
||||
exit_with_hooks() {
|
||||
exit_status=$1
|
||||
if [ -x /etc/dhclient-exit-hooks ]; then
|
||||
. /etc/dhclient-exit-hooks
|
||||
fi
|
||||
# probably should do something with exit status of the local script
|
||||
exit $exit_status
|
||||
}
|
||||
|
||||
# Invoke the local dhcp client enter hooks, if they exist.
|
||||
if [ -x /etc/dhclient-enter-hooks ]; then
|
||||
exit_status=0
|
||||
. /etc/dhclient-enter-hooks
|
||||
# allow the local script to abort processing of this state
|
||||
# local script must set exit_status variable to nonzero.
|
||||
if [ $exit_status -ne 0 ]; then
|
||||
exit $exit_status
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ x$new_network_number != x ]; then
|
||||
echo New Network Number: $new_network_number
|
||||
fi
|
||||
|
@ -25,7 +53,7 @@ if [ x$reason = xMEDIUM ]; then
|
|||
ifconfig $interface $medium
|
||||
ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
|
||||
sleep 1
|
||||
exit 0
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
if [ x$reason = xPREINIT ]; then
|
||||
|
@ -35,11 +63,11 @@ if [ x$reason = xPREINIT ]; then
|
|||
fi
|
||||
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
|
||||
broadcast 255.255.255.255 up
|
||||
exit 0
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
|
||||
exit 0;
|
||||
exit_with_hooks 0;
|
||||
fi
|
||||
|
||||
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
|
||||
|
@ -89,7 +117,7 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
|
|||
for nameserver in $new_domain_name_servers; do
|
||||
echo nameserver $nameserver >>/etc/resolv.conf
|
||||
done
|
||||
exit 0
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
|
||||
|
@ -117,7 +145,7 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
|
|||
ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
|
||||
route add $alias_ip_address 127.0.0.1
|
||||
fi
|
||||
exit 0
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
if [ x$reason = xTIMEOUT ]; then
|
||||
|
@ -153,7 +181,7 @@ if [ x$reason = xTIMEOUT ]; then
|
|||
rm -f /etc/resolv.conf
|
||||
fi
|
||||
mv /etc/resolv.conf.std /etc/resolv.conf
|
||||
exit 0
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
fi
|
||||
ifconfig $interface inet -alias $new_ip_address $medium
|
||||
|
@ -169,7 +197,7 @@ if [ x$reason = xTIMEOUT ]; then
|
|||
fi
|
||||
arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
|
||||
|sh >/dev/null 2>&1
|
||||
exit 1
|
||||
exit_with_hooks 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit_with_hooks 0
|
||||
|
|
Loading…
Reference in a new issue