1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Virgin import of ISC-DHCP v2.0b1pl27

This commit is contained in:
David E. O'Brien 1999-05-02 09:03:51 +00:00
parent cb1dd5d1b3
commit f96b6240a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/isc-dhcp/dist/; revision=46275
28 changed files with 947 additions and 250 deletions

View File

@ -1,7 +1,48 @@
Internet Software Consortium
Dynamic Host Configuration Protocol Distribution
Version 2, Beta 1, Patchlevel 18
March 5, 1998
Version 2, Beta 1, Patchlevel 27
April 23, 1999
Documentation for this software includes this README file, the
RELNOTES file, and the manual pages, which are in the server, common,
client and relay subdirectories. Internet standards relating to the
DHCP protocol are stored in the doc subdirectory. You will have the
best luck reading the manual pages if you build this software and then
install it, although you can read them directly out of the
distribution if you need to.
DHCP server documentation is in the dhcpd man page. Information about
the DHCP server lease database is in the dhcpd.leases man page.
Server configuration documentation is in the dhcpd.conf man page as
well as the dhcp-options man page. A sample DHCP server
configuration is in the file server/dhcpd.conf.
DHCP Client documentation is in the dhclient man page. DHCP client
configuration documentation is in the dhclient.conf man page and the
dhcp-options man page. The DHCP client configuration script is
documented in the dhclient-script man page. The format of the DHCP
client lease database is documented in the dhclient.leases man page.
DHCP relay agent documentation is in the dhcrelay man page.
To read installed manual pages, use the man command. Type "man page"
where page is the name of the manual page.
If you want to read manual pages that aren't installed, you can type
``nroff -man page |more'' where page is the filename of the
unformatted manual page. The filename of an unformatted manual page
is the name of the manual page, followed by '.', followed by some
number - 5 for documentation about files, and 8 for documentation
about programs.
If you do not have the nroff command, you can type ``more catpage''
where catpage is the filename of the catted man page. Catted man
pages names are the name of the manual page followed by ".cat"
followed by 5 or 8, as with unformatted manual pages.
Please note that until you install the manual pages, the pathnames of
files to which they refer will not be correct for your operating
system.
This is the first Beta release of Version 2 of the Internet Software
Consortium DHCP Distribution. In version 2.0, this distribution
@ -12,14 +53,12 @@ running a production environment should probably still use version
November of 1996.
In this release, the server and relay agent currently work well on
NetBSD, Linux, FreeBSD, BSD/OS, Ultrix, Digital Alpha OSF/1, and SunOS
4.1.4. They can also be run usefully on Solaris as long as only one
broadcast network interface is configured. They also runs on QNX as
long as only one broadcast network interface is configured and a host
route is added from that interface to the 255.255.255.255 broadcast
address. If you are running a Linux 2.0.30 or previous kernel, the
DHCP daemons will only be able to operate on machines with a single
network interface.
NetBSD, Linux after kernel version 2.0.30, FreeBSD, BSD/OS, Ultrix,
Digital Alpha OSF/1, Solaris and SunOS 4.1.4. They run on AIX, HPUX,
IRIX and Linux 2.0.30 and earlier kernels but support only a single
broadcast network interface. They also runs on QNX as long as only
one broadcast network interface is configured and a host route is
added from that interface to the 255.255.255.255 broadcast address.
The DHCP client currently only knows how to configure the network on
NetBSD, FreeBSD, BSD/os, Linux, Solaris and NextStep. The client
@ -47,9 +86,12 @@ information. On Digital Unix, type ``man pfilt''.
To build the DHCP Distribution, unpack the compressed tar file using
the tar utility and the gzip command - type something like:
zcat dhcp-2.0b1pl18.tar.gz |tar xvf -
zcat dhcp-2.0b1pl27.tar.gz |tar xvf -
Now, cd to the dhcp-2.0b1pl18 subdirectory that you've just created and
On BSD/OS, you have to type gzcat, not zcat, and you may run into
similar problems on other operating systems.
Now, cd to the dhcp-2.0b1pl27 subdirectory that you've just created and
configure the source tree by typing:
./configure
@ -103,16 +145,21 @@ make sure it's pointing to correct linux source directory.
LINUX: PROTOCOL NOT CONFIGURED
One additional Linux 2.1/2.2 issue: if you get the following message,
it's because your kernel doesn't have the linux packetfilter
configured:
it's because your kernel doesn't have the linux packetfilter or raw
packet socket configured:
Can't install packet filter program: Protocol not available
exiting.
Set CONFIG_PACKET=y and CONFIG_FILTER=y in your kernel configuration
If this happens, you need to edit your linux kernel .config file, set
CONFIG_FILTER=y, and rebuild your kernel. If the preceding sentence
made no sense to you, ask your Linux vendor/guru for help - please
don't ask us.
CONFIG_FILTER=y and CONFIG_PACKET=y, and rebuild your kernel. If the
preceding sentence made no sense to you, ask your Linux vendor/guru
for help - please don't ask us.
If you set CONFIG_PACKET=m or CONFIG_FILTER=m, then you must tell the
kernel module loader to load the appropriate modules. If this doesn't
make sense to you, don't use CONFIG_whatever=m - use CONFIG_whatever=y.
Don't ask for help with this on the DHCP mailing list - it's a Linux
kernel issue.
LINUX: BROADCAST
@ -275,9 +322,74 @@ mailing list.
If you are going to use dhcpd, you should probably subscribe to the
dhcp-server and dhcp-announce mailing lists. If you will be using
dhclient, you should subscribe to the dhcp-client mailing list.
If you need help, you should ask on the dhcp-server or dhcp-client
mailing list (or both) - whichever is appropriate to your
application. This includes reporting bugs. Please do not report
bugs in old software releases - fetch the latest release and see if
the bug is still in that copy of the software, and if it's not, _then_
report it. It's okay to report bugs in the latest patchlevel of a
major version that's not the most recent major version, though - for
example, if you're running 2.0, you don't have to upgrade to 3.0
before you can report bugs.
PLEASE READ THIS README FILE CAREFULLY BEFORE REPORTING BUGS!
When you report bugs, please provide us complete information. A list
of information we need follows. Please read it carefully, and put
all the information you can into your initial bug report, so that we
don't have to ask you any questions in order to figure out your
problem.
- The specific operating system name and version of the
machine on which the DHCP server or client is running.
- The specific operating system name and version of the
machine on which the client is running, if you are having
trouble getting a client working with the server.
- If you're running Linux, the version number we care about is
the kernel version and maybe the library version, not the
distribution version - e.g., while we don't mind knowing
that you're running Redhat version mumble.foo, we must know
what kernel version you're running, and it helps if you can
tell us what version of the C library you're running,
although if you don't know that off the top of your head it
may be hard for you to figure it out, so don't go crazy
trying.
- The specific version of the DHCP distribution you're
running, for example 2.0b1pl19, not 2.0.
- Please explain the problem carefully, thinking through what
you're saying to ensure that you don't assume we know
something about your situation that we don't know.
- Include your dhcpd.conf and dhcpd.leases file if they're not
huge (if they are huge, we may need them anyway, but don't
send them until you're asked).
- Include a log of your server or client running until it
encounters the problem - for example, if you are having
trouble getting some client to get an address, restart the
server with the -d flag and then restart the client, and
send us what the server prints. Likewise, with the client,
include the output of the client as it fails to get an
address or otherwise does the wrong thing. Do not leave
out parts of the output that you think aren't interesting.
- If the client or server is dumping core, please run the
debugger and get a stack trace, and include that in your
bug report. For example, if your debugger is gdb, do the
following:
gdb dhcpd dhcpd.core
(gdb) where
[...]
(gdb) quit
This assumes that it's the dhcp server you're debugging, and
that the core file is in dhcpd.core.
PLEASE DO NOT send queries about non-isc clients to the dhcp-client
mailing list. If you're asking about them on an ISC mailing list,
it's probably because you're using the ISC DHCP server, so ask there.
If you are having problems with a client whose executable is called
dhcpcd, this is _not_ the ISC DHCP client, and we probably can't help
you with it.
Please see http://www.fugue.com/dhcp/lists for details on how to
subscribe. If you don't have WorldWide Web access, you can send mail
@ -307,4 +419,4 @@ most users.
Vendor tags and User tags are not currently supported.
These two omissions are fixed in the 3.0 release.

View File

@ -1,7 +1,7 @@
Internet Software Consortium
Dynamic Host Configuration Protocol Distribution
Version 2, Beta 1, Patchlevel 18
March 5, 1998
Version 2, Beta 1, Patchlevel 27
April 23, 1999
Release Notes
@ -53,6 +53,138 @@ running in producion at the ISC, but is not expected to be stable in
the near future, and is intended for sites that are in a position to
experiment, or for sites that desperately need the new features.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 26
- Fix UDP/IP checksum code
- Fix UDP payload length computation to prevent logging of spurious
errors.
- Support compilation on MacOS X
- Add support for some options that were added in RFC2132.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 25
- Use the udp header's length rather than computing the length based
on the number of bytes received, because some broken relay agents
send packets with ip lengths that are longer than then sum of the ip
header size and the udp length.
- Do path keyword substitution on unformatted manual pages before
installing them.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 24
- D'oh! Fix a really stupid mistake in hash.c.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 23
- Support an always-reply-rfc1048 flag, which says to reply with an
RFC1048-style vendor extensions buffer even if the client didn't
send an RFC1048-style magic number.
- Fix a null pointer dereference.
- Use netmask from subnet if no netmask option specified.
- IRIX support (thanks to Don Badrak).
- Install unformatted manual pages on Linux.
- Add note in README about zcat vs. gzcat on BSD/os.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 22
- Test for lease before dereferencing it in dhcprequest.
- Free the client parameter request list in dhcpnak if there is one.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 21
- Fix a pasto in options.c that will cause a core dump whenever a
client sends in a request without a parameter request list.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 20
- Actually do the client fix mentioned below - Patchlevel 20 only contained
half of the fix.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 19
- Removed arp table clearing code from solaris client script.
- Document Linux "protocol not configured" error more thoroughly.
- Clean up some unused variables.
- Add entry and exit hooks to all dhcp client scripts, along with a
make_resolv_conf function that can be redefined in the entry hooks.
Document this new feature set.
- Fix client to take advantage of network APIs that allow it to
receive a unicast instead of requesting that the DHCP server
broadcast its response.
- Add -pf flag to all daemons allowing user to specify PID file name
on command line.
- Undo a previous change that attempted to be clever about testing
interface flags but wound up being stupid instead.
- Enforce access control on DHCPREQUEST messages as well as
DHCPDISCOVER messages.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 18
- Support added for AIX 4.1.5.0 (and hopefully other versions).
- Use /var/run instead of /etc on Digital Unix.
- Change DHCP client exponential backoff code to back off more slowly,
so that it is more robust in lossy environments, at the expense of
being a bit less polite to the server.
- Don't request a specific lease interval in the client unless the
user says to do so.
- Don't print DHCPXXX in wrong xxx messages unless DEBUG is defined.
- Fix handling of secs field.
- Fix handling of append statement.
- Fix documentation for append and prepend statements.
- Fix server support for parameter request list and maximum message
size.
- Parameterize more hardware types in discover_interfaces. Check for
IFF_BROADCAST instead of !IFF_POINTOPOINT
- Print kernel configuration warning message if we get EINVAL when
opening or configuring the Linux packet filter.
- Fix a bug in UDP checksum code (thanks to John Nemeth for figuring
this out) and re-enable UDP checksumming. This allows the client
to work with some buggy DHCP servers that can't handle zero
checksums in the UDP header - in particular, the one John's cable
modem ISP is using.
- Don't report packet header checksum errors unless we see a lot of
them. It's perfectly normal for some number of checksum errors to
occur.
- Refer to the dhcpd.leases man page when printing an error message
prior to exiting because there's no lease database.
- Add information to the README telling the reader how to get to the
manual pages.
- Fix the server packet transmission code to unicast when it can.
- Fix a typo in the dhcpd.conf manual page.
CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 17
- Fix a bug in the relay agent where messages to the client would be

View File

@ -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 = "/etc/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;

View File

@ -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
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 ETCDIR/dhclient.conf
script. If you find that you can't make such a customization without
customizing dhclient-script, please submit a bug report.
file. If you find that you can't make such a customization without
customizing
.B ETCDIR/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 ETCDIR/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 ETCDIR/dhclient-script
will exit with that error code immediately after the client script exits.
.PP
After all processing has completed,
.B ETCDIR/dhclient-script
checks for the presence of an executable
.B ETCDIR/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.

View File

@ -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"
@ -92,11 +92,11 @@ int save_scripts;
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;
@ -107,12 +107,20 @@ int main (argc, argv, envp)
struct interface_info *ip;
int seed;
int quiet = 0;
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__))
@ -122,7 +130,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));
@ -130,15 +138,19 @@ int main (argc, argv, envp)
no_daemon = 1;
} else if (!strcmp (argv [i], "-D")) {
save_scripts = 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 (argv [i][0] == '-') {
usage ();
usage (s);
} else {
struct interface_info *tmp =
((struct interface_info *)
@ -159,8 +171,10 @@ int main (argc, argv, envp)
note (message);
note (copyright);
note (arr);
note ("");
note (contrib);
note (url);
note ("");
}
/* Default to the DHCP/BOOTP port. */
@ -266,9 +280,19 @@ int main (argc, argv, envp)
return 0;
}
static void usage ()
static void usage (appname)
char *appname;
{
error ("Usage: dhclient [-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] [interface]");
}
void cleanup ()
@ -460,7 +484,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. */
@ -469,7 +492,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;
}
@ -477,7 +502,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;
}
@ -700,7 +727,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);
@ -714,7 +740,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;
}
@ -917,7 +945,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;
}
@ -925,7 +955,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;
}
@ -1033,10 +1065,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,
@ -1276,10 +1309,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),
@ -1347,7 +1384,6 @@ void make_discover (ip, lease)
struct interface_info *ip;
struct client_lease *lease;
{
struct dhcp_packet *raw;
unsigned char discover = DHCPDISCOVER;
int i;
@ -1409,8 +1445,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;
@ -1420,7 +1456,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),
@ -1516,8 +1557,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;
@ -1539,7 +1580,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,
@ -1617,8 +1661,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;
@ -1628,7 +1672,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,
@ -1657,7 +1701,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);
@ -1683,8 +1726,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;
@ -1695,8 +1738,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,
@ -1992,20 +2036,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 ->

