Commit 4bd8800e authored by Ted Lemon's avatar Ted Lemon

Fix compilation errors introduced in the last set of checkins.

parent 3c0b59d3
......@@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
* Copyright (c) 1996-2000 Internet Software Consortium.
* Use is subject to license terms which appear in the file named
* ISC-LICENSE that should have accompanied this file when you
* received it. If a file named ISC-LICENSE did not accompany this
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: clparse.c,v 1.40 2000/01/25 00:58:02 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
"$Id: clparse.c,v 1.41 2000/01/26 14:55:26 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -302,8 +302,7 @@ void parse_client_statement (cfile, ip, config)
return;
for (; *p; p = &((*p) -> next))
;
executable_statement_reference (p, stmt,
"parse_client_statement");
executable_statement_reference (p, stmt, MDL);
stmt -> next = (struct executable_statement *)0;
return;
......
......@@ -92,7 +92,7 @@ dhclient.leases file. In order to prevent the file from becoming
arbitrarily large, from time to time dhclient creates a new
dhclient.leases file from its in-core lease database. The old version
of the dhclient.leases file is retained under the name
.IR dhcpd.leases~
.IR dhclient.leases~
until the next time dhclient rewrites the database.
.PP
Old leases are kept around in case the DHCP server is unavailable when
......
......@@ -3,7 +3,7 @@
DHCP Client. */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
* Copyright (c) 1996-2000 Internet Software Consortium.
* Use is subject to license terms which appear in the file named
* ISC-LICENSE that should have accompanied this file when you
* received it. If a file named ISC-LICENSE did not accompany this
......@@ -29,7 +29,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhclient.c,v 1.92 2000/01/25 00:58:57 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: dhclient.c,v 1.93 2000/01/26 14:55:26 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -47,8 +47,6 @@ int dhcp_max_agent_option_packet_length = 0;
int interfaces_requested = 0;
int log_perror = 1;
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } };
struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } };
struct in_addr inaddr_any;
......@@ -70,7 +68,6 @@ static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.htm
u_int16_t local_port;
u_int16_t remote_port;
int log_priority;
int no_daemon;
int save_scripts;
......@@ -325,10 +322,6 @@ static void usage ()
"[-cf config-file] [interface]");
}
void cleanup ()
{
}
struct class *find_class (s)
const char *s;
{
......
......@@ -49,7 +49,7 @@ OOPPEERRAATTIIOONN
dhclient creates a new dhclient.leases file from its in-
core lease database. The old version of the
dhclient.leases file is retained under the name
_d_h_c_p_d_._l_e_a_s_e_s_~ until the next time dhclient rewrites the
_d_h_c_l_i_e_n_t_._l_e_a_s_e_s_~ until the next time dhclient rewrites the
database.
Old leases are kept around in case the DHCP server is
......
......@@ -366,7 +366,7 @@ 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. For
more information, see
.B dhclient-lease(8).
.B dhclient-script(8).
.PP
\fBmedium "\fImedia setup\fB";\fR
.PP
......
......@@ -375,7 +375,7 @@ dhclient.conf(5) dhclient.conf(5)
If no lease is acquired, the script is used to test prede­
fined leases, if any, and also called once if no valid
lease can be identified. For more information, see
ddhhcclliieenntt--lleeaassee((88))..
ddhhcclliieenntt--ssccrriipptt((88))..
mmeeddiiuumm ""_m_e_d_i_a _s_e_t_u_p"";;
......
......@@ -21,11 +21,11 @@ CATMANPAGES = dhcp-options.cat5 dhcp-contrib.cat5 dhcp-eval.cat5
SEDMANPAGES = dhcp-options.man5 dhcp-contrib.man5 dhcp-eval.man5
SRC = raw.c parse.c nit.c icmp.c dispatch.c conflex.c upf.c bpf.c socket.c \
lpf.c dlpi.c packet.c tr.c ethernet.c memory.c print.c options.c \
inet.c convert.c tree.c tables.c hash.c alloc.c errwarn.c \
inet.c convert.c tree.c tables.c hash.c alloc.c \
inet_addr.c dns.c resolv.c execute.c discover.c auth.c
OBJ = raw.o parse.o nit.o icmp.o dispatch.o conflex.o upf.o bpf.o socket.o \
lpf.o dlpi.o packet.o tr.o ethernet.o memory.o print.o options.o \
inet.o convert.o tree.o tables.o hash.o alloc.o errwarn.o \
inet.o convert.o tree.o tables.o hash.o alloc.o \
inet_addr.o dns.o resolv.o execute.o discover.o auth.o
MAN = dhcp-options.5 dhcp-contrib.5 dhcp-eval.5
......
......@@ -22,280 +22,15 @@
#ifndef lint
static char copyright[] =
"$Id: alloc.c,v 1.37 2000/01/25 01:02:26 mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: alloc.c,v 1.38 2000/01/26 14:55:33 mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
#include <omapip/omapip_p.h>
struct dhcp_packet *dhcp_free_list;
struct packet *packet_free_list;
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
struct dmalloc_preamble *dmalloc_list;
unsigned long dmalloc_outstanding;
unsigned long dmalloc_longterm;
unsigned long dmalloc_generation;
unsigned long dmalloc_cutoff_generation;
#endif
#if defined (DEBUG_RC_HISTORY)
struct rc_history_entry rc_history [RC_HISTORY_MAX];
int rc_history_index;
#endif
VOIDPTR dmalloc (size, file, line)
unsigned size;
const char *file;
int line;
{
unsigned char *foo = malloc (size + DMDSIZE);
int i;
VOIDPTR *bar;
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
struct dmalloc_preamble *dp;
#endif
if (!foo) {
log_error ("No memory for %s.", name);
return (VOIDPTR)0;
}
bar = (VOIDPTR)(foo + DMDOFFSET);
memset (bar, 0, size);
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
dp = (struct dmalloc_preamble *)foo;
dp -> prev = dmalloc_list;
if (dmalloc_list)
dmalloc_list -> next = dp;
dmalloc_list = dp;
dp -> next = (struct dmalloc_preamble *)0;
dp -> size = size;
dp -> file = file;
dp -> line = line;
dp -> generation = dmalloc_generation++;
dmalloc_outstanding += size;
for (i = 0; i < DMLFSIZE; i++)
dp -> low_fence [i] =
(((unsigned long)
(&dp -> low_fence [i])) % 143) + 113;
for (i = DMDOFFSET; i < DMDSIZE; i++)
foo [i + size] =
(((unsigned long)
(&foo [i + size])) % 143) + 113;
#if defined (DEBUG_MALLOC_POOL_EXHAUSTIVELY)
/* Check _every_ entry in the pool! Very expensive. */
for (dp = dmalloc_list; dp; dp = dp -> prev) {
for (i = 0; i < DMLFSIZE; i++) {
if (dp -> low_fence [i] !=
(((unsigned long)
(&dp -> low_fence [i])) % 143) + 113)
{
log_error ("malloc fence modified: %s(%d)",
dp -> file, dp -> line);
abort ();
}
}
foo = (unsigned char *)dp;
for (i = DMDOFFSET; i < DMDSIZE; i++) {
if (foo [i + dp -> size] !=
(((unsigned long)
(&foo [i + dp -> size])) % 143) + 113) {
log_error ("malloc fence modified: %s(%d)",
dp -> file, dp -> line);
abort ();
}
}
}
#endif
#endif
return bar;
}
void dfree (ptr, file, line)
VOIDPTR ptr;
const char *file;
int line;
{
if (!ptr) {
log_error ("dfree %s(%d): free on null pointer.", file, line);
return;
}
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
{
unsigned char *bar = ptr;
struct dmalloc_preamble *dp, *cur;
int i;
bar -= DMDOFFSET;
cur = (struct dmalloc_preamble *)bar;
for (dp = dmalloc_list; dp; dp = dp -> prev)
if (dp == cur)
break;
if (!dp) {
log_error ("%s(%d): freeing unknown memory: %lx",
dp -> file, dp -> line, (unsigned long)cur);
abort ();
}
if (dp -> prev)
dp -> prev -> next = dp -> next;
if (dp -> next)
dp -> next -> prev = dp -> prev;
if (dp == dmalloc_list)
dmalloc_list = dp -> prev;
if (dp -> generation >= dmalloc_cutoff_generation)
dmalloc_outstanding -= dp -> size;
else
dmalloc_longterm -= dp -> size;
for (i = 0; i < DMLFSIZE; i++) {
if (dp -> low_fence [i] !=
(((unsigned long)
(&dp -> low_fence [i])) % 143) + 113)
{
log_error ("malloc fence modified: %s(%d)",
dp -> file, dp -> line);
abort ();
}
}
for (i = DMDOFFSET; i < DMDSIZE; i++) {
if (bar [i + dp -> size] !=
(((unsigned long)
(&bar [i + dp -> size])) % 143) + 113) {
log_error ("malloc fence modified: %s(%d)",
dp -> file, dp -> line);
abort ();
}
}
ptr = bar;
}
#endif
free (ptr);
}
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
/* For allocation functions that keep their own free lists, we want to
account for the reuse of the memory. */
void dmalloc_reuse (foo, file, line, justref)
VOIDPTR foo;
const char *file;
int line;
int justref;
{
struct dmalloc_preamble *dp;
/* Get the pointer to the dmalloc header. */
dp = foo;
dp--;
/* If we just allocated this and are now referencing it, this
function would almost be a no-op, except that it would
increment the generation count needlessly. So just return
in this case. */
if (dp -> generation == dmalloc_generation)
return;
/* If this is longterm data, and we just made reference to it,
don't put it on the short-term list or change its name -
we don't need to know about this. */
if (dp -> generation < dmalloc_cutoff_generation && justref)
return;
/* Take it out of the place in the allocated list where it was. */
if (dp -> prev)
dp -> prev -> next = dp -> next;
if (dp -> next)
dp -> next -> prev = dp -> prev;
if (dp == dmalloc_list)
dmalloc_list = dp -> prev;
/* Account for its removal. */
if (dp -> generation >= dmalloc_cutoff_generation)
dmalloc_outstanding -= dp -> size;
else
dmalloc_longterm -= dp -> size;
/* Now put it at the head of the list. */
dp -> prev = dmalloc_list;
if (dmalloc_list)
dmalloc_list -> next = dp;
dmalloc_list = dp;
dp -> next = (struct dmalloc_preamble *)0;
/* Change the reference location information. */
dp -> file = file;
dp -> line = line;
/* Increment the generation. */
dp -> generation = dmalloc_generation++;
/* Account for it. */
dmalloc_outstanding += dp -> size;
}
void dmalloc_dump_outstanding ()
{
static unsigned long dmalloc_cutoff_point;
struct dmalloc_preamble *dp;
unsigned char *foo;
int i;
if (!dmalloc_cutoff_point)
dmalloc_cutoff_point = dmalloc_cutoff_generation;
for (dp = dmalloc_list; dp; dp = dp -> prev) {
if (dp -> generation <= dmalloc_cutoff_point)
break;
#if defined (DEBUG_MALLOC_POOL)
for (i = 0; i < DMLFSIZE; i++) {
if (dp -> low_fence [i] !=
(((unsigned long)
(&dp -> low_fence [i])) % 143) + 113)
{
log_error ("malloc fence modified: %s(%d)",
dp -> file, dp -> line);
abort ();
}
}
foo = (unsigned char *)dp;
for (i = DMDOFFSET; i < DMDSIZE; i++) {
if (foo [i + dp -> size] !=
(((unsigned long)
(&foo [i + dp -> size])) % 143) + 113) {
log_error ("malloc fence modified: %s(%d)",
dp -> file, dp -> line);
abort ();
}
}
#endif
#if defined (DEBUG_MEMORY_LEAKAGE)
/* Don't count data that's actually on a free list
somewhere. */
if (dp -> file)
log_info (" %s(%d): %d",
dp -> file, dp -> line, dp -> size);
#endif
}
if (dmalloc_list)
dmalloc_cutoff_point = dmalloc_list -> generation;
}
#endif /* DEBUG_MEMORY_LEAKAGE || DEBUG_MALLOC_POOL */
#if defined (DEBUG_RC_HISTORY)
void dump_rc_history ()
{
int i;
i = rc_history_index;
do {
log_info (" referenced by %s(%d): addr = %lx refcnt = %x\n",
rc_history [i].file, rc_history [i].line,
(unsigned long)rc_history [i].addr,
rc_history [i].refcnt);
++i;
if (i == RC_HISTORY_MAX)
i = 0;
} while (i != rc_history_index && rc_history [i].file);
}
#endif
struct dhcp_packet *new_dhcp_packet (file, line)
const char *file;
int line;
......@@ -501,9 +236,9 @@ void free_lease_state (ptr, file, line)
option_state_dereference (&ptr -> options, file, line);
if (ptr -> packet)
packet_dereference (&ptr -> packet, file, line);
data_string_forget (&state -> parameter_request_list, file, line);
data_string_forget (&state -> filename, file, line);
data_string_forget (&state -> server_name, file, line);
data_string_forget (&ptr -> parameter_request_list, file, line);
data_string_forget (&ptr -> filename, file, line);
data_string_forget (&ptr -> server_name, file, line);
ptr -> next = free_lease_states;
free_lease_states = ptr;
dmalloc_reuse (free_lease_states, (char *)0, 0, 0);
......@@ -690,7 +425,7 @@ void free_pair (foo, file, line)
{
foo -> cdr = free_pairs;
free_pairs = foo;
dmalloc_reuse (free_expressions, (char *)0, 0, 0);
dmalloc_reuse (free_pairs, (char *)0, 0, 0);
}
struct expression *free_expressions;
......@@ -721,8 +456,7 @@ int expression_reference (ptr, src, file, line)
int line;
{
if (!ptr) {
log_error ("Null pointer in expression_reference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -730,8 +464,7 @@ int expression_reference (ptr, src, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in expression_reference (%s)",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -786,8 +519,7 @@ int option_cache_reference (ptr, src, file, line)
int line;
{
if (!ptr) {
log_error ("Null pointer in option_cache_reference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -795,8 +527,7 @@ int option_cache_reference (ptr, src, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in option_cache_reference (%s)",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -833,8 +564,7 @@ int buffer_reference (ptr, bp, file, line)
int line;
{
if (!ptr) {
log_error ("Null pointer passed to buffer_reference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -842,8 +572,7 @@ int buffer_reference (ptr, bp, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in buffer_reference (%s)",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -865,8 +594,7 @@ int buffer_dereference (ptr, file, line)
struct buffer *bp;
if (!ptr) {
log_error ("Null pointer passed to buffer_dereference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -875,8 +603,7 @@ int buffer_dereference (ptr, file, line)
}
if (!*ptr) {
log_error ("Null pointer in buffer_dereference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -885,11 +612,11 @@ int buffer_dereference (ptr, file, line)
}
(*ptr) -> refcnt--;
rc_register (name, line, *ptr, (*ptr) -> refcnt);
rc_register (file, line, *ptr, (*ptr) -> refcnt);
if (!(*ptr) -> refcnt)
dfree ((*ptr), file, line);
if ((*ptr) -> refcnt < 0) {
log_error ("buffer_dereference: negative refcnt!");
log_error ("%s(%d): negative refcnt!", file, line);
#if defined (DEBUG_RC_HISTORY)
dump_rc_history ();
#endif
......@@ -927,8 +654,7 @@ int dns_host_entry_reference (ptr, bp, file, line)
int line;
{
if (!ptr) {
log_error ("Null pointer in dns_host_entry_reference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -936,8 +662,7 @@ int dns_host_entry_reference (ptr, bp, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in dns_host_entry_reference (%s)",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -959,8 +684,7 @@ int dns_host_entry_dereference (ptr, file, line)
struct dns_host_entry *bp;
if (!ptr || !*ptr) {
log_error ("Null pointer in dns_host_entry_dereference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -973,7 +697,7 @@ int dns_host_entry_dereference (ptr, file, line)
if (!(*ptr) -> refcnt)
dfree ((*ptr), file, line);
if ((*ptr) -> refcnt < 0) {
log_error ("dns_host_entry_dereference: negative refcnt!");
log_error ("%s(%d): negative refcnt!", file, line);
#if defined (DEBUG_RC_HISTORY)
dump_rc_history ();
#endif
......@@ -995,8 +719,7 @@ int option_state_allocate (ptr, file, line)
unsigned size;
if (!ptr) {
log_error ("Null pointer passed to option_state_allocate: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1004,8 +727,7 @@ int option_state_allocate (ptr, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in option_state_allocate (%s)",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1032,8 +754,7 @@ int option_state_reference (ptr, bp, file, line)
int line;
{
if (!ptr) {
log_error ("Null pointer in option_state_reference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1041,8 +762,7 @@ int option_state_reference (ptr, bp, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in option_state_reference (%s)",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1065,8 +785,7 @@ int option_state_dereference (ptr, file, line)
struct option_state *options;
if (!ptr || !*ptr) {
log_error ("Null pointer in option_state_dereference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1082,7 +801,7 @@ int option_state_dereference (ptr, file, line)
return 1;
if (options -> refcnt < 0) {
log_error ("option_state_dereference: negative refcnt!");
log_error ("%s(%d): negative refcnt!", file, line);
#if defined (DEBUG_RC_HISTORY)
dump_rc_history ();
#endif
......@@ -1125,8 +844,7 @@ int executable_statement_reference (ptr, bp, file, line)
int line;
{
if (!ptr) {
log_error ("Null ptr in executable_statement_reference: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1134,8 +852,7 @@ int executable_statement_reference (ptr, bp, file, line)
#endif
}
if (*ptr) {
log_error ("Nonnull ptr in executable_statement_reference: %s",
file, line);
log_error ("%s(%d): non-null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1159,8 +876,7 @@ int packet_allocate (ptr, file, line)
int size;
if (!ptr) {
log_error ("Null pointer passed to packet_allocate: %s",
file, line);
log_error ("%s(%d): null pointer", file, line);
#if defined (POINTER_DEBUG)
abort ();
#else
......@@ -1168,8 +884,7 @@ int packet_allocate (ptr, file, line)
#endif
}
if (*ptr) {
log_error ("Non-null pointer in packet_allocate (%s)",
file, line);