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 @@ ...@@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */ 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 * Use is subject to license terms which appear in the file named
* ISC-LICENSE that should have accompanied this file when you * ISC-LICENSE that should have accompanied this file when you
* received it. If a file named ISC-LICENSE did not accompany this * received it. If a file named ISC-LICENSE did not accompany this
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
...@@ -302,8 +302,7 @@ void parse_client_statement (cfile, ip, config) ...@@ -302,8 +302,7 @@ void parse_client_statement (cfile, ip, config)
return; return;
for (; *p; p = &((*p) -> next)) for (; *p; p = &((*p) -> next))
; ;
executable_statement_reference (p, stmt, executable_statement_reference (p, stmt, MDL);
"parse_client_statement");
stmt -> next = (struct executable_statement *)0; stmt -> next = (struct executable_statement *)0;
return; return;
......
...@@ -92,7 +92,7 @@ dhclient.leases file. In order to prevent the file from becoming ...@@ -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 arbitrarily large, from time to time dhclient creates a new
dhclient.leases file from its in-core lease database. The old version dhclient.leases file from its in-core lease database. The old version
of the dhclient.leases file is retained under the name of the dhclient.leases file is retained under the name
.IR dhcpd.leases~ .IR dhclient.leases~
until the next time dhclient rewrites the database. until the next time dhclient rewrites the database.
.PP .PP
Old leases are kept around in case the DHCP server is unavailable when Old leases are kept around in case the DHCP server is unavailable when
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
DHCP Client. */ 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 * Use is subject to license terms which appear in the file named
* ISC-LICENSE that should have accompanied this file when you * ISC-LICENSE that should have accompanied this file when you
* received it. If a file named ISC-LICENSE did not accompany this * received it. If a file named ISC-LICENSE did not accompany this
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#ifndef lint #ifndef lint
static char ocopyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
...@@ -47,8 +47,6 @@ int dhcp_max_agent_option_packet_length = 0; ...@@ -47,8 +47,6 @@ int dhcp_max_agent_option_packet_length = 0;
int interfaces_requested = 0; int interfaces_requested = 0;
int log_perror = 1;
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } };
struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } }; struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } };
struct in_addr inaddr_any; struct in_addr inaddr_any;
...@@ -70,7 +68,6 @@ static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.htm ...@@ -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 local_port;
u_int16_t remote_port; u_int16_t remote_port;
int log_priority;
int no_daemon; int no_daemon;
int save_scripts; int save_scripts;
...@@ -325,10 +322,6 @@ static void usage () ...@@ -325,10 +322,6 @@ static void usage ()
"[-cf config-file] [interface]"); "[-cf config-file] [interface]");
} }
void cleanup ()
{
}
struct class *find_class (s) struct class *find_class (s)
const char *s; const char *s;
{ {
......
...@@ -49,7 +49,7 @@ OOPPEERRAATTIIOONN ...@@ -49,7 +49,7 @@ OOPPEERRAATTIIOONN
dhclient creates a new dhclient.leases file from its in- dhclient creates a new dhclient.leases file from its in-
core lease database. The old version of the core lease database. The old version of the
dhclient.leases file is retained under the name 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. database.
Old leases are kept around in case the DHCP server is 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 ...@@ -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 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 any, and also called once if no valid lease can be identified. For
more information, see more information, see
.B dhclient-lease(8). .B dhclient-script(8).
.PP .PP
\fBmedium "\fImedia setup\fB";\fR \fBmedium "\fImedia setup\fB";\fR
.PP .PP
......
...@@ -375,7 +375,7 @@ dhclient.conf(5) dhclient.conf(5) ...@@ -375,7 +375,7 @@ dhclient.conf(5) dhclient.conf(5)
If no lease is acquired, the script is used to test prede­ If no lease is acquired, the script is used to test prede­
fined leases, if any, and also called once if no valid fined leases, if any, and also called once if no valid
lease can be identified. For more information, see 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"";; 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 ...@@ -21,11 +21,11 @@ CATMANPAGES = dhcp-options.cat5 dhcp-contrib.cat5 dhcp-eval.cat5
SEDMANPAGES = dhcp-options.man5 dhcp-contrib.man5 dhcp-eval.man5 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 \ 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 \ 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 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 \ 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 \ 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 inet_addr.o dns.o resolv.o execute.o discover.o auth.o
MAN = dhcp-options.5 dhcp-contrib.5 dhcp-eval.5 MAN = dhcp-options.5 dhcp-contrib.5 dhcp-eval.5
......
...@@ -22,280 +22,15 @@ ...@@ -22,280 +22,15 @@
#ifndef lint #ifndef lint
static char copyright[] = 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 */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
#include <omapip/omapip_p.h>
struct dhcp_packet *dhcp_free_list; struct dhcp_packet *dhcp_free_list;
struct packet *packet_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) struct dhcp_packet *new_dhcp_packet (file, line)
const char *file; const char *file;
int line; int line;
...@@ -501,9 +236,9 @@ void free_lease_state (ptr, file, line) ...@@ -501,9 +236,9 @@ void free_lease_state (ptr, file, line)
option_state_dereference (&ptr -> options, file, line); option_state_dereference (&ptr -> options, file, line);
if (ptr -> packet) if (ptr -> packet)
packet_dereference (&ptr -> packet, file, line); packet_dereference (&ptr -> packet, file, line);
data_string_forget (&state -> parameter_request_list, file, line); data_string_forget (&ptr -> parameter_request_list, file, line);
data_string_forget (&state -> filename, file, line); data_string_forget (&ptr -> filename, file, line);
data_string_forget (&state -> server_name, file, line); data_string_forget (&ptr -> server_name, file, line);
ptr -> next = free_lease_states; ptr -> next = free_lease_states;
free_lease_states = ptr; free_lease_states = ptr;
dmalloc_reuse (free_lease_states, (char *)0, 0, 0); dmalloc_reuse (free_lease_states, (char *)0, 0, 0);
...@@ -690,7 +425,7 @@ void free_pair (foo, file, line) ...@@ -690,7 +425,7 @@ void free_pair (foo, file, line)
{ {
foo -> cdr = free_pairs; foo -> cdr = free_pairs;
free_pairs = foo; free_pairs = foo;
dmalloc_reuse (free_expressions, (char *)0, 0, 0); dmalloc_reuse (free_pairs, (char *)0, 0, 0);
} }
struct expression *free_expressions; struct expression *free_expressions;
...@@ -721,8 +456,7 @@ int expression_reference (ptr, src, file, line) ...@@ -721,8 +456,7 @@ int expression_reference (ptr, src, file, line)
int line; int line;
{ {
if (!ptr) { if (!ptr) {
log_error ("Null pointer in expression_reference: %s", log_error ("%s(%d): null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -730,8 +464,7 @@ int expression_reference (ptr, src, file, line) ...@@ -730,8 +464,7 @@ int expression_reference (ptr, src, file, line)
#endif #endif
} }
if (*ptr) { if (*ptr) {
log_error ("Non-null pointer in expression_reference (%s)", log_error ("%s(%d): non-null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -786,8 +519,7 @@ int option_cache_reference (ptr, src, file, line) ...@@ -786,8 +519,7 @@ int option_cache_reference (ptr, src, file, line)
int line; int line;
{ {
if (!ptr) { if (!ptr) {
log_error ("Null pointer in option_cache_reference: %s", log_error ("%s(%d): null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -795,8 +527,7 @@ int option_cache_reference (ptr, src, file, line) ...@@ -795,8 +527,7 @@ int option_cache_reference (ptr, src, file, line)
#endif #endif
} }
if (*ptr) { if (*ptr) {
log_error ("Non-null pointer in option_cache_reference (%s)", log_error ("%s(%d): non-null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -833,8 +564,7 @@ int buffer_reference (ptr, bp, file, line) ...@@ -833,8 +564,7 @@ int buffer_reference (ptr, bp, file, line)
int line; int line;
{ {
if (!ptr) { if (!ptr) {
log_error ("Null pointer passed to buffer_reference: %s", log_error ("%s(%d): null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -842,8 +572,7 @@ int buffer_reference (ptr, bp, file, line) ...@@ -842,8 +572,7 @@ int buffer_reference (ptr, bp, file, line)
#endif #endif
} }
if (*ptr) { if (*ptr) {
log_error ("Non-null pointer in buffer_reference (%s)", log_error ("%s(%d): non-null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -865,8 +594,7 @@ int buffer_dereference (ptr, file, line) ...@@ -865,8 +594,7 @@ int buffer_dereference (ptr, file, line)
struct buffer *bp; struct buffer *bp;
if (!ptr) { if (!ptr) {
log_error ("Null pointer passed to buffer_dereference: %s", log_error ("%s(%d): null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -875,8 +603,7 @@ int buffer_dereference (ptr, file, line) ...@@ -875,8 +603,7 @@ int buffer_dereference (ptr, file, line)
} }
if (!*ptr) { if (!*ptr) {
log_error ("Null pointer in buffer_dereference: %s", log_error ("%s(%d): null pointer", file, line);
file, line);
#if defined (POINTER_DEBUG) #if defined (POINTER_DEBUG)
abort (); abort ();
#else #else
...@@ -885,11 +612,11 @@ int buffer_dereference (ptr, file, line) ...@@ -885,11 +612,11 @@ int buffer_dereference (ptr, file, line)
} }
(*ptr) -> refcnt--; (*ptr) -> refcnt--;
rc_register (name, line, *ptr, (*ptr) -> refcnt); rc_register (file, line, *ptr, (*ptr) -> refcnt);
if (!(*ptr) -> refcnt) if (!(*ptr) -> refcnt)
dfree ((*ptr), file, line); dfree ((*ptr), file, line);
if ((*ptr) -> refcnt < 0) { if ((*ptr) -> refcnt < 0) {
log_error ("buffer_dereference: negative refcnt!"); log_error ("%s(%d): negative refcnt!", file, line);