View File

@ -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

View File

@ -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

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: alloc.c,v 1.13.2.1 1998/11/24 22:17:15 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: alloc.c,v 1.13.2.2 1999/03/26 16:39:36 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -240,6 +240,8 @@ void free_lease_state (ptr, name)
struct lease_state *ptr;
char *name;
{
if (ptr -> prl)
dfree (ptr -> prl, name);
ptr -> next = free_lease_states;
free_lease_states = ptr;
}

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: bpf.c,v 1.19.2.8 1999/02/23 22:09:56 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: bpf.c,v 1.19.2.9 1999/03/29 22:07:12 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -418,6 +418,12 @@ int can_unicast_without_arp ()
return 1;
}
int can_receive_unicast_unconfigured (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
struct interface_info *fbi;

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: conflex.c,v 1.29.2.3 1999/02/09 04:49:04 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n";
"$Id: conflex.c,v 1.29.2.4 1999/04/06 14:58:55 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -354,6 +354,8 @@ static int intern (atom, dfv)
switch (tolower (atom [0])) {
case 'a':
if (!strcasecmp (atom + 1, "lways-reply-rfc1048"))
return ALWAYS_REPLY_RFC1048;
if (!strcasecmp (atom + 1, "ppend"))
return APPEND;
if (!strcasecmp (atom + 1, "llow"))

View File

@ -103,9 +103,9 @@ enclosed in double quotes, or a series of octets specified in
hexadecimal, seperated by colons. For example:
.nf
.sp 1
option client-identifier "CLIENT-FOO";
option dhcp-client-identifier "CLIENT-FOO";
or
option client-identifier 43:4c:49:45:54:2d:46:4f:4f;
option dhcp-client-identifier 43:4c:49:45:54:2d:46:4f:4f;
.fi
.PP
The documentation for the various options mentioned below is taken
@ -569,6 +569,115 @@ This option can be used to specify the a DHCP client identifier in a
host declaration, so that dhcpd can find the host record by matching
against the client identifier.
.RE
.B option \fBnisplus-domain\fR \fIstring\fR\fB;\fR
.RS 0.25i
.PP
This option specifies the name of the client's NIS+ domain. The
domain is formatted as a character string consisting of characters
from the NVT ASCII character set.
.RE
.B option \fBnisplus-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR...
]\fB;\fR
.RS 0.25i
.PP
This option specifies a list of IP addresses indicating NIS+ servers
available to the client. Servers should be listed in order of
preference.
.RE
.PP
.B option \fBtftp-server-name\fR \fIstring\fR\fB;\fR
.RS 0.25i
.PP
This option is used to identify a TFTP server and, if supported by the
client, should have the same effect as the \fBserver-name\fR
declaration. BOOTP clients are unlikely to support this option.
Some DHCP clients will support it, and others actually require it.
.RE
.PP
.B option \fBbootfile-name\fR \fIstring\fR\fB;\fR
.RS 0.25i
.PP
This option is used to identify a bootstrap file. If supported by the
client, it should have the same effect as the \fBfilename\fR
declaration. BOOTP clients are unlikely to support this option. Some
DHCP clients will support it, and others actually require it.
.RE
.PP
.B option \fBmobile-ip-home-agent\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
This option specifies a list of IP addresses indicating mobile IP
home agents available to the client. Agents should be listed in
order of preference, although normally there will be only one such
agent.
.RE
.PP
.B option \fBsmtp-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The SMTP server option specifies a list of SMTP servers available to
the client. Servers should be listed in order of preference.
.RE
.PP
.B option \fBpop-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The POP3 server option specifies a list of POP3 available to the
client. Servers should be listed in order of preference.
.RE
.PP
.B option \fBnntp-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The NNTP server option specifies a list of NNTP available to the
client. Servers should be listed in order of preference.
.RE
.PP
.B option \fBwww-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The WWW server option specifies a list of WWW available to the
client. Servers should be listed in order of preference.
.RE
.PP
.B option \fBfinger-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The Finger server option specifies a list of Finger available to the
client. Servers should be listed in order of preference.
.RE
.PP
.B option \fBirc-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The IRC server option specifies a list of IRC available to the
client. Servers should be listed in order of preference.
.RE
.PP
.B option \fBstreettalk-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The StreetTalk server option specifies a list of StreetTalk servers
available to the client. Servers should be listed in order of
preference.
.RE
.PP
.B option \fBstreetalk-directory-assistance-server\fR \fIip-address\fR [\fB,\fR
\fIip-address\fR... ]\fB;\fR
.RS 0.25i
.PP
The StreetTalk Directory Assistance (STDA) server option specifies a
list of STDA servers available to the client. Servers should be
listed in order of preference.
.RE
.SH SEE ALSO
dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcpd(8),
dhclient(8), RFC2132, RFC2131.

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: dispatch.c,v 1.47.2.12 1999/02/23 17:37:00 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: dispatch.c,v 1.47.2.14 1999/03/29 22:16:36 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -74,7 +74,6 @@ void discover_interfaces (state)
struct ifreq ifr;
int i;
int sock;
int address_count = 0;
struct subnet *subnet;
struct shared_network *share;
struct sockaddr_in foo;
@ -356,6 +355,9 @@ void discover_interfaces (state)
case ARPHRD_TUNNEL:
/* ignore tunnel interfaces. */
#endif
#ifdef HAVE_ARPHRD_ROSE
case ARPHRD_ROSE:
#endif
#ifdef HAVE_ARPHRD_LOOPBACK
case ARPHRD_LOOPBACK:
/* ignore loopback interface */
@ -368,7 +370,7 @@ void discover_interfaces (state)
memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
break;
#ifndef ARPHRD_IEEE802
#ifndef HAVE_ARPHRD_IEEE802
# define ARPHRD_IEEE802 HTYPE_IEEE802
#endif
case ARPHRD_IEEE802:
@ -377,7 +379,7 @@ void discover_interfaces (state)
memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
break;
#ifndef ARPHRD_FDDI
#ifndef HAVE_ARPHRD_FDDI
# define ARPHRD_FDDI HTYPE_FDDI
#endif
case ARPHRD_FDDI:
@ -394,9 +396,26 @@ void discover_interfaces (state)
break;
#endif
#ifdef HAVE_ARPHRD_AX25
case ARPHRD_AX25:
tmp -> hw_address.hlen = 6;
tmp -> hw_address.htype = ARPHRD_AX25;
memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
break;
#endif
#ifdef HAVE_ARPHRD_NETROM
case ARPHRD_NETROM:
tmp -> hw_address.hlen = 6;
tmp -> hw_address.htype = ARPHRD_NETROM;
memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
break;
#endif
default:
error ("%s: unknown hardware address type %d",
warn ("%s: unknown hardware address type %d",
ifr.ifr_name, sa.sa_family);
break;
}
}
#endif /* defined (HAVE_SIOCGIFHWADDR) && !defined (HAVE_AF_LINK) */

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: hash.c,v 1.9.2.1 1998/06/25 21:11:29 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -67,23 +67,12 @@ static INLINE int do_hash (name, len, size)
register int accum = 0;
register unsigned char *s = name;
int i = len;
if (i) {
while (i--) {
/* Add the character in... */
accum += *s++;
/* Add carry back in... */
while (accum > 255) {
accum = (accum & 255) + (accum >> 8);
}
}
} else {
while (*s) {
/* Add the character in... */
accum += *s++;
/* Add carry back in... */
while (accum > 255) {
accum = (accum & 255) + (accum >> 8);
}
while (i--) {
/* Add the character in... */
accum += *s++;
/* Add carry back in... */
while (accum > 255) {
accum = (accum & 255) + (accum >> 8);
}
}
return accum % size;
@ -100,6 +89,8 @@ void add_hash (table, name, len, pointer)
if (!table)
return;
if (!len)
len = strlen ((char *)name);
hashno = do_hash (name, len, table -> hash_count);
bp = new_hash_bucket ("add_hash");
@ -125,6 +116,8 @@ void delete_hash_entry (table, name, len)
if (!table)
return;
if (!len)
len = strlen ((char *)name);
hashno = do_hash (name, len, table -> hash_count);
@ -157,19 +150,15 @@ unsigned char *hash_lookup (table, name, len)
if (!table)
return (unsigned char *)0;
if (!len)
len = strlen ((char *)name);
hashno = do_hash (name, len, table -> hash_count);
if (len) {
for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
if (len == bp -> len
&& !memcmp (bp -> name, name, len))
return bp -> value;
}
} else {
for (bp = table -> buckets [hashno]; bp; bp = bp -> next)
if (!strcmp ((char *)bp -> name, (char *)name))
return bp -> value;
for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
if (len == bp -> len && !memcmp (bp -> name, name, len))
return bp -> value;
}
return (unsigned char *)0;
}

View File

@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: icmp.c,v 1.7.2.1 1998/06/25 21:11:29 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: icmp.c,v 1.7.2.2 1999/03/29 23:20:00 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -61,8 +61,6 @@ void icmp_startup (routep, handler)
{
struct protoent *proto;
int protocol = 1;
struct sockaddr_in from;
int fd;
int state;
/* Only initialize icmp once. */

View File

@ -40,6 +40,11 @@
* Enterprises, see ``http://www.vix.com''.
*/
#ifndef lint
static char copyright[] =
"$Id: inet.c,v 1.5.2.2 1999/04/24 16:48:10 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Return just the network number of an internet address... */
@ -114,7 +119,7 @@ struct iaddr broadcast_addr (subnet, mask)
struct iaddr subnet;
struct iaddr mask;
{
int i, j, k;
int i;
struct iaddr rv;
if (subnet.len != mask.len) {

View File

@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: lpf.c,v 1.1.2.6 1999/02/23 22:09:55 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: lpf.c,v 1.1.2.8 1999/03/29 22:07:13 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -92,10 +92,12 @@ int if_register_lpf (info)
if ((sock = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT)
error ("socket: %m - make sure %s %s!",
"CONFIG_PACKET and CONFIG_FILTER are defined",
errno == EAFNOSUPPORT || errno == EINVAL) {
warn ("socket: %m");
error ("Make sure to set %s %s!",
"CONFIG_PACKET=y and CONFIG_FILTER=y",
"in your kernel configuration");
}
error("Open a socket for LPF: %m");
}
@ -106,10 +108,12 @@ int if_register_lpf (info)
if (bind (sock, &sa, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT)
error ("socket: %m - make sure %s %s!",
"CONFIG_PACKET and CONFIG_FILTER are defined",
errno == EAFNOSUPPORT || errno == EINVAL) {
warn ("bind: %m");
error ("Set %s %s!",
"CONFIG_PACKET=y and CONFIG_FILTER=y",
"in your kernel configuration");
}
error("Bind socket to interface: %m");
}
@ -280,6 +284,12 @@ int can_unicast_without_arp ()
return 1;
}
int can_receive_unicast_unconfigured (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
struct interface_info *fbi;

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: nit.c,v 1.15.2.3 1999/02/23 22:09:54 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: nit.c,v 1.15.2.4 1999/03/29 22:07:14 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -360,6 +360,12 @@ int can_unicast_without_arp ()
return 1;
}
int can_receive_unicast_unconfigured (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
struct interface_info *fbi;

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: options.c,v 1.26.2.3 1998/06/25 21:11:30 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: options.c,v 1.26.2.7 1999/03/30 02:57:47 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@ -119,7 +119,8 @@ void parse_option_buffer (packet, buffer, length)
/* If we haven't seen this option before, just make
space for it and copy it there. */
if (!packet -> options [code].data) {
if (!(t = (unsigned char *)malloc (len + 1)))
if (!(t = ((unsigned char *)
dmalloc (len + 1, "parse_option_buffer"))))
error ("Can't allocate storage for option %s.",
dhcp_options [code].name);
/* Copy and NUL-terminate the option (in case it's an
@ -132,10 +133,9 @@ void parse_option_buffer (packet, buffer, length)
/* If it's a repeat, concatenate it to whatever
we last saw. This is really only required
for clients, but what the heck... */
t = (unsigned char *)
malloc (len
+ packet -> options [code].len
+ 1);
t = ((unsigned char *)
dmalloc (len + packet -> options [code].len + 1,
"parse_option_buffer"));
if (!t)
error ("Can't expand storage for option %s.",
dhcp_options [code].name);
@ -145,7 +145,8 @@ void parse_option_buffer (packet, buffer, length)
&s [2], len);
packet -> options [code].len += len;
t [packet -> options [code].len] = 0;
free (packet -> options [code].data);
dfree (packet -> options [code].data,
"parse_option_buffer");
packet -> options [code].data = t;
}
s += len + 2;
@ -157,13 +158,17 @@ void parse_option_buffer (packet, buffer, length)
three seperate buffers if needed. This allows us to cons up a set
of vendor options using the same routine. */
int cons_options (inpacket, outpacket, options, overload, terminate, bootpp)
int cons_options (inpacket, outpacket, mms,
options, overload, terminate, bootpp, prl, prl_len)
struct packet *inpacket;
struct dhcp_packet *outpacket;
int mms;
struct tree_cache **options;
int overload; /* Overload flags that may be set. */
int terminate;
int bootpp;
u_int8_t *prl;
int prl_len;
{
unsigned char priority_list [300];
int priority_len;
@ -178,21 +183,29 @@ int cons_options (inpacket, outpacket, options, overload, terminate, bootpp)
use up to the minimum IP MTU size (576 bytes). */
/* XXX if a BOOTP client specifies a max message size, we will
honor it. */
if (inpacket && inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data) {
main_buffer_size =
(getUShort (inpacket -> options
[DHO_DHCP_MAX_MESSAGE_SIZE].data)
- DHCP_FIXED_LEN);
/* Enforce a minimum packet size... */
if (main_buffer_size < (576 - DHCP_FIXED_LEN))
main_buffer_size = 576 - DHCP_FIXED_LEN;
if (main_buffer_size > sizeof buffer)
main_buffer_size = sizeof buffer;
} else if (bootpp)
if (!mms &&
inpacket &&
inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data &&
(inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].len >=
sizeof (u_int16_t)))
mms = getUShort (inpacket -> options
[DHO_DHCP_MAX_MESSAGE_SIZE].data);
/* If the client has provided a maximum DHCP message size,
use that; otherwise, if it's BOOTP, only 64 bytes; otherwise
use up to the minimum IP MTU size (576 bytes). */
/* XXX if a BOOTP client specifies a max message size, we will
honor it. */
if (mms)
main_buffer_size = mms - DHCP_FIXED_LEN;
else if (bootpp)
main_buffer_size = 64;
else
main_buffer_size = 576 - DHCP_FIXED_LEN;
if (main_buffer_size > sizeof buffer)
main_buffer_size = sizeof buffer;
/* Preload the option priority list with mandatory options. */
priority_len = 0;
priority_list [priority_len++] = DHO_DHCP_MESSAGE_TYPE;
@ -212,9 +225,17 @@ int cons_options (inpacket, outpacket, options, overload, terminate, bootpp)
prlen = (sizeof priority_list) - priority_len;
memcpy (&priority_list [priority_len],
inpacket -> options
[DHO_DHCP_PARAMETER_REQUEST_LIST].data, prlen);
(inpacket -> options
[DHO_DHCP_PARAMETER_REQUEST_LIST].data), prlen);
priority_len += prlen;
prl = priority_list;
} else if (prl) {
if (prl_len + priority_len > sizeof priority_list)
prl_len = (sizeof priority_list) - priority_len;
memcpy (&priority_list [priority_len], prl, prl_len);
priority_len += prl_len;
prl = priority_list;
} else {
memcpy (&priority_list [priority_len],
dhcp_option_default_priority_list,
@ -582,6 +603,7 @@ void do_packet (interface, packet, len, from_port, from, hfrom)
struct hardware *hfrom;
{
struct packet tp;
int i;
if (packet -> hlen > sizeof packet -> chaddr) {
note ("Discarding packet with invalid hlen.");
@ -605,5 +627,11 @@ void do_packet (interface, packet, len, from_port, from, hfrom)
dhcp (&tp);
else
bootp (&tp);
/* Free the data associated with the options. */
for (i = 0; i < 256; i++) {
if (tp.options [i].len && tp.options [i].data)
dfree (tp.options [i].data, "do_packet");
}
}

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: packet.c,v 1.18.2.1 1998/06/26 18:20:44 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: packet.c,v 1.18.2.4 1999/04/24 15:31:47 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -72,6 +72,9 @@ u_int32_t checksum (buf, nbytes, sum)
debug ("sum = %x", sum);
#endif
sum += (u_int16_t) ntohs(*((u_int16_t *)(buf + i)));
/* Add carry. */
if (sum > 0xFFFF)
sum -= 0xFFFF;
}
/* If there's a single byte left over, checksum it, too. Network
@ -81,13 +84,15 @@ u_int32_t checksum (buf, nbytes, sum)
debug ("sum = %x", sum);
#endif
sum += buf [i] << 8;
/* Add carry. */
if (sum > 0xFFFF)
sum -= 0xFFFF;
}
return sum;
}
/* Fold the upper sixteen bits of the checksum down into the lower bits,
complement the sum, and then put it into network byte order. */
/* Finish computing the sum, and then put it into network byte order. */
u_int32_t wrapsum (sum)
u_int32_t sum;
@ -96,17 +101,7 @@ u_int32_t wrapsum (sum)
debug ("wrapsum (%x)", sum);
#endif
while (sum > 0x10000) {
sum = (sum >> 16) + (sum & 0xFFFF);
#ifdef DEBUG_CHECKSUM_VERBOSE
debug ("sum = %x", sum);
#endif
sum += (sum >> 16);
#ifdef DEBUG_CHECKSUM_VERBOSE
debug ("sum = %x", sum);
#endif
}
sum = sum ^ 0xFFFF;
sum = ~sum & 0xFFFF;
#ifdef DEBUG_CHECKSUM_VERBOSE
debug ("sum = %x", sum);
#endif
@ -194,17 +189,15 @@ void assemble_udp_ip_header (interface, buf, bufix,
/* Compute UDP checksums, including the ``pseudo-header'', the UDP
header and the data. */
#if 0
udp.uh_sum =
wrapsum (checksum ((unsigned char *)&udp, sizeof udp,
checksum (data, len,
checksum ((unsigned char *)
&ip.ip_src,
sizeof ip.ip_src,
2 * sizeof ip.ip_src,
IPPROTO_UDP +
(u_int32_t)
ntohs (udp.uh_ulen)))));
#endif
/* Copy the udp header into the buffer... */
memcpy (&buf [*bufix], &udp, sizeof udp);
@ -239,18 +232,25 @@ ssize_t decode_hw_header (interface, buf, bufix, from)
/* UDP header and IP header decoded together for convenience. */
ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
struct interface_info *interface;
unsigned char *buf;
int bufix;
struct sockaddr_in *from;
unsigned char *data;
int len;
int buflen;
{
struct ip *ip;
struct udphdr *udp;
u_int32_t ip_len = (buf [bufix] & 0xf) << 2;
u_int32_t sum, usum;
static int ip_packets_seen;
static int ip_packets_bad_checksum;
static int udp_packets_seen;
static int udp_packets_bad_checksum;
static int udp_packets_length_checked;
static int udp_packets_length_overflow;
int len;
ip = (struct ip *)(buf + bufix);
udp = (struct udphdr *)(buf + bufix + ip_len);
@ -266,12 +266,23 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
#endif /* USERLAND_FILTER */
/* Check the IP header checksum - it should be zero. */
++ip_packets_seen;
if (wrapsum (checksum (buf + bufix, ip_len, 0))) {
note ("Bad IP checksum: %x",
wrapsum (checksum (buf + bufix, sizeof *ip, 0)));
++ip_packets_bad_checksum;
if (ip_packets_seen > 4 &&
(ip_packets_seen / ip_packets_bad_checksum) < 2) {
note ("%d bad IP checksums seen in %d packets",
ip_packets_bad_checksum, ip_packets_seen);
ip_packets_seen = ip_packets_bad_checksum = 0;
}
return -1;
}
/* Check the IP packet length. */
if (ntohs (ip -> ip_len) != buflen)
debug ("ip length %d disagrees with bytes received %d.",
ntohs (ip -> ip_len), buflen);
/* Copy out the IP source address... */
memcpy (&from -> sin_addr, &ip -> ip_src, 4);
@ -281,10 +292,25 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
if (!data) {
data = buf + bufix + ip_len + sizeof *udp;
len -= ip_len + sizeof *udp;
len = ntohs (udp -> uh_ulen) - sizeof *udp;
++udp_packets_length_checked;
if (len + data > buf + bufix + buflen) {
++udp_packets_length_overflow;
if (udp_packets_length_checked > 4 &&
(udp_packets_length_checked /
udp_packets_length_overflow) < 2) {
note ("%d udp packets in %d too long - dropped",
udp_packets_length_overflow,
udp_packets_length_checked);
udp_packets_length_overflow =
udp_packets_length_checked = 0;
}
return -1;
}
if (len + data != buf + bufix + buflen)
debug ("accepting packet with data after udp payload.");
}
#if 0
usum = udp -> uh_sum;
udp -> uh_sum = 0;
@ -292,16 +318,22 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
checksum (data, len,
checksum ((unsigned char *)
&ip -> ip_src,
sizeof ip -> ip_src,
2 * sizeof ip -> ip_src,
IPPROTO_UDP +
(u_int32_t)
ntohs (udp -> uh_ulen)))));
udp_packets_seen++;
if (usum && usum != sum) {
note ("Bad udp checksum: %x %x", usum, sum);
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
note ("%d bad udp checksums in %d packets",
udp_packets_bad_checksum, udp_packets_seen);
udp_packets_seen = udp_packets_bad_checksum = 0;
}
return -1;
}
#endif
/* Copy out the port... */
memcpy (&from -> sin_port, &udp -> uh_sport, sizeof udp -> uh_sport);

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: parse.c,v 1.2.2.3 1998/12/22 22:43:22 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: parse.c,v 1.2.2.4 1999/03/29 22:18:53 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -192,9 +192,6 @@ int parse_ip_addr (cfile, addr)
FILE *cfile;
struct iaddr *addr;
{
char *val;
int token;
addr -> len = 4;
if (parse_numeric_aggregate (cfile, addr -> iabuf,
&addr -> len, DOT, 10, 8))

View File

@ -54,7 +54,7 @@
#ifndef lint
static char copyright[] =
"$Id: raw.c,v 1.11.2.2 1999/02/23 22:09:54 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: raw.c,v 1.11.2.3 1999/04/06 16:00:24 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -81,6 +81,7 @@ void if_register_send (info)
if (!quiet_interface_discovery)
note ("Sending on %s, port %d",
piaddr (info -> address), htons (local_port));
if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
error ("Can't create dhcp socket: %m");
@ -104,7 +105,7 @@ void if_register_send (info)
info -> shared_network -> name : ""));
}
size_t send_packet (interface, packet, raw, len, from, to, hto)
ssize_t send_packet (interface, packet, raw, len, from, to, hto)
struct interface_info *interface;
struct packet *packet;
struct dhcp_packet *raw;
@ -113,7 +114,7 @@ size_t send_packet (interface, packet, raw, len, from, to, hto)
struct sockaddr_in *to;
struct hardware *hto;
{
unsigned char buf [256];
unsigned char buf [1500];
int bufp = 0;
struct iovec iov [2];
int result;
@ -122,16 +123,31 @@ size_t send_packet (interface, packet, raw, len, from, to, hto)
assemble_udp_ip_header (interface, buf, &bufp, from.s_addr,
to -> sin_addr.s_addr, to -> sin_port,
(unsigned char *)raw, len);
/* Fire it off */
iov [0].iov_base = (char *)buf;
iov [0].iov_len = bufp;
iov [1].iov_base = (char *)raw;
iov [1].iov_len = len;
result = writev(interface -> wfdesc, iov, 2);
if (len + bufp > sizeof buf) {
warn ("send_packet: packet too large (%s)", len + bufp);
return;
}
memcpy (buf + bufp, raw, len);
bufp += len;
result = sendto (interface -> wfdesc, (char *)buf, bufp, 0,
(struct sockaddr *)to, sizeof *to);
if (result < 0)
warn ("send_packet: %m");
return result;
}
#endif /* USE_SOCKET_SEND */
int can_unicast_without_arp ()
{
return 1;
}
void maybe_setup_fallback ()
{
}
void if_reinitialize_send (info)
struct interface_info *info;
{
}
#endif /* USE_RAW_SEND */

View File

@ -50,7 +50,7 @@
#ifndef lint
static char copyright[] =
"$Id: socket.c,v 1.26.2.10 1999/02/23 22:09:55 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: socket.c,v 1.26.2.11 1999/03/29 22:07:14 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -269,6 +269,16 @@ int can_unicast_without_arp ()
return 0;
}
int can_receive_unicast_unconfigured (ip)
struct interface_info *ip;
{
#if defined (SOCKET_CAN_RECEIVE_UNICAST_UNCONFIGURED)
return 1;
#else
return 0;
#endif
}
/* If we have SO_BINDTODEVICE, set up a fallback interface; otherwise,
do not. */

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: tables.c,v 1.13.2.3 1998/12/22 22:45:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: tables.c,v 1.13.2.4 1999/04/24 16:46:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -130,20 +130,20 @@ struct option dhcp_options [256] = {
{ "dhcp-client-identifier", "X", &dhcp_universe, 61 },
{ "option-62", "X", &dhcp_universe, 62 },
{ "option-63", "X", &dhcp_universe, 63 },
{ "option-64", "X", &dhcp_universe, 64 },
{ "option-65", "X", &dhcp_universe, 65 },
{ "option-66", "X", &dhcp_universe, 66 },
{ "option-67", "X", &dhcp_universe, 67 },
{ "option-68", "X", &dhcp_universe, 68 },
{ "option-69", "X", &dhcp_universe, 69 },
{ "option-70", "X", &dhcp_universe, 70 },
{ "option-71", "X", &dhcp_universe, 71 },
{ "option-72", "X", &dhcp_universe, 72 },
{ "option-73", "X", &dhcp_universe, 73 },
{ "option-74", "X", &dhcp_universe, 74 },
{ "option-75", "X", &dhcp_universe, 75 },
{ "option-76", "X", &dhcp_universe, 76 },
{ "dhcp-user-class-identifier", "t", &dhcp_universe, 77 },
{ "nisplus-domain", "t", &dhcp_universe, 64 },
{ "nisplus-servers", "IA", &dhcp_universe, 65 },
{ "tftp-server-name", "t", &dhcp_universe, 66 },
{ "bootfile-name", "t", &dhcp_universe, 67 },
{ "mobile-ip-home-agent", "IA", &dhcp_universe, 68 },
{ "smtp-server", "IA", &dhcp_universe, 69 },
{ "pop-server", "IA", &dhcp_universe, 70 },
{ "nntp-server", "IA", &dhcp_universe, 71 },
{ "www-server", "IA", &dhcp_universe, 72 },
{ "finger-server", "IA", &dhcp_universe, 73 },
{ "irc-server", "IA", &dhcp_universe, 74 },
{ "streettalk-server", "IA", &dhcp_universe, 75 },
{ "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 },
{ "user-class", "t", &dhcp_universe, 77 },
{ "option-78", "X", &dhcp_universe, 78 },
{ "option-79", "X", &dhcp_universe, 79 },
{ "option-80", "X", &dhcp_universe, 80 },

View File

@ -1,6 +1,6 @@
/* upf.c
Ultrix PacketFilter interface code.
Ultrix PacketFilter interface code. */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: upf.c,v 1.3.2.3 1999/02/23 22:09:56 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: upf.c,v 1.3.2.5 1999/03/29 22:07:13 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -311,6 +311,12 @@ int can_unicast_without_arp ()
return 1;
}
int can_receive_unicast_unconfigured (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
struct interface_info *fbi;

View File

@ -0,0 +1,89 @@
/* aix.h */
/*
* Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of The Internet Software Consortium nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define int8_t char
#define int16_t short
#define int32_t long
#define u_int8_t unsigned char
#define u_int16_t unsigned short
#define u_int32_t unsigned long
#include <sys/types.h>
#include <syslog.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/wait.h>
#include <signal.h>
#include <setjmp.h>
#include <limits.h>
extern int h_errno;
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif
#ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif
#ifndef _PATH_DHCRELAY_PID
#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
#endif
#include <varargs.h>
#define VA_DOTDOTDOT va_alist
#define VA_start(list, last) va_start (list)
#define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
#define NO_SNPRINTF
#define EOL '\n'
#define VOIDPTR void *
#include <time.h>
#define TIME time_t
#define GET_TIME(x) time ((x))
#define random rand
#define USE_SOCKETS 1
#define HAVE_SA_LEN 1
#undef FDDI

View File

@ -160,6 +160,10 @@ struct lease_state {
struct iaddr from;
int max_message_size;
u_int8_t *prl;
int prl_len;
u_int32_t xid;
u_int16_t secs;
u_int16_t bootp_flags;
@ -209,6 +213,7 @@ struct group {
int use_host_decl_names;
int use_lease_addr_for_default_route;
int authoritative;
int always_reply_rfc1048;
struct tree_cache *options [256];
};
@ -332,6 +337,7 @@ struct client_state {
enum dhcp_state state; /* Current state for this interface. */
struct iaddr destination; /* Where to send packet. */
u_int32_t xid; /* Transaction ID. */
u_int16_t secs; /* secs value from DHCPDISCOVER. */
TIME first_sending; /* When was first copy sent? */
TIME interval; /* What's the current resend interval? */
struct string_list *medium; /* Last media type tried. */
@ -457,8 +463,9 @@ typedef unsigned char option_mask [16];
void parse_options PROTO ((struct packet *));
void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
int cons_options PROTO ((struct packet *, struct dhcp_packet *,
struct tree_cache **, int, int, int));
int cons_options PROTO ((struct packet *, struct dhcp_packet *, int,
struct tree_cache **, int, int, int,
u_int8_t *, int));
int store_options PROTO ((unsigned char *, int, struct tree_cache **,
unsigned char *, int, int, int, int));
char *pretty_print_option PROTO ((unsigned int,
@ -674,6 +681,7 @@ ssize_t receive_packet PROTO ((struct interface_info *,
#endif
#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK)
int can_unicast_without_arp PROTO ((void));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
void maybe_setup_fallback PROTO ((void));
#endif
@ -698,6 +706,7 @@ ssize_t receive_packet PROTO ((struct interface_info *,
#endif
#if defined (USE_BPF_SEND)
int can_unicast_without_arp PROTO ((void));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
void maybe_setup_fallback PROTO ((void));
#endif
@ -722,6 +731,7 @@ ssize_t receive_packet PROTO ((struct interface_info *,
#endif
#if defined (USE_LPF_SEND)
int can_unicast_without_arp PROTO ((void));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
void maybe_setup_fallback PROTO ((void));
#endif
@ -747,6 +757,7 @@ ssize_t receive_packet PROTO ((struct interface_info *,
#endif
#if defined (USE_NIT_SEND)
int can_unicast_without_arp PROTO ((void));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
void maybe_setup_fallback PROTO ((void));
#endif
@ -767,6 +778,7 @@ ssize_t receive_packet PROTO ((struct interface_info *,
#endif
#if defined (USE_DLPI_SEND)
int can_unicast_without_arp PROTO ((void));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
void maybe_setup_fallback PROTO ((void));
#endif
@ -779,6 +791,7 @@ ssize_t send_packet PROTO ((struct interface_info *,
struct in_addr,
struct sockaddr_in *, struct hardware *));
int can_unicast_without_arp PROTO ((void));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
void maybe_setup_fallback PROTO ((void));
#endif

View File

@ -128,6 +128,7 @@
#define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332
#define AUTHORITATIVE 333
#define TOKEN_NOT 334
#define ALWAYS_REPLY_RFC1048 335
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
(x) != STRING && \

View File

@ -75,6 +75,10 @@
# endif
#endif
#ifdef aix
# include "cf/aix.h"
#endif
#ifdef bsdi
# include "cf/bsdos.h"
#endif
@ -115,14 +119,18 @@
# include "cf/cygwin32.h"
#endif
#ifdef NeXT
# ifdef __APPLE__
# include "cf/rhapsody.h"
# else
#ifdef __APPLE__
# include "cf/rhapsody.h"
#else
# if defined (NeXT)
# include "cf/nextstep.h"
# endif
#endif
#if defined(IRIX) || defined(__sgi)
# include "cf/irix.h"
#endif
#if !defined (TIME_MAX)
# define TIME_MAX 2147483647
#endif
@ -247,6 +255,26 @@
# define HAVE_ARPHRD_LOOPBACK
#endif
#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE)
# define HAVE_ARPHRD_ROSE
#endif
#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802)
# define HAVE_ARPHRD_IEEE802
#endif
#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI)
# define HAVE_ARPHRD_FDDI
#endif
#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25)
# define HAVE_ARPHRD_AX25
#endif
#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM)
# define HAVE_ARPHRD_NETROM
#endif
#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM)
# define HAVE_ARPHRD_METRICOM
#endif
@ -262,4 +290,3 @@
#if defined (AF_LINK) && !defined (HAVE_AF_LINK)
# define HAVE_AF_LINK
#endif