summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.conf9
-rw-r--r--client/clparse.c47
-rw-r--r--client/dhclient.c26
-rw-r--r--client/dhclient.conf.cat592
-rw-r--r--common/alloc.c140
-rw-r--r--common/auth.c9
-rw-r--r--common/conflex.c10
-rw-r--r--common/convert.c16
-rw-r--r--common/dhcp-eval.cat5254
-rw-r--r--common/discover.c17
-rw-r--r--common/dns.c16
-rw-r--r--common/errwarn.c23
-rw-r--r--common/ethernet.c6
-rw-r--r--common/execute.c6
-rw-r--r--common/hash.c32
-rw-r--r--common/memory.c4
-rw-r--r--common/nsupdate.c16
-rw-r--r--common/options.c69
-rw-r--r--common/packet.c22
-rw-r--r--common/parse.c172
-rw-r--r--common/print.c227
-rw-r--r--common/resolv.c4
-rw-r--r--common/tables.c19
-rw-r--r--common/tr.c4
-rw-r--r--common/tree.c85
-rw-r--r--contrib/dhcp.desc161
-rw-r--r--dhcpctl/callback.c4
-rw-r--r--dhcpctl/dhcpctl.c18
-rw-r--r--dhcpctl/dhcpctl.h24
-rw-r--r--dhcpctl/remote.c6
-rw-r--r--dhcpctl/test.c3
-rw-r--r--includes/auth.h2
-rw-r--r--includes/dhcpd.h394
-rw-r--r--includes/hash.h8
-rw-r--r--includes/inet.h2
-rw-r--r--includes/isc/result.h2
-rw-r--r--includes/omapip/alloc.h29
-rw-r--r--includes/omapip/buffer.h8
-rw-r--r--includes/omapip/omapip.h125
-rw-r--r--includes/tree.h16
-rw-r--r--omapip/alloc.c37
-rw-r--r--omapip/buffer.c39
-rw-r--r--omapip/connection.c8
-rw-r--r--omapip/dispatch.c6
-rw-r--r--omapip/generic.c6
-rw-r--r--omapip/listener.c6
-rw-r--r--omapip/message.c18
-rw-r--r--omapip/protocol.c27
-rw-r--r--omapip/result.c4
-rw-r--r--omapip/support.c47
-rw-r--r--relay/dhcrelay.c17
-rw-r--r--server/bootp.c4
-rw-r--r--server/class.c4
-rw-r--r--server/confpars.c78
-rw-r--r--server/db.c23
-rw-r--r--server/dhcp.c38
-rw-r--r--server/dhcpd.c26
-rw-r--r--server/dhcpd.cat878
-rw-r--r--server/dhcpd.conf.cat5492
-rw-r--r--server/mdb.c22
-rw-r--r--server/omapi.c30
61 files changed, 1754 insertions, 1383 deletions
diff --git a/Makefile.conf b/Makefile.conf
index ee0f1952..96020a49 100644
--- a/Makefile.conf
+++ b/Makefile.conf
@@ -196,9 +196,12 @@ MINORVERSION=MinorVersion
## NetBSD
##--netbsd--
#CF = cf/netbsd.h
-#COPTS = -Wall -Wstrict-prototypes -Wno-unused -Wno-implicit -Wno-comment \
-# -Wno-uninitialized -Werror -Wno-switch \
-# -Wimplicit-function-declaration -pipe $(BINDDEF)
+#COPTS = -Wall -Wstrict-prototypes -Wno-unused -Wno-comment \
+# -Wno-uninitialized -Werror \
+# -Wimplicit-function-declaration -Wpointer-arith -Wcast-qual \
+# -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes \
+# -Wmissing-declarations -Wnested-externs \
+# -pipe $(BINDDEF)
#SCRIPT=netbsd
##--netbsd--
diff --git a/client/clparse.c b/client/clparse.c
index b4e7fd31..c6c8b52c 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.35 1999/10/01 03:42:31 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.36 1999/10/07 06:35:35 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -51,7 +51,7 @@ isc_result_t read_client_conf ()
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
int token;
int declaration = 0;
struct client_config *config;
@@ -140,7 +140,7 @@ void read_client_leases ()
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
int token;
/* Open the lease file. If we can't open it, just return -
@@ -192,7 +192,7 @@ void parse_client_statement (cfile, ip, config)
struct client_config *config;
{
int token;
- char *val;
+ const char *val;
struct option *option;
struct executable_statement *stmt, **p;
enum statement_op op;
@@ -200,6 +200,7 @@ void parse_client_statement (cfile, ip, config)
char *name;
struct data_string key_id;
enum policy policy;
+ int known;
switch (peek_token (&val, cfile)) {
case AUTH_KEY:
@@ -291,7 +292,8 @@ void parse_client_statement (cfile, ip, config)
op = supersede_option_statement;
do_option:
token = next_token (&val, cfile);
- option = parse_option_name (cfile, 0);
+ known = 0;
+ option = parse_option_name (cfile, 0, &known);
if (!option)
return;
stmt = (struct executable_statement *)0;
@@ -321,7 +323,7 @@ void parse_client_statement (cfile, ip, config)
return;
}
- option = parse_option_name (cfile, 1);
+ option = parse_option_name (cfile, 1, &known);
if (!option)
return;
@@ -485,11 +487,11 @@ void parse_client_statement (cfile, ip, config)
int parse_X (cfile, buf, max)
struct parse *cfile;
u_int8_t *buf;
- int max;
+ unsigned max;
{
int token;
- char *val;
- int len;
+ const char *val;
+ unsigned len;
u_int8_t *s;
token = peek_token (&val, cfile);
@@ -541,7 +543,7 @@ void parse_option_list (cfile, list)
{
int ix, i;
int token;
- char *val;
+ const char *val;
pair p = (pair)0, q, r;
ix = 0;
@@ -606,7 +608,7 @@ void parse_interface_declaration (cfile, outer_config, name)
char *name;
{
int token;
- char *val;
+ const char *val;
struct client_state *client, **cp;
struct interface_info *ip;
@@ -663,7 +665,7 @@ void parse_interface_declaration (cfile, outer_config, name)
}
struct interface_info *interface_or_dummy (name)
- char *name;
+ const char *name;
{
struct interface_info *ip;
@@ -738,7 +740,7 @@ void parse_client_lease_statement (cfile, is_static)
struct client_lease *lease, *lp, *pl;
struct interface_info *ip = (struct interface_info *)0;
int token;
- char *val;
+ const char *val;
struct client_state *client = (struct client_state *)0;
token = next_token (&val, cfile);
@@ -865,7 +867,7 @@ void parse_client_lease_declaration (cfile, lease, ipp, clientp)
struct client_state **clientp;
{
int token;
- char *val;
+ const char *val;
char *t, *n;
struct interface_info *ip;
struct option_cache *oc;
@@ -970,20 +972,21 @@ int parse_option_decl (oc, cfile)
struct option_cache **oc;
struct parse *cfile;
{
- char *val;
+ const char *val;
int token;
u_int8_t buf [4];
u_int8_t hunkbuf [1024];
- int hunkix = 0;
- char *fmt;
+ unsigned hunkix = 0;
+ const char *fmt;
struct option *option;
struct iaddr ip_addr;
u_int8_t *dp;
- int len;
+ unsigned len;
int nul_term = 0;
struct buffer *bp;
+ int known = 0;
- option = parse_option_name (cfile, 0);
+ option = parse_option_name (cfile, 0, &known);
if (!option)
return 0;
@@ -1105,7 +1108,7 @@ int parse_option_decl (oc, cfile)
goto alloc;
default:
- log_error ("Bad format %c in parse_option_param.",
+ log_error ("parse_option_param: Bad format %c",
*fmt);
skip_to_semi (cfile);
return 0;
@@ -1144,7 +1147,7 @@ void parse_string_list (cfile, lp, multiple)
int multiple;
{
int token;
- char *val;
+ const char *val;
struct string_list *cur, *tmp;
/* Find the last medium in the media list. */
@@ -1193,7 +1196,7 @@ void parse_reject_statement (cfile, config)
struct client_config *config;
{
int token;
- char *val;
+ const char *val;
struct iaddr addr;
struct iaddrlist *list;
diff --git a/client/dhclient.c b/client/dhclient.c
index 02e9962c..256aa793 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -22,7 +22,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.83 1999/10/01 03:42:47 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.84 1999/10/07 06:35:36 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -33,9 +33,9 @@ TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */
struct tree_cache *global_options [256];
-char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
-char *path_dhclient_db = _PATH_DHCLIENT_DB;
-char *path_dhclient_pid = _PATH_DHCLIENT_PID;
+const char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
+const char *path_dhclient_db = _PATH_DHCLIENT_DB;
+const char *path_dhclient_pid = _PATH_DHCLIENT_PID;
int dhcp_max_agent_option_packet_length = 0;
@@ -75,7 +75,7 @@ int main (argc, argv, envp)
struct servent *ent;
struct interface_info *ip;
struct client_state *client;
- int seed;
+ unsigned seed;
int quiet = 0;
char *server = (char *)0;
isc_result_t status;
@@ -290,7 +290,7 @@ void cleanup ()
}
struct class *find_class (s)
- char *s;
+ const char *s;
{
return (struct class *)0;
}
@@ -774,7 +774,7 @@ void dhcp (packet)
{
struct iaddrlist *ap;
void (*handler) PROTO ((struct packet *));
- char *type;
+ const char *type;
switch (packet -> packet_type) {
case DHCPOFFER:
@@ -817,7 +817,7 @@ void dhcpoffer (packet)
struct client_lease *lease, *lp;
int i;
int stop_selecting;
- char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY";
+ const char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY";
struct iaddrlist *ap;
struct option_cache *oc;
@@ -966,7 +966,7 @@ struct client_lease *packet_to_lease (packet)
/* If the server name was filled out, copy it. */
if (!(i & 2) && packet -> raw -> sname [0]) {
- int len;
+ unsigned len;
/* Don't count on the NUL terminator. */
for (len = 0; len < 64; len++)
if (!packet -> raw -> sname [len])
@@ -985,7 +985,7 @@ struct client_lease *packet_to_lease (packet)
/* Ditto for the filename. */
if (!(i & 1) && packet -> raw -> file [0]) {
- int len;
+ unsigned len;
/* Don't count on the NUL terminator. */
for (len = 0; len < 64; len++)
if (!packet -> raw -> file [len])
@@ -1466,7 +1466,7 @@ void make_client_options (client, lease, type, sid, rip, prl, op)
u_int32_t *prl;
struct option_state **op;
{
- int i;
+ unsigned i;
struct option_cache *oc;
struct buffer *bp = (struct buffer *)0;
@@ -1943,7 +1943,7 @@ FILE *scriptFile;
void script_init (client, reason, medium)
struct client_state *client;
- char *reason;
+ const char *reason;
struct string_list *medium;
{
int fd;
@@ -1987,7 +1987,7 @@ void script_init (client, reason, medium)
void script_write_params (client, prefix, lease)
struct client_state *client;
- char *prefix;
+ const char *prefix;
struct client_lease *lease;
{
int i;
diff --git a/client/dhclient.conf.cat5 b/client/dhclient.conf.cat5
index c561c215..d83ac0eb 100644
--- a/client/dhclient.conf.cat5
+++ b/client/dhclient.conf.cat5
@@ -492,6 +492,48 @@ OOTTHHEERR DDEECCLLAARRAATTIIOONNSS
ration will use the parameters declared outside of any
interface declaration, or the default settings.
+ ppsseeuuddoo ""_n_a_m_e" "_r_e_a_l_-_n_a_m_e"" {{ _d_e_c_l_a_r_a_t_i_o_n_s _._._. }}
+
+ Under some circumstances it can be useful to declare a
+ pseudo-interface and have the DHCP client acquire a con­
+ figuration for that interface. Each interface that the
+ DHCP client is supporting normally has a DHCP client state
+ machine running on it to acquire and maintain its lease.
+ A pseudo-interface is just another state machine running
+ on the interface named _r_e_a_l_-_n_a_m_e, with its own lease and
+ its own state. If you use this feature, you must provide
+ a client identifier for both the pseudo-interface and the
+ actual interface, and the two identifiers must be differ­
+ ent. You must also provide a seperate client script for
+ the pseudo-interface to do what you want with the IP
+ address. For example:
+
+ interface "ep0" {
+ send dhcp-client-identifier "my-client-ep0";
+ }
+ pseudo "secondary" "ep0" {
+ send dhcp-client-identifier "my-client-ep0-secondary";
+ script "/etc/dhclient-secondary";
+ }
+
+ The client script for the pseudo-interface should not con­
+ figure the interface up or down - essentially, all it
+ needs to handle are the states where a lease has been
+ acquired or renewed, and the states where a lease has
+
+
+
+ 8
+
+
+
+
+
+dhclient.conf(5) dhclient.conf(5)
+
+
+ expired. See ddhhcclliieenntt--ssccrriipptt((88)) for more information.
+
mmeeddiiaa ""_m_e_d_i_a _s_e_t_u_p"" _[ ,, ""_m_e_d_i_a _s_e_t_u_p"",, _._._. _];;
The mmeeddiiaa statement defines one or more media configura­
@@ -520,18 +562,6 @@ SSAAMMPPLLEE
192.5.5.213, and has one interface, ep0 (a 3com 3C589C).
Booting intervals have been shortened somewhat from the
default, because the client is known to spend most of its
-
-
-
- 8
-
-
-
-
-
-dhclient.conf(5) dhclient.conf(5)
-
-
time on networks with little DHCP activity. The laptop
does roam to multiple networks.
@@ -556,6 +586,18 @@ dhclient.conf(5) dhclient.conf(5)
media "media 10baseT/UTP", "media 10base2/BNC";
}
+
+
+
+ 9
+
+
+
+
+
+dhclient.conf(5) dhclient.conf(5)
+
+
alias {
interface "ep0";
fixed-address 192.5.5.213;
@@ -589,6 +631,30 @@ AAUUTTHHOORR
- 9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
diff --git a/common/alloc.c b/common/alloc.c
index 2f2626aa..924dcbe0 100644
--- a/common/alloc.c
+++ b/common/alloc.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: alloc.c,v 1.33 1999/07/31 17:53:05 mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: alloc.c,v 1.34 1999/10/07 06:35:40 mellon Exp $ Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -31,8 +31,8 @@ struct dhcp_packet *dhcp_free_list;
struct packet *packet_free_list;
VOIDPTR dmalloc (size, name)
- int size;
- char *name;
+ unsigned size;
+ const char *name;
{
VOIDPTR foo = (VOIDPTR)malloc (size);
if (!foo)
@@ -44,7 +44,7 @@ VOIDPTR dmalloc (size, name)
void dfree (ptr, name)
VOIDPTR ptr;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("dfree %s: free on null pointer.", name);
@@ -54,7 +54,7 @@ void dfree (ptr, name)
}
struct dhcp_packet *new_dhcp_packet (name)
- char *name;
+ const char *name;
{
struct dhcp_packet *rval;
rval = (struct dhcp_packet *)dmalloc (sizeof (struct dhcp_packet),
@@ -64,7 +64,7 @@ struct dhcp_packet *new_dhcp_packet (name)
struct hash_table *new_hash_table (count, name)
int count;
- char *name;
+ const char *name;
{
struct hash_table *rval = dmalloc (sizeof (struct hash_table)
- (DEFAULT_HASH_SIZE
@@ -77,43 +77,43 @@ struct hash_table *new_hash_table (count, name)
}
struct hash_bucket *new_hash_bucket (name)
- char *name;
+ const char *name;
{
struct hash_bucket *rval = dmalloc (sizeof (struct hash_bucket), name);
return rval;
}
struct lease *new_leases (n, name)
- int n;
- char *name;
+ unsigned n;
+ const char *name;
{
struct lease *rval = dmalloc (n * sizeof (struct lease), name);
return rval;
}
struct lease *new_lease (name)
- char *name;
+ const char *name;
{
struct lease *rval = dmalloc (sizeof (struct lease), name);
return rval;
}
struct subnet *new_subnet (name)
- char *name;
+ const char *name;
{
struct subnet *rval = dmalloc (sizeof (struct subnet), name);
return rval;
}
struct class *new_class (name)
- char *name;
+ const char *name;
{
struct class *rval = dmalloc (sizeof (struct class), name);
return rval;
}
struct shared_network *new_shared_network (name)
- char *name;
+ const char *name;
{
struct shared_network *rval =
dmalloc (sizeof (struct shared_network), name);
@@ -121,7 +121,7 @@ struct shared_network *new_shared_network (name)
}
struct group *new_group (name)
- char *name;
+ const char *name;
{
struct group *rval =
dmalloc (sizeof (struct group), name);
@@ -131,7 +131,7 @@ struct group *new_group (name)
}
struct protocol *new_protocol (name)
- char *name;
+ const char *name;
{
struct protocol *rval = dmalloc (sizeof (struct protocol), name);
return rval;
@@ -140,7 +140,7 @@ struct protocol *new_protocol (name)
struct lease_state *free_lease_states;
struct lease_state *new_lease_state (name)
- char *name;
+ const char *name;
{
struct lease_state *rval;
@@ -162,7 +162,7 @@ struct lease_state *new_lease_state (name)
}
struct domain_search_list *new_domain_search_list (name)
- char *name;
+ const char *name;
{
struct domain_search_list *rval =
dmalloc (sizeof (struct domain_search_list), name);
@@ -170,7 +170,7 @@ struct domain_search_list *new_domain_search_list (name)
}
struct name_server *new_name_server (name)
- char *name;
+ const char *name;
{
struct name_server *rval =
dmalloc (sizeof (struct name_server), name);
@@ -179,13 +179,13 @@ struct name_server *new_name_server (name)
void free_name_server (ptr, name)
struct name_server *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
struct option *new_option (name)
- char *name;
+ const char *name;
{
struct option *rval =
dmalloc (sizeof (struct option), name);
@@ -196,7 +196,7 @@ struct option *new_option (name)
void free_option (ptr, name)
struct option *ptr;
- char *name;
+ const char *name;
{
/* XXX have to put all options on heap before this is possible. */
#if 0
@@ -207,7 +207,7 @@ void free_option (ptr, name)
}
struct universe *new_universe (name)
- char *name;
+ const char *name;
{
struct universe *rval =
dmalloc (sizeof (struct universe), name);
@@ -216,21 +216,21 @@ struct universe *new_universe (name)
void free_universe (ptr, name)
struct universe *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_domain_search_list (ptr, name)
struct domain_search_list *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_lease_state (ptr, name)
struct lease_state *ptr;
- char *name;
+ const char *name;
{
if (ptr -> options)
option_state_dereference (&ptr -> options, name);
@@ -242,69 +242,69 @@ void free_lease_state (ptr, name)
void free_protocol (ptr, name)
struct protocol *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_group (ptr, name)
struct group *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_shared_network (ptr, name)
struct shared_network *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_class (ptr, name)
struct class *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_subnet (ptr, name)
struct subnet *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_lease (ptr, name)
struct lease *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_hash_bucket (ptr, name)
struct hash_bucket *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_hash_table (ptr, name)
struct hash_table *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
void free_dhcp_packet (ptr, name)
struct dhcp_packet *ptr;
- char *name;
+ const char *name;
{
dfree ((VOIDPTR)ptr, name);
}
struct client_lease *new_client_lease (name)
- char *name;
+ const char *name;
{
return (struct client_lease *)dmalloc (sizeof (struct client_lease),
name);
@@ -312,13 +312,13 @@ struct client_lease *new_client_lease (name)
void free_client_lease (lease, name)
struct client_lease *lease;
- char *name;
+ const char *name;
{
dfree (lease, name);
}
struct pool *new_pool (name)
- char *name;
+ const char *name;
{
struct pool *pool = ((struct pool *)
dmalloc (sizeof (struct pool), name));
@@ -330,14 +330,14 @@ struct pool *new_pool (name)
void free_pool (pool, name)
struct pool *pool;
- char *name;
+ const char *name;
{
dfree (pool, name);
}
#if defined (FAILOVER_PROTOCOL)
struct failover_peer *new_failover_peer (name)
- char *name;
+ const char *name;
{
struct failover_peer *peer = ((struct failover_peer *)
dmalloc (sizeof (struct failover_peer),
@@ -350,18 +350,18 @@ struct failover_peer *new_failover_peer (name)
void free_failover_peer (peer, name)
struct failover_peer *peer;
- char *name;
+ const char *name;
{
dfree (peer, name);
}
#endif /* defined (FAILOVER_PROTOCOL) */
struct auth_key *new_auth_key (len, name)
- int len;
- char *name;
+ unsigned len;
+ const char *name;
{
struct auth_key *peer;
- int size = len - 1 + sizeof (struct auth_key);
+ unsigned size = len - 1 + sizeof (struct auth_key);
peer = (struct auth_key *)dmalloc (size, name);
if (!peer)
@@ -372,13 +372,13 @@ struct auth_key *new_auth_key (len, name)
void free_auth_key (peer, name)
struct auth_key *peer;
- char *name;
+ const char *name;
{
dfree (peer, name);
}
struct permit *new_permit (name)
- char *name;
+ const char *name;
{
struct permit *permit = ((struct permit *)
dmalloc (sizeof (struct permit), name));
@@ -390,7 +390,7 @@ struct permit *new_permit (name)
void free_permit (permit, name)
struct permit *permit;
- char *name;
+ const char *name;
{
dfree (permit, name);
}
@@ -398,7 +398,7 @@ void free_permit (permit, name)
pair free_pairs;
pair new_pair (name)
- char *name;
+ const char *name;
{
pair foo;
@@ -418,7 +418,7 @@ pair new_pair (name)
void free_pair (foo, name)
pair foo;
- char *name;
+ const char *name;
{
foo -> cdr = free_pairs;
free_pairs = foo;
@@ -428,7 +428,7 @@ struct expression *free_expressions;
int expression_allocate (cptr, name)
struct expression **cptr;
- char *name;
+ const char *name;
{
struct expression *rval;
@@ -446,7 +446,7 @@ int expression_allocate (cptr, name)
void free_expression (expr, name)
struct expression *expr;
- char *name;
+ const char *name;
{
expr -> data.not = free_expressions;
free_expressions = expr;
@@ -455,7 +455,7 @@ void free_expression (expr, name)
int expression_reference (ptr, src, name)
struct expression **ptr;
struct expression *src;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null pointer in expression_reference: %s", name);
@@ -484,7 +484,7 @@ struct option_cache *free_option_caches;
int option_cache_allocate (cptr, name)
struct option_cache **cptr;
- char *name;
+ const char *name;
{
struct option_cache *rval;
@@ -504,7 +504,7 @@ int option_cache_allocate (cptr, name)
int option_cache_reference (ptr, src, name)
struct option_cache **ptr;
struct option_cache *src;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null pointer in option_cache_reference: %s", name);
@@ -531,8 +531,8 @@ int option_cache_reference (ptr, src, name)
int buffer_allocate (ptr, len, name)
struct buffer **ptr;
- int len;
- char *name;
+ unsigned len;
+ const char *name;
{
struct buffer *bp;
@@ -547,7 +547,7 @@ int buffer_allocate (ptr, len, name)
int buffer_reference (ptr, bp, name)
struct buffer **ptr;
struct buffer *bp;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null pointer passed to buffer_reference: %s",
@@ -574,7 +574,7 @@ int buffer_reference (ptr, bp, name)
int buffer_dereference (ptr, name)
struct buffer **ptr;
- char *name;
+ const char *name;
{
struct buffer *bp;
@@ -606,8 +606,8 @@ int buffer_dereference (ptr, name)
int dns_host_entry_allocate (ptr, hostname, name)
struct dns_host_entry **ptr;
- char *hostname;
- char *name;
+ const char *hostname;
+ const char *name;
{
struct dns_host_entry *bp;
@@ -623,7 +623,7 @@ int dns_host_entry_allocate (ptr, hostname, name)
int dns_host_entry_reference (ptr, bp, name)
struct dns_host_entry **ptr;
struct dns_host_entry *bp;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null pointer in dns_host_entry_reference: %s",
@@ -651,7 +651,7 @@ int dns_host_entry_reference (ptr, bp, name)
int dns_host_entry_dereference (ptr, name)
struct dns_host_entry **ptr;
- char *name;
+ const char *name;
{
struct dns_host_entry *bp;
@@ -674,9 +674,9 @@ int dns_host_entry_dereference (ptr, name)
int option_state_allocate (ptr, name)
struct option_state **ptr;
- char *name;
+ const char *name;
{
- int size;
+ unsigned size;
if (!ptr) {
log_error ("Null pointer passed to option_state_allocate: %s",
@@ -712,7 +712,7 @@ int option_state_allocate (ptr, name)
int option_state_reference (ptr, bp, name)
struct option_state **ptr;
struct option_state *bp;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null pointer in option_state_reference: %s",
@@ -740,7 +740,7 @@ int option_state_reference (ptr, bp, name)
int option_state_dereference (ptr, name)
struct option_state **ptr;
- char *name;
+ const char *name;
{
int i;
struct option_state *options;
@@ -774,7 +774,7 @@ int option_state_dereference (ptr, name)
int executable_statement_allocate (ptr, name)
struct executable_statement **ptr;
- char *name;
+ const char *name;
{
struct executable_statement *bp;
@@ -789,7 +789,7 @@ int executable_statement_allocate (ptr, name)
int executable_statement_reference (ptr, bp, name)
struct executable_statement **ptr;
struct executable_statement *bp;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null ptr in executable_statement_reference: %s",
@@ -818,7 +818,7 @@ static struct packet *free_packets;
int packet_allocate (ptr, name)
struct packet **ptr;
- char *name;
+ const char *name;
{
int size;
@@ -854,7 +854,7 @@ int packet_allocate (ptr, name)
int packet_reference (ptr, bp, name)
struct packet **ptr;
struct packet *bp;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("Null pointer in packet_reference: %s",
@@ -881,7 +881,7 @@ int packet_reference (ptr, bp, name)
int packet_dereference (ptr, name)
struct packet **ptr;
- char *name;
+ const char *name;
{
int i;
struct packet *packet;
diff --git a/common/auth.c b/common/auth.c
index df08a00a..e181dee7 100644
--- a/common/auth.c
+++ b/common/auth.c
@@ -22,7 +22,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: auth.c,v 1.2 1999/03/16 05:50:31 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
+"$Id: auth.c,v 1.3 1999/10/07 06:35:40 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
#endif
#include "dhcpd.h"
@@ -41,10 +41,11 @@ void enter_auth_key (key_id, key)
(unsigned char *)key);
}
-struct auth_key *auth_key_lookup (key_id)
+const struct auth_key *auth_key_lookup (key_id)
struct data_string *key_id;
{
- return (struct auth_key *)hash_lookup (auth_key_hash,
- key_id -> data, key_id -> len);
+ return (const struct auth_key *)hash_lookup (auth_key_hash,
+ key_id -> data,
+ key_id -> len);
}
diff --git a/common/conflex.c b/common/conflex.c
index 52a0dc23..0a073116 100644
--- a/common/conflex.c
+++ b/common/conflex.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: conflex.c,v 1.58 1999/10/06 00:59:59 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: conflex.c,v 1.59 1999/10/07 06:35:40 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -40,8 +40,8 @@ isc_result_t new_parse (cfile, file, inbuf, buflen, name)
struct parse **cfile;
int file;
char *inbuf;
- int buflen;
- char *name;
+ unsigned buflen;
+ const char *name;
{
struct parse *tmp;
@@ -201,7 +201,7 @@ static enum dhcp_token get_token (cfile)
}
enum dhcp_token next_token (rval, cfile)
- char **rval;
+ const char **rval;
struct parse *cfile;
{
int rv;
@@ -226,7 +226,7 @@ enum dhcp_token next_token (rval, cfile)
}
enum dhcp_token peek_token (rval, cfile)
- char **rval;
+ const char **rval;
struct parse *cfile;
{
int x;
diff --git a/common/convert.c b/common/convert.c
index 805f047f..3bb71b71 100644
--- a/common/convert.c
+++ b/common/convert.c
@@ -23,13 +23,13 @@
#ifndef lint
static char copyright[] =
-"$Id: convert.c,v 1.10 1999/07/31 17:54:06 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: convert.c,v 1.11 1999/10/07 06:35:41 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
u_int32_t getULong (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
unsigned long ibuf;
@@ -38,7 +38,7 @@ u_int32_t getULong (buf)
}
int32_t getLong (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
long ibuf;
@@ -47,7 +47,7 @@ int32_t getLong (buf)
}
u_int32_t getUShort (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
unsigned short ibuf;
@@ -56,7 +56,7 @@ u_int32_t getUShort (buf)
}
int32_t getShort (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
short ibuf;
@@ -104,13 +104,13 @@ void putUChar (obuf, val)
}
u_int32_t getUChar (obuf)
- unsigned char *obuf;
+ const unsigned char *obuf;
{
return obuf [0];
}
int converted_length (buf, base, width)
- unsigned char *buf;
+ const unsigned char *buf;
unsigned int base;
unsigned int width;
{
@@ -144,7 +144,7 @@ int converted_length (buf, base, width)
int binary_to_ascii (outbuf, inbuf, base, width)
unsigned char *outbuf;
- unsigned char *inbuf;
+ const unsigned char *inbuf;
unsigned int base;
unsigned int width;
{
diff --git a/common/dhcp-eval.cat5 b/common/dhcp-eval.cat5
index 70ea29b4..ada5beb4 100644
--- a/common/dhcp-eval.cat5
+++ b/common/dhcp-eval.cat5
@@ -149,48 +149,48 @@ dhcpd-options(5) dhcpd-options(5)
The kknnoowwnn expression returns true if the client whose
request is currently being processed is known - that
is, if there's a host declaration for it.
+ ssttaattiicc
+
+ The ssttaattiicc expression returns true if the lease
+ assigned to the client whose request is currently being
+ processed is derived from a static address assignment.
DDAATTAA EEXXPPRREESSSSIIOONNSS
- Several of the boolean expressions above depend on the
- results of evaluating data expressions. A list of these
+ Several of the boolean expressions above depend on the
+ results of evaluating data expressions. A list of these
expressions is provided here.
ssuubbssttrriinngg ((_d_a_t_a_-_e_x_p_r,, _o_f_f_s_e_t,, _l_e_n_g_t_h))
- The ssuubbssttrriinngg operator evaluates the data expression
+ The ssuubbssttrriinngg operator evaluates the data expression
and returns the substring of the result of that evalua­
- tion that starts _o_f_f_s_e_t bytes from the beginning, con­
- tinuing for _l_e_n_g_t_h bytes. _O_f_f_s_e_t and _l_e_n_g_t_h are both
- numeric expressions. If _d_a_t_a_-_e_x_p_r, _o_f_f_s_e_t or _l_e_n_g_t_h
- evaluate to null, then the result is also null. If
- _o_f_f_s_e_t is greater than or equal to the length of the
- evaluated data, then a zero-length data string is
- returned. If _l_e_n_g_t_h _i_s _g_r_e_a_t_e_r _t_h_e_n _t_h_e _r_e_m_a_i_n_i_n_g
- _l_e_n_g_t_h _o_f _t_h_e _e_v_a_l_u_a_t_e_d _d_a_t_a _a_f_t_e_r _o_f_f_s_e_t, then a data
- string containing all data from _o_f_f_s_e_t to the end of
+ tion that starts _o_f_f_s_e_t bytes from the beginning, con­
+ tinuing for _l_e_n_g_t_h bytes. _O_f_f_s_e_t and _l_e_n_g_t_h are both
+ numeric expressions. If _d_a_t_a_-_e_x_p_r, _o_f_f_s_e_t or _l_e_n_g_t_h
+ evaluate to null, then the result is also null. If
+ _o_f_f_s_e_t is greater than or equal to the length of the
+ evaluated data, then a zero-length data string is
+ returned. If _l_e_n_g_t_h _i_s _g_r_e_a_t_e_r _t_h_e_n _t_h_e _r_e_m_a_i_n_i_n_g
+ _l_e_n_g_t_h _o_f _t_h_e _e_v_a_l_u_a_t_e_d _d_a_t_a _a_f_t_e_r _o_f_f_s_e_t, then a data
+ string containing all data from _o_f_f_s_e_t to the end of
the evaluated data is returned.
ssuuffffiixx ((_d_a_t_a_-_e_x_p_r,, _l_e_n_g_t_h))
The ssuuffffiixx operator evaluates _d_a_t_a_-_e_x_p_r and returns the
- last _l_e_n_g_t_h bytes of the result of that evaluation.
+ last _l_e_n_g_t_h bytes of the result of that evaluation.
_L_e_n_g_t_h is a numeric expression. If _d_a_t_a_-_e_x_p_r or _l_e_n_g_t_h
- evaluate to null, then the result is also null. If
+ evaluate to null, then the result is also null. If
_s_u_f_f_i_x evaluates to a number greater than the length of
- the evaluated data, then the evaluated data is
+ the evaluated data, then the evaluated data is
returned.
ooppttiioonn _o_p_t_i_o_n_-_n_a_m_e
- The ooppttiioonn operator returns the contents of the speci­
- fied option in the packet to which the server is
+ The ooppttiioonn operator returns the contents of the speci­
+ fied option in the packet to which the server is
responding.
- hhaarrddwwaarree
-
- The hhaarrddwwaarree operator returns a data string whose first
- element is the _h_t_y_p_e field of the packet being
-
3
@@ -202,10 +202,19 @@ DDAATTAA EEXXPPRREESSSSIIOONNSS
dhcpd-options(5) dhcpd-options(5)
- considered, and whose subsequent elements are first
- _h_l_e_n bytes of the _c_h_a_d_d_r field of the packet, as speci­
- fied in RRFFCC 22113311 . If there is no packet, or if the
- _h_l_e_n field is invalid, then the result is null.
+ hhaarrddwwaarree
+
+ The hhaarrddwwaarree operator returns a data string whose first
+ element is the type of network interface indicated in
+ packet being considered, and whose subsequent elements
+ are client's link-layer address. If there is no
+ packet, or if the RFC2131 _h_l_e_n field is invalid, then
+ the result is null. Hardware types include ethernet
+ (1), token-ring (6), and fddi (8). Hardware types are
+ specified by the IETF, and details on how the type num­
+ bers are defined can be found in RFC2131 (in the ISC
+ DHCP distribution, this is included in the doc/ subdi­
+ rectory).
ppaacckkeett ((_o_f_f_s_e_t,, _l_e_n_g_t_h))
@@ -226,37 +235,28 @@ dhcpd-options(5) dhcpd-options(5)
A list of hexadecimal octet values, seperated by
colons, may be specified as a data expression.
- ccoonnccaatt ((_d_a_t_a_-_e_x_p_r_1,, _d_a_t_a_-_e_x_p_r_2))
- The two expressions are evaluated, and the result of
- concatenating the results of the two evaluations is
- returned. If either subexpression evaluates to null,
- then the result is the value of the other expression.
- If both expressions evaluate to null, then the result
- is null.
-
+ ccoonnccaatt ((_d_a_t_a_-_e_x_p_r_1,, ......,, _d_a_t_a_-_e_x_p_r_N))
+ The expressions are evaluated, and the results of each
+ evaluation are concatenated in the sequence that the
+ subexpressions are listed. If any subexpression eval­
+ uates to null, the result of the concatenation is null.
rreevveerrssee ((_n_u_m_e_r_i_c_-_e_x_p_r_1,, _d_a_t_a_-_e_x_p_r_2))
- The two expressions are evaluated, and then the result
+ The two expressions are evaluated, and then the result
of evaluating the data expression is reversed in place,
- using hunks of the size specified in the numeric
- expression. For example, if the numeric expression
+ using hunks of the size specified in the numeric
+ expression. For example, if the numeric expression
evaluates to four, and the data expression evaluates to
- twelve bytes of data, then the reverse expression will
- evaluate to twelve bytes of data, consisting of the
- last four bytes of the the input data, followed by the
+ twelve bytes of data, then the reverse expression will
+ evaluate to twelve bytes of data, consisting of the
+ last four bytes of the the input data, followed by the
middle four bytes, followed by the first four bytes.
lleeaasseedd--aaddddrreessss
- In any context where the client whose request is being
- processed has been assigned an IP address, this data
+ In any context where the client whose request is being
+ processed has been assigned an IP address, this data
expression returns that IP address.
- bbiinnaarryy--ttoo--aasscciiii ((_n_u_m_e_r_i_c_-_e_x_p_r_1,, _n_u_m_e_r_i_c_-_e_x_p_r_2,, _d_a_t_a_-_e_x_p_r_1,,
- _d_a_t_a_-_e_x_p_r_2))
- Converts the result of evaluating data-expr2 into a
- text string containing one number for each element of
- the result of evaluating data-expr2. Each number is
-
4
@@ -268,15 +268,20 @@ dhcpd-options(5) dhcpd-options(5)
dhcpd-options(5) dhcpd-options(5)
- seperated from the other by the result of evaluating
- data-expr1. The result of evaluating numeric-expr1
- specifies the base (2 through 16) into which the num­
- bers should be converted. The result of evaluating
- numeric-expr2 specifies the width in bits of each num­
+ bbiinnaarryy--ttoo--aasscciiii ((_n_u_m_e_r_i_c_-_e_x_p_r_1,, _n_u_m_e_r_i_c_-_e_x_p_r_2,, _d_a_t_a_-_e_x_p_r_1,,
+ _d_a_t_a_-_e_x_p_r_2))
+ Converts the result of evaluating data-expr2 into a
+ text string containing one number for each element of
+ the result of evaluating data-expr2. Each number is
+ seperated from the other by the result of evaluating
+ data-expr1. The result of evaluating numeric-expr1
+ specifies the base (2 through 16) into which the num­
+ bers should be converted. The result of evaluating
+ numeric-expr2 specifies the width in bits of each num­
ber, which may be either 8, 16 or 32.
- As an example of the preceding three types of expres­
- sions, to produce the name of a PTR record for the IP
+ As an example of the preceding three types of expres­
+ sions, to produce the name of a PTR record for the IP
address being assigned to a client, one could write the
following expression:
@@ -286,11 +291,27 @@ dhcpd-options(5) dhcpd-options(5)
eennccooddee--iinntt ((_n_u_m_e_r_i_c_-_e_x_p_r,, _w_i_d_t_h))
- Numeric-expr is evaluated and encoded as a data string
- of the specified width, in network byte order (most
- significant byte first). If the numeric expression
+ Numeric-expr is evaluated and encoded as a data string
+ of the specified width, in network byte order (most
+ significant byte first). If the numeric expression
evaluates to the null value, the result is also null.
+ ppiicckk--ffiirrsstt--vvaalluuee ((_d_a_t_a_-_e_x_p_r_1 [ ... _e_x_p_rn ] ))
+ The pick-first-value function takes any number of
+ data expressions as its arguments. Each expression
+ is evaluated, starting with the first in the list,
+ until an expression is found that does not evaluate
+ to a null value. That expression is returned, and
+ none of the subsequent expressions are evaluated.
+ If all expressions evaluate to a null value, the null
+ value is returned.
+
+ hhoosstt--ddeeccll--nnaammee
+ The host-decl-name function returns the name of the
+ host declaration that matched the client whose
+ request is currently being processed, if any. If no
+ host declaration matched, the result is the null
+ value.
NNUUMMEERRIICC EEXXPPRREESSSSIIOONNSS
Numeric expressions are expressions that evaluate to an
@@ -301,27 +322,6 @@ NNUUMMEERRIICC EEXXPPRREESSSSIIOONNSS
eexxttrraacctt--iinntt ((_d_a_t_a_-_e_x_p_r,, _w_i_d_t_h))
- The eexxttrraacctt--iinntt operator extracts an integer value in
- network byte order from the result of evaluating the
- specified data expression. Width is the width in bits
- of the integer to extract. Currently, the only sup­
- ported widths are 8, 16 and 32. If the evaluation of
- the data expression doesn't provide sufficient bits to
- extract an integer of the specified size, the null
- value is returned.
-
- _n_u_m_b_e_r
-
- Any number between zero and the maximum representable
- size may be specified as a numeric expression.
-
-SSEEEE AALLSSOO
- dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcp-
- eval(5), dhcpd(8), dhclient(8), RFC2132, RFC2131.
-
-AAUUTTHHOORR
- The Internet Software Consortium DHCP Distribution was
- written by Ted Lemon <mellon@isc.org> under a contract
@@ -334,37 +334,103 @@ AAUUTTHHOORR
dhcpd-options(5) dhcpd-options(5)
- with Vixie Labs. Funding for this project was provided
- through the Internet Software Consortium. Information
- about the Internet Software Consortium can be found at
- hhttttpp::////wwwwww..iisscc..oorrgg//iisscc..
-
-
-
-
-
-
-
-
-
-
+ The eexxttrraacctt--iinntt operator extracts an integer value in
+ network byte order from the result of evaluating the
+ specified data expression. Width is the width in bits
+ of the integer to extract. Currently, the only sup­
+ ported widths are 8, 16 and 32. If the evaluation of
+ the data expression doesn't provide sufficient bits to
+ extract an integer of the specified size, the null
+ value is returned.
+ lleeaassee--ttiimmee
+ The duration of the current lease - that is, the dif­
+ ference between the current time and the time that the
+ lease expires.
+ _n_u_m_b_e_r
+ Any number between zero and the maximum representable
+ size may be specified as a numeric expression.
+RREEFFEERREENNCCEE:: DDYYNNAAMMIICC DDNNSS UUPPDDAATTEESS
+ The DHCP client and server have the ability to dynamically
+ update the Domain Name System. Within the configuration
+ files, you can define how you want the Domain Name System
+ to be updated. These updates are RFC 2136 compliant so
+ any DNS server supporting RFC 2136 should be able to
+ accept updates from the DHCP server.
+
+SSEECCUURRIITTYY
+ Support for TSIG and DNSSEC is not yet available. When
+ you set your DNS server up to allow updates from the DHCP
+ server or client, you may be exposing it to unauthorized
+ updates. To avoid this, the best you can do right now is
+ to use IP address-based packet filtering to prevent unau­
+ thorized hosts from submitting update requests. Obvi­
+ ously, there is currently no way to provide security for
+ client updates - this will require TSIG or DNSSEC, neither
+ of which is yet available in the DHCP distribution.
+
+ Dynamic DNS (DDNS) updates are performed by using the ddnnss--
+ uuppddaattee expression. The ddnnss--uuppddaattee expression is a boolean
+ expression that takes four parameters. If the update suc­
+ ceeds, the result is true. If it fails, the result is
+ false. The four parameters that the are the resource
+ record type (RR), the left hand side of the RR, the right
+ hand side of the RR and the ttl that should be applied to
+ the record. The simplest example of the use of the func­
+ tion can be found in the reference section of the
+ dhcpd.conf file, where events are described. In this
+ example several statements are being used to make the
+ arguments to the ddnnss--uuppddaatteeRR..
+
+ In the example, the first argument to the first Bdns-
+ update expression is a data expression that evaluates to
+ 6
+dhcpd-options(5) dhcpd-options(5)
+ the A RR type. The second argument is constructed by con­
+ catenating the DHCP host-name option with a text string
+ containing the local domain, in this case "ssd.exam­
+ ple.net". The third argument is constructed by converting
+ the address the client has been assigned from a 32-bit
+ number into an ascii string with each byte separated by a
+ ".". The fourth argument, the TTL, specifies the amount
+ of time remaining in the lease (note that this isn't
+ really correct, since the DNS server will pass this TTL
+ out whenever a request comes in, even if that is only a
+ few seconds before the lease expires).
+
+ If the first ddnnss--uuppddaattee statement succeeds, it is followed
+ up with a second update to install a PTR RR. The instal­
+ lation of a PTR record is similar to installing an A RR
+ except that the left hand side of the record is the leased
+ address, reversed, with ".in-addr.arpa" concatenated. The
+ right hand side is the fully qualified domain name of the
+ client to which the address is being leased.
+SSEEEE AALLSSOO
+ dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcp-
+ eval(5), dhcpd(8), dhclient(8), RFC2132, RFC2131.
+AAUUTTHHOORR
+ The Internet Software Consortium DHCP Distribution was
+ written by Ted Lemon <mellon@isc.org> under a contract
+ with Vixie Labs. Funding for this project was provided
+ through the Internet Software Consortium. Information
+ about the Internet Software Consortium can be found at
+ hhttttpp::////wwwwww..iisscc..oorrgg//iisscc..
@@ -391,6 +457,6 @@ dhcpd-options(5) dhcpd-options(5)
- 6
+ 7
diff --git a/common/discover.c b/common/discover.c
index 38358004..c306e28e 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: discover.c,v 1.14 1999/09/15 19:47:27 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: discover.c,v 1.15 1999/10/07 06:35:41 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -33,7 +33,8 @@ extern int interfaces_invalidated;
int quiet_interface_discovery;
void (*bootp_packet_handler) PROTO ((struct interface_info *,
- struct dhcp_packet *, int, unsigned int,
+ struct dhcp_packet *, unsigned,
+ unsigned int,
struct iaddr, struct hardware *));
omapi_object_type_t *dhcp_type_interface;
@@ -196,10 +197,10 @@ void discover_interfaces (state)
which we found it. */
if (!tmp -> ifp) {
#ifdef HAVE_SA_LEN
- int len = ((sizeof ifp -> ifr_name) +
- ifp -> ifr_addr.sa_len);
+ unsigned len = ((sizeof ifp -> ifr_name) +
+ ifp -> ifr_addr.sa_len);
#else
- int len = sizeof *ifp;
+ unsigned len = sizeof *ifp;
#endif
tif = (struct ifreq *)malloc (len);
if (!tif)
@@ -576,7 +577,7 @@ isc_result_t got_one (h)
ifrom.len = 4;
memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
- (*bootp_packet_handler) (ip, &u.packet, result,
+ (*bootp_packet_handler) (ip, &u.packet, (unsigned)result,
from.sin_port, ifrom, &hfrom);
}
return ISC_R_SUCCESS;
@@ -623,7 +624,7 @@ isc_result_t interface_stuff_values (omapi_object_t *c,
return ISC_R_NOTFOUND;
}
-isc_result_t interface_destroy (omapi_object_t *h, char *name)
+isc_result_t interface_destroy (omapi_object_t *h, const char *name)
{
int i;
@@ -637,7 +638,7 @@ isc_result_t interface_destroy (omapi_object_t *h, char *name)
}
isc_result_t interface_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
if (h -> type != dhcp_type_interface)
return ISC_R_INVALIDARG;
diff --git a/common/dns.c b/common/dns.c
index 082a2f36..7b8df0a1 100644
--- a/common/dns.c
+++ b/common/dns.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dns.c,v 1.11 1999/03/16 05:50:34 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dns.c,v 1.12 1999/10/07 06:35:41 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -31,7 +31,7 @@ static char copyright[] =
int dns_protocol_initialized;
int dns_protocol_fd;
-static int addlabel PROTO ((u_int8_t *, char *));
+static unsigned addlabel PROTO ((u_int8_t *, const char *));
static int skipname PROTO ((u_int8_t *));
static int copy_out_name PROTO ((u_int8_t *, u_int8_t *, char *));
static int nslookup PROTO ((u_int8_t, char *, int, u_int16_t, u_int16_t));
@@ -77,13 +77,13 @@ void dns_startup ()
the label in the first character, the contents of the label in subsequent
characters, and returning the length of the conglomeration. */
-static int addlabel (buf, label)
+static unsigned addlabel (buf, label)
u_int8_t *buf;
- char *label;
+ const char *label;
{
*buf = strlen (label);
- memcpy (buf + 1, label, *buf);
- return *buf + 1;
+ memcpy (buf + 1, label, (unsigned)*buf);
+ return (unsigned)(*buf + 1);
}
/* skipname skips over all of the labels in a single domain name,
@@ -289,7 +289,7 @@ struct dns_query *ns_inaddr_lookup (inaddr, wakeup)
putUShort (s, C_IN);
s += sizeof (u_int16_t);
- return ns_query (question, query, s - query, wakeup);
+ return ns_query (question, query, (unsigned)(s - query), wakeup);
}
/* Try to satisfy a query out of the local cache. If no answer has
@@ -303,7 +303,7 @@ struct dns_query *ns_inaddr_lookup (inaddr, wakeup)
struct dns_query *ns_query (question, formatted_query, len, wakeup)
struct dns_question *question;
unsigned char *formatted_query;
- int len;
+ unsigned len;
struct dns_wakeup *wakeup;
{
HEADER *hdr;
diff --git a/common/errwarn.c b/common/errwarn.c
index 2c190b1b..dc165c16 100644
--- a/common/errwarn.c
+++ b/common/errwarn.c
@@ -29,25 +29,24 @@
#ifndef lint
static char copyright[] =
-"$Id: errwarn.c,v 1.19 1999/10/01 03:16:24 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: errwarn.c,v 1.20 1999/10/07 06:35:41 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
#include <errno.h>
-static void do_percentm PROTO ((char *obuf, char *ibuf));
+static void do_percentm PROTO ((char *obuf, const char *ibuf));
static char mbuf [1024];
static char fbuf [1024];
/* Log an error message, then exit... */
-void log_fatal (ANSI_DECL(char *) fmt, VA_DOTDOTDOT)
+void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
{
va_list list;
- extern int logged_in;
do_percentm (fbuf, fmt);
@@ -76,7 +75,7 @@ void log_fatal (ANSI_DECL(char *) fmt, VA_DOTDOTDOT)
/* Log an error message... */
-int log_error (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
+int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
{
@@ -102,7 +101,7 @@ int log_error (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
/* Log a note... */
-int log_info (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
+int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
{
@@ -128,7 +127,7 @@ int log_info (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
/* Log a debug message... */
-int log_debug (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
+int log_debug (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
{
@@ -156,12 +155,12 @@ int log_debug (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
static void do_percentm (obuf, ibuf)
char *obuf;
- char *ibuf;
+ const char *ibuf;
{
- char *s = ibuf;
+ const char *s = ibuf;
char *p = obuf;
int infmt = 0;
- char *m;
+ const char *m;
while (*s)
{
@@ -196,7 +195,7 @@ static void do_percentm (obuf, ibuf)
int parse_warn (ANSI_DECL (struct parse *)cfile,
- ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
+ ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (struct parse *cfile;)
KandR (char *fmt;)
va_dcl
@@ -204,7 +203,7 @@ int parse_warn (ANSI_DECL (struct parse *)cfile,
va_list list;
static char spaces [] = " ";
char lexbuf [256];
- int i, lix;
+ unsigned i, lix;
do_percentm (mbuf, fmt);
#ifndef NO_SNPRINTF
diff --git a/common/ethernet.c b/common/ethernet.c
index cfb73150..e7cbea2a 100644
--- a/common/ethernet.c
+++ b/common/ethernet.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: ethernet.c,v 1.1 1999/05/27 17:34:54 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: ethernet.c,v 1.2 1999/10/07 06:35:42 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -38,7 +38,7 @@ static char copyright[] =
void assemble_ethernet_header (interface, buf, bufix, to)
struct interface_info *interface;
unsigned char *buf;
- int *bufix;
+ unsigned *bufix;
struct hardware *to;
{
struct ether_header eh;
@@ -70,7 +70,7 @@ void assemble_ethernet_header (interface, buf, bufix, to)
ssize_t decode_ethernet_header (interface, buf, bufix, from)
struct interface_info *interface;
unsigned char *buf;
- int bufix;
+ unsigned bufix;
struct hardware *from;
{
struct ether_header eh;
diff --git a/common/execute.c b/common/execute.c
index 955deb18..60c9de2d 100644
--- a/common/execute.c
+++ b/common/execute.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: execute.c,v 1.20 1999/10/01 03:16:46 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: execute.c,v 1.21 1999/10/07 06:35:42 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -237,7 +237,7 @@ void execute_statements_in_scope (packet, lease, in_options, out_options,
int executable_statement_dereference (ptr, name)
struct executable_statement **ptr;
- char *name;
+ const char *name;
{
struct executable_statement *bp;
@@ -317,7 +317,7 @@ void write_statements (file, statements, indent)
struct executable_statement *r, *x;
int result;
int status;
- char *s, *t, *dot;
+ const char *s, *t, *dot;
int col;
if (!statements)
diff --git a/common/hash.c b/common/hash.c
index e8757fe9..91686914 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -22,12 +22,12 @@
#ifndef lint
static char copyright[] =
-"$Id: hash.c,v 1.14 1999/04/12 21:33:34 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: hash.c,v 1.15 1999/10/07 06:35:42 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
-static INLINE int do_hash PROTO ((unsigned char *, int, int));
+static INLINE int do_hash PROTO ((const unsigned char *, unsigned, unsigned));
struct hash_table *new_hash ()
{
@@ -40,12 +40,12 @@ struct hash_table *new_hash ()
}
static INLINE int do_hash (name, len, size)
- unsigned char *name;
- int len;
- int size;
+ const unsigned char *name;
+ unsigned len;
+ unsigned size;
{
register int accum = 0;
- register unsigned char *s = (unsigned char *)name;
+ register const unsigned char *s = (const unsigned char *)name;
int i = len;
while (i--) {
/* Add the character in... */
@@ -60,8 +60,8 @@ static INLINE int do_hash (name, len, size)
void add_hash (table, name, len, pointer)
struct hash_table *table;
- int len;
- unsigned char *name;
+ unsigned len;
+ const unsigned char *name;
unsigned char *pointer;
{
int hashno;
@@ -71,7 +71,7 @@ void add_hash (table, name, len, pointer)
return;
if (!len)
- len = strlen ((char *)name);
+ len = strlen ((const char *)name);
hashno = do_hash (name, len, table -> hash_count);
bp = new_hash_bucket ("add_hash");
@@ -89,8 +89,8 @@ void add_hash (table, name, len, pointer)
void delete_hash_entry (table, name, len)
struct hash_table *table;
- int len;
- unsigned char *name;
+ unsigned len;
+ const unsigned char *name;
{
int hashno;
struct hash_bucket *bp, *pbp = (struct hash_bucket *)0;
@@ -99,7 +99,7 @@ void delete_hash_entry (table, name, len)
return;
if (!len)
- len = strlen ((char *)name);
+ len = strlen ((const char *)name);
hashno = do_hash (name, len, table -> hash_count);
@@ -107,7 +107,7 @@ void delete_hash_entry (table, name, len)
if we find it, delete it. */
for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
if ((!bp -> len &&
- !strcmp ((char *)bp -> name, (char *)name)) ||
+ !strcmp ((const char *)bp -> name, (const char *)name)) ||
(bp -> len == len &&
!memcmp (bp -> name, name, len))) {
if (pbp) {
@@ -124,8 +124,8 @@ void delete_hash_entry (table, name, len)
unsigned char *hash_lookup (table, name, len)
struct hash_table *table;
- unsigned char *name;
- int len;
+ const unsigned char *name;
+ unsigned len;
{
int hashno;
struct hash_bucket *bp;
@@ -133,7 +133,7 @@ unsigned char *hash_lookup (table, name, len)
if (!table)
return (unsigned char *)0;
if (!len)
- len = strlen ((char *)name);
+ len = strlen ((const char *)name);
hashno = do_hash (name, len, table -> hash_count);
diff --git a/common/memory.c b/common/memory.c
index 26d990fc..ea1314c8 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -22,14 +22,14 @@
#ifndef lint
static char copyright[] =
-"$Id: memory.c,v 1.62 1999/09/28 22:54:17 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: memory.c,v 1.63 1999/10/07 06:35:42 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
struct group *clone_group (group, caller)
struct group *group;
- char *caller;
+ const char *caller;
{
struct group *g = new_group (caller);
if (!g)
diff --git a/common/nsupdate.c b/common/nsupdate.c
index 6f31c8e6..ef48ff5a 100644
--- a/common/nsupdate.c
+++ b/common/nsupdate.c
@@ -25,7 +25,7 @@
#ifndef lint
static char copyright[] =
-"$Id: nsupdate.c,v 1.10 1999/10/06 00:59:59 mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: nsupdate.c,v 1.11 1999/10/07 06:35:43 mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -294,7 +294,8 @@ int nsupdatePTR (revname, hostname, ttl, opcode)
switch (opcode) {
case ADD:
- if (!hostname) { /* can't have NULL ip_addr for an ADD */
+ /* can't have NULL ip_addr for an ADD */
+ if (!hostname) {
#if 0
res_freeupdrec (p);
#endif
@@ -310,7 +311,7 @@ int nsupdatePTR (revname, hostname, ttl, opcode)
break;
case DELETE:
- ttl = 0; /* delete updates ALWAYS have a 0 TTL */
+ ttl = 0; /* delete updates ALWAYS have a 0 TTL */
#if 0
/* PREQUISITE: delete only if the RR to be deleted is there */
p->r_opcode = YXRRSET;
@@ -424,7 +425,8 @@ return;
/* only update if there is no A record there already */
if (!lease -> ddns_fwd_name) {
int z;
- z=nsupdateA(hostname, piaddr(lease->ip_addr), ttl, ADD);
+ z = nsupdateA (hostname,
+ piaddr (lease -> ip_addr), ttl, ADD);
if (z < 1)
return;
@@ -447,9 +449,10 @@ return;
if (!lease -> ddns_rev_name) {
/* add a PTR RR */
if (nsupdatePTR(revname, hostname, ttl, ADD)) {
- /* remember in the lease struct for a release */
+ /* remember in the lease struct for release */
lease -> ddns_rev_name =
- dmalloc(strlen(revname) + 1, "nsupdate");
+ dmalloc (strlen (revname) + 1,
+ "nsupdate");
strcpy (lease -> ddns_rev_name, revname);
}
}
@@ -580,6 +583,7 @@ int updatePTR (lhs, rhs, ttl, lease)
return 1;
}
+
/* public function to delete an A record */
int deleteA (lhs, rhs, lease)
const struct data_string *lhs;
diff --git a/common/options.c b/common/options.c
index 3276ff8a..cd1ad8a2 100644
--- a/common/options.c
+++ b/common/options.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: options.c,v 1.45 1999/07/31 18:03:54 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: options.c,v 1.46 1999/10/07 06:35:43 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@@ -88,7 +88,7 @@ int parse_options (packet)
int parse_option_buffer (packet, buffer, length)
struct packet *packet;
unsigned char *buffer;
- int length;
+ unsigned length;
{
unsigned char *t;
unsigned char *end = buffer + length;
@@ -206,7 +206,7 @@ int parse_agent_information_option (packet, len, data)
ott = &t -> next;
/* Copy the option data in in its raw form. */
- memcpy (t -> data, op, op [1] + 2);
+ memcpy (t -> data, op, (unsigned)(op [1] + 2));
op += op [1] + 2;
}
@@ -250,10 +250,10 @@ int cons_options (inpacket, outpacket, lease, mms, in_options, cfg_options,
int priority_list [PRIORITY_COUNT];
int priority_len;
unsigned char buffer [4096]; /* Really big buffer... */
- int main_buffer_size;
- int mainbufix, bufix, agentix;
- int option_size;
- int length;
+ unsigned main_buffer_size;
+ unsigned mainbufix, bufix, agentix;
+ unsigned option_size;
+ unsigned length;
int i;
struct option_cache *op;
struct data_string ds;
@@ -458,7 +458,8 @@ int cons_options (inpacket, outpacket, lease, mms, in_options, cfg_options,
outpacket -> options [agentix++] = a -> length;
for (o = a -> first; o; o = o -> next) {
memcpy (&outpacket -> options [agentix],
- o -> data, o -> data [1] + 2);
+ o -> data,
+ (unsigned)(o -> data [1] + 2));
agentix += o -> data [1] + 2;
}
}
@@ -481,14 +482,14 @@ int store_options (buffer, buflen, packet, lease,
in_options, cfg_options, priority_list,
priority_len, first_cutoff, second_cutoff, terminate)
unsigned char *buffer;
- int buflen;
+ unsigned buflen;
struct packet *packet;
struct lease *lease;
struct option_state *in_options;
struct option_state *cfg_options;
- int *priority_list;
+ unsigned *priority_list;
int priority_len;
- int first_cutoff, second_cutoff;
+ unsigned first_cutoff, second_cutoff;
int terminate;
{
int bufix = 0;
@@ -521,7 +522,7 @@ int store_options (buffer, buflen, packet, lease,
priority list... */
for (i = 0; i < priority_len; i++) {
/* Code for next option to try to store. */
- int code = priority_list [i];
+ unsigned code = priority_list [i];
int optstart;
/* Number of bytes left to store (some may already
@@ -595,11 +596,11 @@ int store_options (buffer, buflen, packet, lease,
buffer [bufix + 1] = incr;
if (tto && incr == length) {
memcpy (buffer + bufix + 2,
- od.data + ix, incr - 1);
+ od.data + ix, (unsigned)(incr - 1));
buffer [bufix + 2 + incr - 1] = 0;
} else {
memcpy (buffer + bufix + 2,
- od.data + ix, incr);
+ od.data + ix, (unsigned)incr);
}
length -= incr;
ix += incr;
@@ -612,10 +613,10 @@ int store_options (buffer, buflen, packet, lease,
/* Format the specified option so that a human can easily read it. */
-char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
+const char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
unsigned int code;
- unsigned char *data;
- int len;
+ const unsigned char *data;
+ unsigned len;
int emit_commas;
int emit_quotes;
{
@@ -626,7 +627,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
char fmtbuf [32];
int i, j, k;
char *op = optbuf;
- unsigned char *dp = data;
+ const unsigned char *dp = data;
struct in_addr foo;
char comma;
@@ -734,8 +735,8 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
case 't':
if (emit_quotes)
*op++ = '"';
- strcpy (op, (char *)dp);
- op += strlen ((char *)dp);
+ strcpy (op, (const char *)dp);
+ op += strlen ((const char *)dp);
if (emit_quotes)
*op++ = '"';
*op = 0;
@@ -763,7 +764,7 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
dp += 2;
break;
case 'b':
- sprintf (op, "%d", *(char *)dp++);
+ sprintf (op, "%d", *(const char *)dp++);
break;
case 'B':
sprintf (op, "%d", *dp++);
@@ -799,7 +800,7 @@ int hashed_option_get (result, universe, packet, lease,
struct option_state *in_options;
struct option_state *cfg_options;
struct option_state *options;
- int code;
+ unsigned code;
{
struct option_cache *oc;
@@ -823,7 +824,7 @@ int agent_option_get (result, universe, packet, lease,
struct option_state *in_options;
struct option_state *cfg_options;
struct option_state *options;
- int code;
+ unsigned code;
{
struct agent_options *ao;
struct option_tag *t;
@@ -851,9 +852,9 @@ int agent_option_get (result, universe, packet, lease,
return 0;
}
result -> data = &result -> buffer -> data [0];
- memcpy (result -> data,
+ memcpy (result -> buffer -> data,
&t -> data [2], result -> len);
- result -> data [result -> len] = 0;
+ result -> buffer -> data [result -> len] = 0;
result -> terminated = 1;
return 1;
}
@@ -943,7 +944,7 @@ void hashed_option_set (universe, options, option, op)
struct option_cache *lookup_option (universe, options, code)
struct universe *universe;
struct option_state *options;
- int code;
+ unsigned code;
{
if (universe -> lookup_func)
return (*universe -> lookup_func) (universe, options, code);
@@ -956,7 +957,7 @@ struct option_cache *lookup_option (universe, options, code)
struct option_cache *lookup_hashed_option (universe, options, code)
struct universe *universe;
struct option_state *options;
- int code;
+ unsigned code;
{
int hashix;
pair bptr;
@@ -1100,7 +1101,7 @@ extern struct option_cache *free_option_caches; /* XXX */
int option_cache_dereference (ptr, name)
struct option_cache **ptr;
- char *name;
+ const char *name;
{
if (!ptr || !*ptr) {
log_error ("Null pointer in option_cache_dereference: %s",
@@ -1211,14 +1212,16 @@ int store_option (result, universe, packet, lease, in_options, cfg_options, oc)
}
d1.data = &d1.buffer -> data [0];
if (result -> len)
- memcpy (d1.data, result -> data, result -> len);
+ memcpy (d1.buffer -> data,
+ result -> data, result -> len);
d1.len = result -> len;
- (*universe -> store_tag) (&d1.data [d1.len],
+ (*universe -> store_tag) (&d1.buffer -> data [d1.len],
oc -> option -> code);
d1.len += universe -> tag_size;
- (*universe -> store_length) (&d1.data [d1.len], d2.len);
+ (*universe -> store_length) (&d1.buffer -> data [d1.len],
+ d2.len);
d1.len += universe -> length_size;
- memcpy (&d1.data [d1.len], d2.data, d2.len);
+ memcpy (&d1.buffer -> data [d1.len], d2.data, d2.len);
d1.len += d2.len;
data_string_forget (&d2, "store_option");
data_string_forget (result, "store_option");
@@ -1291,7 +1294,7 @@ int hashed_option_space_encapsulate (result, packet, lease,
void do_packet (interface, packet, len, from_port, from, hfrom)
struct interface_info *interface;
struct dhcp_packet *packet;
- int len;
+ unsigned len;
unsigned int from_port;
struct iaddr from;
struct hardware *hfrom;
diff --git a/common/packet.c b/common/packet.c
index bb228788..7a016118 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.28 1999/06/10 00:11:20 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.29 1999/10/07 06:35:43 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -37,17 +37,17 @@ static char copyright[] =
u_int32_t checksum (buf, nbytes, sum)
unsigned char *buf;
- int nbytes;
+ unsigned nbytes;
u_int32_t sum;
{
- int i;
+ unsigned i;
#ifdef DEBUG_CHECKSUM
log_debug ("checksum (%x %d %x)", buf, nbytes, sum);
#endif
/* Checksum all the pairs of bytes first... */
- for (i = 0; i < (nbytes & ~1); i += 2) {
+ for (i = 0; i < (nbytes & ~1U); i += 2) {
#ifdef DEBUG_CHECKSUM_VERBOSE
log_debug ("sum = %x", sum);
#endif
@@ -96,7 +96,7 @@ u_int32_t wrapsum (sum)
void assemble_hw_header (interface, buf, bufix, to)
struct interface_info *interface;
unsigned char *buf;
- int *bufix;
+ unsigned *bufix;
struct hardware *to;
{
#if defined (HAVE_TR_SUPPORT)
@@ -114,12 +114,12 @@ void assemble_udp_ip_header (interface, buf, bufix,
from, to, port, data, len)
struct interface_info *interface;
unsigned char *buf;
- int *bufix;
+ unsigned *bufix;
u_int32_t from;
u_int32_t to;
u_int32_t port;
unsigned char *data;
- int len;
+ unsigned len;
{
struct ip ip;
struct udphdr udp;
@@ -176,7 +176,7 @@ void assemble_udp_ip_header (interface, buf, bufix,
ssize_t decode_hw_header (interface, buf, bufix, from)
struct interface_info *interface;
unsigned char *buf;
- int bufix;
+ unsigned bufix;
struct hardware *from;
{
#if defined (HAVE_TR_SUPPORT)
@@ -192,10 +192,10 @@ ssize_t decode_hw_header (interface, buf, bufix, from)
ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
struct interface_info *interface;
unsigned char *buf;
- int bufix;
+ unsigned bufix;
struct sockaddr_in *from;
unsigned char *data;
- int buflen;
+ unsigned buflen;
{
struct ip *ip;
struct udphdr *udp;
@@ -207,7 +207,7 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
static int udp_packets_bad_checksum;
static int udp_packets_length_checked;
static int udp_packets_length_overflow;
- int len;
+ unsigned len;
ip = (struct ip *)(buf + bufix);
udp = (struct udphdr *)(buf + bufix + ip_len);
diff --git a/common/parse.c b/common/parse.c
index d99f36ea..c703a43f 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: parse.c,v 1.43 1999/10/06 01:00:00 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: parse.c,v 1.44 1999/10/07 06:35:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -52,7 +52,7 @@ void skip_to_rbrace (cfile, brace_count)
int brace_count;
{
enum dhcp_token token;
- char *val;
+ const char *val;
do {
token = peek_token (&val, cfile);
@@ -83,7 +83,7 @@ int parse_semi (cfile)
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
token = next_token (&val, cfile);
if (token != SEMI) {
@@ -99,7 +99,7 @@ int parse_semi (cfile)
char *parse_string (cfile)
struct parse *cfile;
{
- char *val;
+ const char *val;
enum dhcp_token token;
char *s;
@@ -128,9 +128,9 @@ char *parse_string (cfile)
char *parse_host_name (cfile)
struct parse *cfile;
{
- char *val;
+ const char *val;
enum dhcp_token token;
- int len = 0;
+ unsigned len = 0;
char *s;
char *t;
pair c = (pair)0;
@@ -163,7 +163,7 @@ char *parse_host_name (cfile)
*--t = 0;
while (c) {
pair cdr = c -> cdr;
- int l = strlen ((char *)(c -> car));
+ unsigned l = strlen ((char *)(c -> car));
t -= l;
memcpy (t, (char *)(c -> car), l);
/* Free up temp space. */
@@ -188,10 +188,10 @@ int parse_ip_addr_or_hostname (expr, cfile, uniform)
struct parse *cfile;
int uniform;
{
- char *val;
+ const char *val;
enum dhcp_token token;
unsigned char addr [4];
- int len = sizeof addr;
+ unsigned len = sizeof addr;
char *name;
struct expression *x = (struct expression *)0;
@@ -234,7 +234,7 @@ int parse_ip_addr (cfile, addr)
struct parse *cfile;
struct iaddr *addr;
{
- char *val;
+ const char *val;
enum dhcp_token token;
addr -> len = 4;
@@ -253,7 +253,7 @@ void parse_hardware_param (cfile, hardware)
struct parse *cfile;
struct hardware *hardware;
{
- char *val;
+ const char *val;
enum dhcp_token token;
int hlen;
unsigned char *t;
@@ -313,7 +313,7 @@ void parse_lease_time (cfile, timep)
struct parse *cfile;
TIME *timep;
{
- char *val;
+ const char *val;
enum dhcp_token token;
token = next_token (&val, cfile);
@@ -340,15 +340,15 @@ unsigned char *parse_numeric_aggregate (cfile, buf,
max, seperator, base, size)
struct parse *cfile;
unsigned char *buf;
- int *max;
+ unsigned *max;
int seperator;
int base;
- int size;
+ unsigned size;
{
- char *val;
+ const char *val;
enum dhcp_token token;
unsigned char *bufp = buf, *s, *t;
- int count = 0;
+ unsigned count = 0;
pair c = (pair)0;
if (!bufp && *max) {
@@ -425,11 +425,11 @@ unsigned char *parse_numeric_aggregate (cfile, buf,
void convert_num (cfile, buf, str, base, size)
struct parse *cfile;
unsigned char *buf;
- char *str;
+ const char *str;
int base;
- int size;
+ unsigned size;
{
- char *ptr = str;
+ const char *ptr = str;
int negative = 0;
u_int32_t val = 0;
int tval;
@@ -509,10 +509,10 @@ void convert_num (cfile, buf, str, base, size)
*buf = -(unsigned long)val;
break;
case 16:
- putShort (buf, -(unsigned long)val);
+ putShort (buf, -(long)val);
break;
case 32:
- putLong (buf, -(unsigned long)val);
+ putLong (buf, -(long)val);
break;
default:
parse_warn (cfile,
@@ -557,7 +557,7 @@ TIME parse_date (cfile)
struct tm tm;
int guess;
int tzoff, wday, year, mon, mday, hour, min, sec;
- char *val;
+ const char *val;
enum dhcp_token token;
static int months [11] = { 31, 59, 90, 120, 151, 181,
212, 243, 273, 304, 334 };
@@ -725,11 +725,12 @@ TIME parse_date (cfile)
IDENTIFIER . IDENTIFIER
*/
-struct option *parse_option_name (cfile, allocate)
+struct option *parse_option_name (cfile, allocate, known)
struct parse *cfile;
int allocate;
+ int *known;
{
- char *val;
+ const char *val;
enum dhcp_token token;
char *uname;
struct universe *universe;
@@ -782,10 +783,12 @@ struct option *parse_option_name (cfile, allocate)
/* Look up the actual option info... */
option = (struct option *)hash_lookup (universe -> hash,
- (unsigned char *)val, 0);
+ (const unsigned char *)val, 0);
/* If we didn't get an option structure, it's an undefined option. */
- if (!option) {
+ if (option) {
+ *known = 1;
+ } else {
/* If we've been told to allocate, that means that this
(might) be an option code definition, so we'll create
an option structure just in case. */
@@ -794,16 +797,18 @@ struct option *parse_option_name (cfile, allocate)
if (val == uname)
option -> name = val;
else {
+ char *s;
free (uname);
- option -> name = dmalloc (strlen (val) + 1,
- "parse_option_name");
- if (!option -> name)
+ s = dmalloc (strlen (val) + 1,
+ "parse_option_name");
+ if (!s)
log_fatal ("no memory for option %s.%s",
universe -> name, val);
- strcpy (option -> name, val);
+ strcpy (s, val);
+ option -> name = s;
}
option -> universe = universe;
- option -> code = -1;
+ option -> code = 0;
return option;
}
if (val == uname)
@@ -826,8 +831,9 @@ void parse_option_space_decl (cfile)
struct parse *cfile;
{
int token;
- char *val;
+ const char *val;
struct universe **ua, *nu;
+ char *s;
next_token (&val, cfile); /* Discard the SPACE token, which was
checked by the caller. */
@@ -842,10 +848,11 @@ void parse_option_space_decl (cfile)
log_fatal ("No memory for new option space.");
/* Set up the server option universe... */
- nu -> name = dmalloc (strlen (val) + 1, "parse_option_space_decl");
- if (!nu -> name)
+ s = dmalloc (strlen (val) + 1, "parse_option_space_decl");
+ if (!s)
log_fatal ("No memory for new option space name.");
- strcpy (nu -> name, val);
+ strcpy (s, val);
+ nu -> name = s;
nu -> lookup_func = lookup_hashed_option;
nu -> option_state_dereference =
hashed_option_state_dereference;
@@ -874,7 +881,7 @@ void parse_option_space_decl (cfile)
if (!nu -> hash)
log_fatal ("Can't allocate %s option hash table.", nu -> name);
add_hash (&universe_hash,
- (unsigned char *)nu -> name, 0, (unsigned char *)nu);
+ (const unsigned char *)nu -> name, 0, (unsigned char *)nu);
parse_semi (cfile);
}
@@ -907,16 +914,17 @@ int parse_option_code_definition (cfile, option)
struct parse *cfile;
struct option *option;
{
- char *val;
+ const char *val;
enum dhcp_token token;
- int arrayp = 0;
+ unsigned arrayp = 0;
int recordp = 0;
int no_more_in_record = 0;
char tokbuf [128];
- int tokix = 0;
+ unsigned tokix = 0;
char type;
int code;
int is_signed;
+ char *s;
/* Parse the option code. */
token = next_token (&val, cfile);
@@ -1071,21 +1079,22 @@ int parse_option_code_definition (cfile, option)
skip_to_semi (cfile);
return 0;
}
- option -> format = dmalloc (tokix + arrayp + 1,
- "parse_option_code_definition");
- if (!option -> format)
+ s = dmalloc (tokix + arrayp + 1, "parse_option_code_definition");
+ if (!s)
log_fatal ("no memory for option format.");
- memcpy (option -> format, tokbuf, tokix);
+ memcpy (s, tokbuf, tokix);
if (arrayp)
- option -> format [tokix++] = 'A';
- option -> format [tokix] = 0;
+ s [tokix++] = 'A';
+ s [tokix] = 0;
+ option -> format = s;
if (option -> universe -> options [option -> code]) {
/* XXX Free the option, but we can't do that now because they
XXX may start out static. */
}
option -> universe -> options [option -> code] = option;
add_hash (option -> universe -> hash,
- (unsigned char *)option -> name, 0, (unsigned char *)option);
+ (const unsigned char *)option -> name,
+ 0, (unsigned char *)option);
return 1;
}
@@ -1099,12 +1108,12 @@ int parse_cshl (data, cfile)
struct parse *cfile;
{
u_int8_t ibuf [128];
- int ilen = 0;
- int tlen = 0;
+ unsigned ilen = 0;
+ unsigned tlen = 0;
struct option_tag *sl = (struct option_tag *)0;
struct option_tag *next, **last = &sl;
enum dhcp_token token;
- char *val;
+ const char *val;
unsigned char *rvp;
do {
@@ -1145,7 +1154,7 @@ int parse_cshl (data, cfile)
data -> len = tlen + ilen;
data -> terminated = 0;
- rvp = &data -> data [0];
+ rvp = &data -> buffer -> data [0];
while (sl) {
next = sl -> next;
memcpy (rvp, sl -> data, sizeof ibuf);
@@ -1193,11 +1202,12 @@ int parse_executable_statement (result, cfile, lose)
int *lose;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct executable_statement base;
struct class *cta;
struct option *option;
struct option_cache *cache;
+ int known;
token = peek_token (&val, cfile);
switch (token) {
@@ -1253,7 +1263,8 @@ int parse_executable_statement (result, cfile, lose)
case SUPERSEDE:
case OPTION:
token = next_token (&val, cfile);
- option = parse_option_name (cfile, 0);
+ known = 0;
+ option = parse_option_name (cfile, 0, &known);
if (!option) {
*lose = 1;
return 0;
@@ -1277,7 +1288,8 @@ int parse_executable_statement (result, cfile, lose)
case DEFAULT:
token = next_token (&val, cfile);
- option = parse_option_name (cfile, 0);
+ known = 0;
+ option = parse_option_name (cfile, 0, &known);
if (!option) {
*lose = 1;
return 0;
@@ -1287,7 +1299,8 @@ int parse_executable_statement (result, cfile, lose)
case PREPEND:
token = next_token (&val, cfile);
- option = parse_option_name (cfile, 0);
+ known = 0;
+ option = parse_option_name (cfile, 0, &known);
if (!option) {
*lose = 1;
return 0;
@@ -1297,7 +1310,8 @@ int parse_executable_statement (result, cfile, lose)
case APPEND:
token = next_token (&val, cfile);
- option = parse_option_name (cfile, 0);
+ known = 0;
+ option = parse_option_name (cfile, 0, &known);
if (!option) {
*lose = 1;
return 0;
@@ -1330,7 +1344,7 @@ int parse_on_statement (result, cfile, lose)
int *lose;
{
enum dhcp_token token;
- char *val;
+ const char *val;
if (!executable_statement_allocate (result,
"parse_executable_statement"))
@@ -1409,7 +1423,7 @@ int parse_if_statement (result, cfile, lose)
int *lose;
{
enum dhcp_token token;
- char *val;
+ const char *val;
if (!executable_statement_allocate (result, "parse_if_statement"))
log_fatal ("no memory for if statement.");
@@ -1606,10 +1620,11 @@ int parse_non_binary (expr, cfile, lose, context)
enum expression_context context;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct collection *col;
struct option *option;
struct expression *nexp;
+ int known;
token = peek_token (&val, cfile);
@@ -1660,7 +1675,8 @@ int parse_non_binary (expr, cfile, lose, context)
if (!expression_allocate (expr, "parse_expression: EXISTS"))
log_fatal ("can't allocate expression");
(*expr) -> op = expr_exists;
- (*expr) -> data.option = parse_option_name (cfile, 0);
+ known = 0;
+ (*expr) -> data.option = parse_option_name (cfile, 0, &known);
if (!(*expr) -> data.option) {
*lose = 1;
expression_dereference (expr,
@@ -2043,7 +2059,8 @@ int parse_non_binary (expr, cfile, lose, context)
? expr_option
: expr_config_option);
token = next_token (&val, cfile);
- (*expr) -> data.option = parse_option_name (cfile, 0);
+ known = 0;
+ (*expr) -> data.option = parse_option_name (cfile, 0, &known);
if (!(*expr) -> data.option) {
*lose = 1;
expression_dereference (expr,
@@ -2132,7 +2149,7 @@ int parse_non_binary (expr, cfile, lose, context)
case STRING:
token = next_token (&val, cfile);
- if (!make_const_data (expr, (unsigned char *)val,
+ if (!make_const_data (expr, (const unsigned char *)val,
strlen (val), 1, 1))
log_fatal ("can't make constant string expression.");
break;
@@ -2315,7 +2332,7 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
enum expr_op binop;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct expression *rhs = (struct expression *)0, *tmp;
struct expression *lhs;
enum expr_op next_op;
@@ -2462,9 +2479,9 @@ int parse_option_statement (result, cfile, lookups, option, op)
struct option *option;
enum statement_op op;
{
- char *val;
+ const char *val;
enum dhcp_token token;
- char *fmt;
+ const char *fmt;
struct expression *expr = (struct expression *)0;
struct expression *tmp;
int lose;
@@ -2547,12 +2564,12 @@ int parse_option_statement (result, cfile, lookups, option, op)
int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
struct expression **rv;
struct parse *cfile;
- char *fmt;
+ const char *fmt;
struct expression *expr;
int uniform;
int lookups;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct expression *t = (struct expression *)0;
unsigned char buf [4];
@@ -2568,7 +2585,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
skip_to_semi (cfile);
return 0;
}
- if (!make_const_data (&t, (unsigned char *)val,
+ if (!make_const_data (&t, (const unsigned char *)val,
strlen (val), 1, 1))
log_fatal ("No memory for %s", val);
break;
@@ -2583,7 +2600,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
t -> op = expr_const_data;
} else if (token == STRING) {
token = next_token (&val, cfile);
- if (!make_const_data (&t, (unsigned char *)val,
+ if (!make_const_data (&t, (const unsigned char *)val,
strlen (val), 1, 1))
log_fatal ("No memory for \"%s\"", val);
} else {
@@ -2602,7 +2619,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
skip_to_semi (cfile);
return 0;
}
- if (!make_const_data (&t, (unsigned char *)val,
+ if (!make_const_data (&t, (const unsigned char *)val,
strlen (val), 1, 1))
log_fatal ("No memory for concatenation");
break;
@@ -2703,7 +2720,7 @@ int parse_allow_deny (oc, cfile, flag)
int flag;
{
enum dhcp_token token;
- char *val;
+ const char *val;
unsigned char rf = flag;
struct expression *data = (struct expression *)0;
int status;
@@ -2748,9 +2765,10 @@ int parse_auth_key (key_id, cfile)
struct parse *cfile;
{
struct data_string key_data;
- char *val;
+ const char *val;
enum dhcp_token token;
- struct auth_key *key, *old_key = (struct auth_key *)0;
+ const struct auth_key *key, *old_key = (struct auth_key *)0;
+ struct auth_key *new_key;
memset (&key_data, 0, sizeof key_data);
@@ -2777,15 +2795,15 @@ int parse_auth_key (key_id, cfile)
key_id -> len));
old_key = key;
}
- key = new_auth_key (key_data.len, "parse_auth_key");
- if (!key)
+ new_key = new_auth_key (key_data.len, "parse_auth_key");
+ if (!new_key)
log_fatal ("No memory for key %s",
print_hex_1 (key_id -> len,
key_id -> data,
key_id -> len));
- key -> length = key_data.len;
- memcpy (key -> data, key_data.data, key_data.len);
- enter_auth_key (key_id, key);
+ new_key -> length = key_data.len;
+ memcpy (new_key -> data, key_data.data, key_data.len);
+ enter_auth_key (key_id, new_key);
data_string_forget (&key_data, "parse_auth_key");
}
diff --git a/common/print.c b/common/print.c
index 31982437..6b33b2bb 100644
--- a/common/print.c
+++ b/common/print.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: print.c,v 1.26 1999/10/01 03:18:33 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: print.c,v 1.27 1999/10/07 06:35:44 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -120,8 +120,8 @@ void dump_packet (tp)
#endif
void dump_raw (buf, len)
- unsigned char *buf;
- int len;
+ const unsigned char *buf;
+ unsigned len;
{
int i;
char lbuf [80];
@@ -160,7 +160,7 @@ void hash_dump (table)
if (bp -> len)
dump_raw (bp -> name, bp -> len);
else
- log_info ((char *)bp -> name);
+ log_info ((const char *)bp -> name);
}
}
}
@@ -169,12 +169,13 @@ void hash_dump (table)
#define DECLARE_HEX_PRINTER(x) \
char *print_hex##x (len, data, limit) \
- int len; \
- u_int8_t *data; \
+ unsigned len; \
+ const u_int8_t *data; \
+ unsigned limit; \
{ \
\
static char hex_buf##x [HBLEN + 1]; \
- int i; \
+ unsigned i; \
\
if (limit > HBLEN) \
limit = HBLEN; \
@@ -206,8 +207,8 @@ DECLARE_HEX_PRINTER (_3)
#define DQLEN 80
char *print_dotted_quads (len, data)
- int len;
- u_int8_t *data;
+ unsigned len;
+ const u_int8_t *data;
{
static char dq_buf [DQLEN + 1];
int i;
@@ -233,30 +234,31 @@ char *print_dotted_quads (len, data)
}
char *print_dec_1 (val)
- int val;
+ unsigned long val;
{
static char vbuf [32];
- sprintf (vbuf, "%d", val);
+ sprintf (vbuf, "%lu", val);
return vbuf;
}
char *print_dec_2 (val)
- int val;
+ unsigned long val;
{
static char vbuf [32];
- sprintf (vbuf, "%d", val);
+ sprintf (vbuf, "%lu", val);
return vbuf;
}
-static int print_subexpression PROTO ((struct expression *, char *, int));
+static unsigned print_subexpression PROTO ((struct expression *,
+ char *, unsigned));
-static int print_subexpression (expr, buf, len)
+static unsigned print_subexpression (expr, buf, len)
struct expression *expr;
char *buf;
- int len;
+ unsigned len;
{
- int rv;
- char *s;
+ unsigned rv;
+ const char *s;
switch (expr -> op) {
case expr_none:
@@ -319,13 +321,15 @@ static int print_subexpression (expr, buf, len)
case expr_suffix:
if (len > 10) {
rv = 8;
- strcpy (buf, "(substr ");
+ strcpy (buf, "(suffix ");
rv += print_subexpression (expr -> data.suffix.expr,
buf + rv, len - rv - 2);
- buf [rv++] = ' ';
+ if (len > rv)
+ buf [rv++] = ' ';
rv += print_subexpression (expr -> data.suffix.len,
buf + rv, len - rv - 1);
- buf [rv++] = ')';
+ if (len > rv)
+ buf [rv++] = ')';
buf [rv] = 0;
return rv;
}
@@ -346,6 +350,23 @@ static int print_subexpression (expr, buf, len)
}
break;
+ case expr_pick_first_value:
+ if (len > 11) {
+ rv = 9;
+ strcpy (buf, "(pick1st ");
+ rv += print_subexpression
+ (expr -> data.pick_first_value.car,
+ buf + rv, len - rv - 2);
+ buf [rv++] = ' ';
+ rv += print_subexpression
+ (expr -> data.pick_first_value.cdr,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
case expr_host_lookup:
rv = 15 + strlen (expr -> data.host_lookup -> hostname);
if (len > rv) {
@@ -397,8 +418,14 @@ static int print_subexpression (expr, buf, len)
}
break;
+ case expr_config_option:
+ s = "cfg-option";
+ break;
+
case expr_option:
- rv = 10 + (strlen (expr -> data.option -> name) +
+ s = "option";
+ dooption:
+ rv = strlen (s) + 2 + (strlen (expr -> data.option -> name) +
strlen (expr -> data.option -> universe -> name));
if (len > rv) {
sprintf (buf, "(option %s.%s)",
@@ -446,7 +473,8 @@ static int print_subexpression (expr, buf, len)
rv += expr -> data.encapsulate.len;
if (rv + 2 > len)
rv = len - 2;
- strncpy (buf, (char *)expr -> data.encapsulate.data, rv - 13);
+ strncpy (buf,
+ (const char *)expr -> data.encapsulate.data, rv - 13);
buf [rv++] = ')';
buf [rv++] = 0;
break;
@@ -487,6 +515,42 @@ static int print_subexpression (expr, buf, len)
}
break;
+ case expr_encode_int8:
+ if (len > 7) {
+ rv = 6;
+ strcpy (buf, "(to-int8 ");
+ rv += print_subexpression (expr -> data.encode_int,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
+ case expr_encode_int16:
+ if (len > 8) {
+ rv = 7;
+ strcpy (buf, "(to-int16 ");
+ rv += print_subexpression (expr -> data.encode_int,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
+ case expr_encode_int32:
+ if (len > 8) {
+ rv = 7;
+ strcpy (buf, "(to-int32 ");
+ rv += print_subexpression (expr -> data.encode_int,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
case expr_const_int:
s = print_dec_1 (expr -> data.const_int);
rv = strlen (s);
@@ -506,6 +570,111 @@ static int print_subexpression (expr, buf, len)
return rv;
}
break;
+
+ case expr_known:
+ s = "known";
+ astring:
+ rv = strlen (s);
+ if (len > rv) {
+ strcpy (buf, s);
+ return rv;
+ }
+ break;
+
+ case expr_leased_address:
+ s = "leased-address";
+ goto astring;
+
+ case expr_host_decl_name:
+ s = "host-decl-name";
+ goto astring;
+
+ case expr_lease_time:
+ s = "lease-time";
+ goto astring;
+
+ case expr_static:
+ s = "static";
+ goto astring;
+
+ case expr_reverse:
+ if (len > 11) {
+ rv = 13;
+ strcpy (buf, "(reverse ");
+ rv += print_subexpression (expr -> data.reverse.width,
+ buf + rv, len - rv - 2);
+ buf [rv++] = ' ';
+ rv += print_subexpression (expr -> data.reverse.buffer,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
+ case expr_binary_to_ascii:
+ if (len > 5) {
+ rv = 9;
+ strcpy (buf, "(b2a ");
+ rv += print_subexpression (expr -> data.b2a.base,
+ buf + rv, len - rv - 4);
+ buf [rv++] = ' ';
+ rv += print_subexpression (expr -> data.b2a.width,
+ buf + rv, len - rv - 3);
+ buf [rv++] = ' ';
+ rv += print_subexpression (expr -> data.b2a.seperator,
+ buf + rv, len - rv - 2);
+ buf [rv++] = ' ';
+ rv += print_subexpression (expr -> data.b2a.buffer,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
+ case expr_dns_delete:
+ s = "dns-delete";
+ case expr_dns_update:
+ s = "dns-update";
+ dodnsupd:
+ if (len > 12) {
+ rv = 16;
+ buf [0] = '(';
+ strcpy (buf, s);
+ buf [13] = ' ';
+ rv += print_subexpression
+ (expr -> data.dns_update.type,
+ buf + rv, len - rv - 4);
+ buf [rv++] = ' ';
+ rv += print_subexpression
+ (expr -> data.dns_update.expr1,
+ buf + rv, len - rv - 3);
+ buf [rv++] = ' ';
+ rv += print_subexpression
+ (expr -> data.dns_update.expr2,
+ buf + rv, len - rv - 2);
+ buf [rv++] = ' ';
+ rv += print_subexpression
+ (expr -> data.dns_update.ttl,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
+
+ case expr_updated_dns_rr:
+ if (len > 12) {
+ rv = 13;
+ strcpy (buf, "(updated-rr ");
+ rv += print_subexpression (expr -> data.updated_dns_rr,
+ buf + rv, len - rv - 1);
+ buf [rv++] = ')';
+ buf [rv] = 0;
+ return rv;
+ }
+ break;
}
return 0;
}
@@ -520,12 +689,13 @@ void print_expression (name, expr)
log_info ("%s: %s", name, buf);
}
-int token_print_indent_concat (FILE *file, int col, int indent, char *prefix,
- char *suffix, ...)
+int token_print_indent_concat (FILE *file, int col, int indent,
+ const char *prefix,
+ const char *suffix, ...)
{
va_list list;
char *buf;
- int len;
+ unsigned len;
char *s, *t, *u;
va_start (list, suffix);
@@ -558,7 +728,7 @@ int token_print_indent_concat (FILE *file, int col, int indent, char *prefix,
}
int token_indent_data_string (FILE *file, int col, int indent,
- char *prefix, char *suffix,
+ const char *prefix, const char *suffix,
struct data_string *data)
{
int i;
@@ -601,7 +771,8 @@ int token_indent_data_string (FILE *file, int col, int indent,
}
int token_print_indent (FILE *file, int col, int indent,
- char *prefix, char *suffix, char *buf)
+ const char *prefix,
+ const char *suffix, const char *buf)
{
int len = strlen (buf) + strlen (prefix);
if (col + len > 79 && indent + len < 79) {
diff --git a/common/resolv.c b/common/resolv.c
index 2ee64c83..5209d26a 100644
--- a/common/resolv.c
+++ b/common/resolv.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: resolv.c,v 1.9 1999/10/01 03:42:12 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: resolv.c,v 1.10 1999/10/07 06:35:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -36,7 +36,7 @@ void read_resolv_conf (parse_time)
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
int token;
int declaration = 0;
struct name_server *sp, *sl, *ns;
diff --git a/common/tables.c b/common/tables.c
index 1dce7318..700cb95a 100644
--- a/common/tables.c
+++ b/common/tables.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: tables.c,v 1.28 1999/07/01 19:00:13 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: tables.c,v 1.29 1999/10/07 06:35:45 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -305,7 +305,7 @@ struct option dhcp_options [256] = {
{ "option-end", "e", &dhcp_universe, 255 },
};
-char *hardware_types [] = {
+const char *hardware_types [] = {
"unknown-0",
"ethernet",
"unknown-2",
@@ -1121,7 +1121,7 @@ void initialize_universes()
for (i = 0; i < 256; i++) {
dhcp_universe.options [i] = &dhcp_options [i];
add_hash (dhcp_universe.hash,
- (unsigned char *)dhcp_options [i].name, 0,
+ (const unsigned char *)dhcp_options [i].name, 0,
(unsigned char *)&dhcp_options [i]);
}
@@ -1142,7 +1142,7 @@ void initialize_universes()
for (i = 0; i < 256; i++) {
agent_universe.options [i] = &agent_options [i];
add_hash (agent_universe.hash,
- (unsigned char *)agent_options [i].name, 0,
+ (const unsigned char *)agent_options [i].name, 0,
(unsigned char *)&agent_options [i]);
}
@@ -1168,16 +1168,19 @@ void initialize_universes()
for (i = 0; i < 256; i++) {
server_universe.options [i] = &server_options [i];
add_hash (server_universe.hash,
- (unsigned char *)server_options [i].name, 0,
+ (const unsigned char *)server_options [i].name, 0,
(unsigned char *)&server_options [i]);
}
/* Set up the hash of universes. */
universe_hash.hash_count = DEFAULT_HASH_SIZE;
- add_hash (&universe_hash, (unsigned char *)dhcp_universe.name, 0,
+ add_hash (&universe_hash,
+ (const unsigned char *)dhcp_universe.name, 0,
(unsigned char *)&dhcp_universe);
- add_hash (&universe_hash, (unsigned char *)agent_universe.name, 0,
+ add_hash (&universe_hash,
+ (const unsigned char *)agent_universe.name, 0,
(unsigned char *)&agent_universe);
- add_hash (&universe_hash, (unsigned char *)server_universe.name, 0,
+ add_hash (&universe_hash,
+ (const unsigned char *)server_universe.name, 0,
(unsigned char *)&server_universe);
}
diff --git a/common/tr.c b/common/tr.c
index 28be924e..91037165 100644
--- a/common/tr.c
+++ b/common/tr.c
@@ -62,7 +62,7 @@ static struct timeval routing_timer;
void assemble_tr_header (interface, buf, bufix, to)
struct interface_info *interface;
unsigned char *buf;
- int *bufix;
+ unsigned *bufix;
struct hardware *to;
{
struct trh_hdr *trh;
@@ -115,7 +115,7 @@ static unsigned char tr_broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
ssize_t decode_tr_header (interface, buf, bufix, from)
struct interface_info *interface;
unsigned char *buf;
- int bufix;
+ unsigned bufix;
struct hardware *from;
{
struct trh_hdr *trh = (struct trh_hdr *) buf + bufix;
diff --git a/common/tree.c b/common/tree.c
index 8ea29ad8..5b5cec6e 100644
--- a/common/tree.c
+++ b/common/tree.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: tree.c,v 1.58 1999/10/07 02:14:06 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: tree.c,v 1.59 1999/10/07 06:35:45 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -46,9 +46,9 @@ int make_const_option_cache (oc, buffer, data, len, option, name)
struct option_cache **oc;
struct buffer **buffer;
u_int8_t *data;
- int len;
+ unsigned len;
struct option *option;
- char *name;
+ const char *name;
{
struct buffer *bp;
@@ -73,14 +73,14 @@ int make_const_option_cache (oc, buffer, data, len, option, name)
(*oc) -> data.data = &bp -> data [0];
(*oc) -> data.terminated = 0;
if (data)
- memcpy ((*oc) -> data.data, data, len);
+ memcpy (&bp -> data [0], data, len);
(*oc) -> option = option;
return 1;
}
int make_host_lookup (expr, name)
struct expression **expr;
- char *name;
+ const char *name;
{
if (!expression_allocate (expr, "make_host_lookup")) {
log_error ("No memory for host lookup tree node.");
@@ -96,7 +96,7 @@ int make_host_lookup (expr, name)
int enter_dns_host (dh, name)
struct dns_host_entry **dh;
- char *name;
+ const char *name;
{
/* XXX This should really keep a hash table of hostnames
XXX and just add a new reference to a hostname that
@@ -111,8 +111,8 @@ int enter_dns_host (dh, name)
int make_const_data (expr, data, len, terminated, allocate)
struct expression **expr;
- unsigned char *data;
- int len;
+ const unsigned char *data;
+ unsigned len;
int terminated;
int allocate;
{
@@ -136,7 +136,7 @@ int make_const_data (expr, data, len, terminated, allocate)
}
nt -> data.const_data.data =
&nt -> data.const_data.buffer -> data [0];
- memcpy (nt -> data.const_data.data,
+ memcpy (nt -> data.const_data.buffer -> data,
data, len + terminated);
} else
nt -> data.const_data.data = data;
@@ -277,8 +277,8 @@ static int do_host_lookup (result, dns)
struct dns_host_entry *dns;
{
struct hostent *h;
- int i, count;
- int new_len;
+ unsigned i, count;
+ unsigned new_len;
#ifdef DEBUG_EVAL
log_debug ("time: now = %d dns = %d %d diff = %d",
@@ -357,12 +357,12 @@ static int do_host_lookup (result, dns)
/* Addresses are conveniently stored one to the buffer, so we
have to copy them out one at a time... :'( */
for (i = 0; i < count; i++) {
- memcpy (&dns -> data.data [h -> h_length * i],
- h -> h_addr_list [i], h -> h_length);
+ memcpy (&dns -> data.buffer -> data [h -> h_length * i],
+ h -> h_addr_list [i], (unsigned)(h -> h_length));
}
#ifdef DEBUG_EVAL
log_debug ("dns -> data: %x h -> h_addr_list [0]: %x",
- *(int *)(dns -> buffer), h -> h_addr_list [0]);
+ *(int *)(dns -> buffer), h -> h_addr_list [0]);
#endif
/* XXX Set the timeout for an hour from now.
@@ -652,6 +652,8 @@ int evaluate_boolean_expression (result, packet, lease, in_options,
return 1;
#endif /* NSUPDATE */
+ case expr_none:
+ case expr_match:
case expr_substring:
case expr_suffix:
case expr_option:
@@ -842,8 +844,9 @@ int evaluate_data_expression (result, packet, lease,
if (buffer_allocate (&result -> buffer, result -> len,
"evaluate_data_expression")) {
result -> data = &result -> buffer -> data [0];
- result -> data [0] = packet -> raw -> htype;
- memcpy (&result -> data [1], packet -> raw -> chaddr,
+ result -> buffer -> data [0] = packet -> raw -> htype;
+ memcpy (&result -> buffer -> data [1],
+ packet -> raw -> chaddr,
packet -> raw -> hlen);
result -> terminated = 0;
} else {
@@ -879,7 +882,7 @@ int evaluate_data_expression (result, packet, lease,
if (buffer_allocate (&result -> buffer, result -> len,
"evaluate_data_expression")) {
result -> data = &result -> buffer -> data [0];
- memcpy (result -> data,
+ memcpy (result -> buffer -> data,
(((unsigned char *)(packet -> raw))
+ offset), result -> len);
result -> terminated = 0;
@@ -965,8 +968,8 @@ int evaluate_data_expression (result, packet, lease,
return 0;
}
result -> data = &result -> buffer -> data [0];
- memcpy (result -> data, data.data, data.len);
- memcpy (&result -> data [data.len],
+ memcpy (result -> buffer -> data, data.data, data.len);
+ memcpy (&result -> buffer -> data [data.len],
other.data, other.len + other.terminated);
} else if (s0)
data_string_forget (&data, "expr_concat");
@@ -995,7 +998,7 @@ int evaluate_data_expression (result, packet, lease,
s0 = 0;
} else {
result -> data = &result -> buffer -> data [0];
- result -> data [0] = len;
+ result -> buffer -> data [0] = len;
}
} else
result -> len = 0;
@@ -1024,7 +1027,7 @@ int evaluate_data_expression (result, packet, lease,
s0 = 0;
} else {
result -> data = &result -> buffer -> data [0];
- putUShort (result -> data, len);
+ putUShort (result -> buffer -> data, len);
}
} else
result -> len = 0;
@@ -1052,7 +1055,7 @@ int evaluate_data_expression (result, packet, lease,
s0 = 0;
} else {
result -> data = &result -> buffer -> data [0];
- putULong (result -> data, len);
+ putULong (result -> buffer -> data, len);
}
} else
result -> len = 0;
@@ -1089,7 +1092,7 @@ int evaluate_data_expression (result, packet, lease,
expr -> data.b2a.buffer);
if (s0 && s1 && s2 && s3) {
- int buflen, i;
+ unsigned buflen, i;
if (len != 8 && len != 16 && len != 32) {
log_info ("binary_to_ascii: %s %d!",
@@ -1156,16 +1159,17 @@ int evaluate_data_expression (result, packet, lease,
buflen = 0;
for (i = 0; i < other.len; i += len) {
buflen += (binary_to_ascii
- (&result -> data [buflen],
+ (&result -> buffer -> data [buflen],
&other.data [i], offset, len));
if (i + len != other.len) {
- memcpy (&result -> data [buflen],
+ memcpy (&result ->
+ buffer -> data [buflen],
data.data, data.len);
buflen += data.len;
}
}
/* NUL terminate. */
- result -> data [buflen] = 0;
+ result -> buffer -> data [buflen] = 0;
status = 1;
} else
status = 0;
@@ -1226,7 +1230,7 @@ int evaluate_data_expression (result, packet, lease,
result -> terminated = 0;
for (i = 0; i < data.len; i += len) {
- memcpy (&result -> data [i],
+ memcpy (&result -> buffer -> data [i],
&data.data [data.len - i - len], len);
}
status = 1;
@@ -1256,7 +1260,7 @@ int evaluate_data_expression (result, packet, lease,
if (buffer_allocate (&result -> buffer, result -> len,
"leased-address")) {
result -> data = &result -> buffer -> data [0];
- memcpy (&result -> data [0],
+ memcpy (&result -> buffer -> data [0],
lease -> ip_addr.iabuf, lease -> ip_addr.len);
result -> terminated = 0;
} else {
@@ -1308,7 +1312,7 @@ int evaluate_data_expression (result, packet, lease,
if (buffer_allocate (&result -> buffer, result -> len + 1,
"host-decl-name")) {
result -> data = &result -> buffer -> data [0];
- strcpy ((char *)&result -> data [0],
+ strcpy ((char *)&result -> buffer -> data [0],
lease -> host -> name);
result -> terminated = 1;
} else {
@@ -1338,10 +1342,10 @@ int evaluate_data_expression (result, packet, lease,
return 0;
}
if (data.len == 1 &&
- !strncasecmp ((char *)data.data, "a", 1)) {
+ !strncasecmp ((const char *)data.data, "a", 1)) {
s = lease -> ddns_fwd_name;
} else if (data.len == 3 &&
- !strncasecmp ((char *)data.data, "ptr", 3)) {
+ !strncasecmp ((const char *)data.data, "ptr", 3)) {
s = lease -> ddns_rev_name;
} else {
#if defined (DEBUG_EXPRESSIONS)
@@ -1357,7 +1361,7 @@ int evaluate_data_expression (result, packet, lease,
if (buffer_allocate (&result -> buffer, result -> len + 1,
"updated-dns-rr")) {
result -> data = &result -> buffer -> data [0];
- strcpy ((char *)&result -> data [0], s);
+ strcpy ((char *)&result -> buffer -> data [0], s);
result -> terminated = 1;
} else {
#if defined (DEBUG_EXPRESSIONS)
@@ -1383,6 +1387,10 @@ int evaluate_data_expression (result, packet, lease,
case expr_match:
case expr_static:
case expr_known:
+ case expr_none:
+ case expr_exists:
+ case expr_dns_update:
+ case expr_dns_delete:
log_error ("Boolean opcode in evaluate_data_expression: %d",
expr -> op);
return 0;
@@ -1422,6 +1430,10 @@ int evaluate_numeric_expression (result, packet, lease,
case expr_match:
case expr_static:
case expr_known:
+ case expr_none:
+ case expr_exists:
+ case expr_dns_update:
+ case expr_dns_delete:
log_error ("Boolean opcode in evaluate_numeric_expression: %d",
expr -> op);
return 0;
@@ -1444,6 +1456,7 @@ int evaluate_numeric_expression (result, packet, lease,
case expr_host_decl_name:
case expr_config_option:
case expr_leased_address:
+ case expr_updated_dns_rr:
log_error ("Data opcode in evaluate_numeric_expression: %d",
expr -> op);
return 0;
@@ -1614,7 +1627,7 @@ int evaluate_boolean_expression_result (packet, lease,
dereference any data it refers to, and then free it. */
void expression_dereference (eptr, name)
struct expression **eptr;
- char *name;
+ const char *name;
{
struct expression *expr = *eptr;
@@ -1779,7 +1792,7 @@ void expression_dereference (eptr, name)
void data_string_copy (dest, src, name)
struct data_string *dest;
struct data_string *src;
- char *name;
+ const char *name;
{
if (src -> buffer)
buffer_reference (&dest -> buffer, src -> buffer, name);
@@ -1793,7 +1806,7 @@ void data_string_copy (dest, src, name)
void data_string_forget (data, name)
struct data_string *data;
- char *name;
+ const char *name;
{
if (data -> buffer)
buffer_dereference (&data -> buffer, name);
@@ -1982,7 +1995,7 @@ int write_expression (file, expr, col, indent)
int indent;
{
struct expression *e;
- char *s;
+ const char *s;
char obuf [65];
int scol;
int width;
diff --git a/contrib/dhcp.desc b/contrib/dhcp.desc
deleted file mode 100644
index bd745fb5..00000000
--- a/contrib/dhcp.desc
+++ /dev/null
@@ -1,161 +0,0 @@
-Summary: The Internet Software Consortium (ISC) DHCP server
-Name: dhcp
-%define version 3.1
-Version: %{version}
-Release: 2tac
-Group: System Environment/Daemons
-Source: /usr/local/src/RPM/SOURCES/dhcp-%{version}.tar.gz
-Copyright: ISC
-BuildRoot: /var/tmp/dhcp-%{version}-root
-
-%description
-Dhcp includes the DHCP server which is used for dynamically configuring
-hosts on a network. Host configuration items such as IP address, name
-servers, domain name, etc. can all be retrieved from the DHCP server by
-a DHCP client. This eases the burden of network wide configuration by
-putting all of the configuration into one place.
-
-%package client
-Summary: A DHCP client
-Group: System Environment/Configuration
-
-%description client
-Dhcp client is a DHCP client for various UNIX operating systems. It allows
-a UNIX machine to obtain it's networking parameters from a DHCP server.
-
-%package relay
-Summary: A DHCP relay
-Group: System Environment/Daemons
-
-%description relay
-Dhcp relay is a relay agent for DHCP packets. It is used on a subnet with
-DHCP clients to "relay" their requests to a subnet that has a DHCP server
-on it. Because DHCP packets can be broadcast, they will not be routed off
-of the local subnet. The DHCP relay takes care of this for the client.
-
-%package devel
-Summary: Development headers and libraries for the dhcpctl API
-Group: Development/Libraries
-
-%description devel
-Dhcp devel contains all of the libraries and headers for developing with
-the dhcpctl API.
-
-%prep
-exit 0 # XXX
-%setup -q -n dhcp-%{version}
-# do some file editing
-egrep "VARRUN
-ETC
-VARDB" site.conf | sed -e 's/ *=/=/g' -e 's/= */=/g' > vars
-. ./vars
-cat << EOF >> includes/site.h
-#define _PATH_DHCPD_PID "$VARRUN/dhcpd.pid"
-#define _PATH_DHCPD_DB "$ETC/dhcpd.leases"
-#define _PATH_DHCPD_CONF "$ETC/dhcpd.conf"
-EOF
-./configure --with-nsupdate
-
-%build
-exit 0 # XXX
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/usr/local/sbin
-
-make DESTDIR="$RPM_BUILD_ROOT" install
-
-%ifos linux
-mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/{init,rc0,rc1,rc2,rc3,rc4,rc5,rc6}.d
-install -m 755 linux.init ${RPM_BUILD_ROOT}/etc/rc.d/init.d/dhcpd
-%else
-%ifos solaris
-mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
-sed -e s'|@PREFIX@|%{_prefix}|g' < solaris.init >
-${RPM_BUILD_ROOT}/etc/init.d/dhcpd
-chmod 755 ${RPM_BUILD_ROOT}/etc/init.d/dhcpd
-%endif
-%endif
-
-# strip binaries and libraries
-strip $RPM_BUILD_ROOT%{_prefix}/sbin/* || :
-for i in `find $RPM_BUILD_ROOT/ -type 'f' -perm '+a=x' ! -name
-'lib*so*'`; do
- file $i |grep -q "not stripped" && strip $i
-done
-
-%post
-%ifos linux
- /sbin/chkconfig --add dhcpd
- /etc/rc.d/init.d/dhcpd start
-%else
- %ifos solaris
- ln /etc/init.d/dhcpd /etc/rc2.d/S90dhcpd
- ln /etc/init.d/dhcpd /etc/rc0.d/K30dhcpd
- /etc/init.d/dhcpd start
- %else
- echo "Unknown O/S. You will need to manually configure your\nsystem"
- echo "to start the DHCP server on system startup."
- %endif
-%endif
-
-%preun
-if [ $1 = 0 ]; then
- %ifos linux
- /etc/rc.d/init.d/dhcpd stop
- /sbin/chkconfig --del dhcpd
- %else
- %ifos solaris
- /etc/init.d/dhcpd stop
- rm /etc/rc2.d/S90dhcpd
- rm /etc/rc0.d/K30dhcpd
- %else
- echo "Unknown O/S. You will need to manually clean up the DHCP"
- echo "server startup\n in your system startup environment."
- %endif
- %endif
-fi
-
-%clean
-#XXX rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-%doc COPYRIGHT DOCUMENTATION ISC-LICENSE CHANGES README RELNOTES doc/*
-
-%{_prefix}/sbin/dhcpd
-%{_prefix}/man/cat1m/dhcpd.1m
-%{_prefix}/man/cat4/dhcpd.conf.4
-%{_prefix}/man/cat4/dhcpd.leases.4
-%{_prefix}/man/cat4/dhcp-options.4
-%{_prefix}/man/cat4/dhcp-eval.4
-%{_prefix}/man/cat4/dhcp-contrib.4
-%ifos linux
-%config /etc/rc.d/init.d/dhcpd
-%else
-%ifos solaris
-%config /etc/init.d/dhcpd
-%endif
-%endif
-
-%files devel
-%{_prefix}/man/cat3
-%{_prefix}/lib
-%{_prefix}/include
-
-%files client
-%{_prefix}/etc/dhclient-script
-%{_prefix}/sbin/dhclient
-%{_prefix}/man/cat1m/dhclient.1m
-%{_prefix}/man/cat1m/dhclient-script.1m
-%{_prefix}/man/cat4/dhclient.conf.4
-%{_prefix}/man/cat4/dhclient.leases.4
-
-%files relay
-%{_prefix}/sbin/dhcrelay
-%{_prefix}/man/cat1m/dhcrelay.1m
-
-%changelog
-* Fri Oct 1 1999 Brian J. Murrell <brian@interlinx.bc.ca>
-- write a spec file for dhcpd
diff --git a/dhcpctl/callback.c b/dhcpctl/callback.c
index d6da79d8..d1f37be3 100644
--- a/dhcpctl/callback.c
+++ b/dhcpctl/callback.c
@@ -95,7 +95,7 @@ isc_result_t dhcpctl_callback_get_value (omapi_object_t *h,
}
isc_result_t dhcpctl_callback_signal_handler (omapi_object_t *o,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
dhcpctl_callback_object_t *p;
isc_result_t waitstatus;
@@ -125,7 +125,7 @@ isc_result_t dhcpctl_callback_signal_handler (omapi_object_t *o,
return ISC_R_SUCCESS;
}
-isc_result_t dhcpctl_callback_destroy (omapi_object_t *h, char *name)
+isc_result_t dhcpctl_callback_destroy (omapi_object_t *h, const char *name)
{
dhcpctl_callback_object_t *p;
if (h -> type != dhcpctl_callback_type)
diff --git a/dhcpctl/dhcpctl.c b/dhcpctl/dhcpctl.c
index a9ec04ba..92be571e 100644
--- a/dhcpctl/dhcpctl.c
+++ b/dhcpctl/dhcpctl.c
@@ -61,7 +61,7 @@ dhcpctl_status dhcpctl_initialize ()
information. */
dhcpctl_status dhcpctl_connect (dhcpctl_handle *connection,
- char *server_name, int port,
+ const char *server_name, int port,
dhcpctl_handle authinfo)
{
isc_result_t status;
@@ -128,12 +128,12 @@ dhcpctl_status dhcpctl_wait_for_completion (dhcpctl_handle h,
"known" or "client-hostname". */
dhcpctl_status dhcpctl_get_value (dhcpctl_data_string *result,
- dhcpctl_handle h, char *value_name)
+ dhcpctl_handle h, const char *value_name)
{
isc_result_t status;
omapi_value_t *tv = (omapi_value_t *)0;
omapi_data_string_t *value = (omapi_data_string_t *)0;
- int len;
+ unsigned len;
int ip;
status = omapi_get_value_str (h, (omapi_object_t *)0, value_name, &tv);
@@ -196,7 +196,7 @@ dhcpctl_status dhcpctl_get_value (dhcpctl_data_string *result,
values, since no data_string needs to be dealt with. */
dhcpctl_status dhcpctl_get_boolean (int *result,
- dhcpctl_handle h, char *value_name)
+ dhcpctl_handle h, const char *value_name)
{
isc_result_t status;
dhcpctl_data_string data = (dhcpctl_data_string)0;
@@ -221,7 +221,7 @@ dhcpctl_status dhcpctl_get_boolean (int *result,
server - just sets the value on the handle. */
dhcpctl_status dhcpctl_set_value (dhcpctl_handle h, dhcpctl_data_string value,
- char *value_name)
+ const char *value_name)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -290,7 +290,7 @@ dhcpctl_status dhcpctl_set_string_value (dhcpctl_handle h, const char *value,
only more convenient for booleans. */
dhcpctl_status dhcpctl_set_boolean_value (dhcpctl_handle h, int value,
- char *value_name)
+ const char *value_name)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -323,7 +323,7 @@ dhcpctl_status dhcpctl_set_boolean_value (dhcpctl_handle h, int value,
only more convenient for booleans. */
dhcpctl_status dhcpctl_set_int_value (dhcpctl_handle h, int value,
- char *value_name)
+ const char *value_name)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -410,7 +410,7 @@ dhcpctl_status dhcpctl_object_refresh (dhcpctl_handle connection,
return status;
}
status = omapi_set_int_value (message, (omapi_object_t *)0,
- "handle", h -> handle);
+ "handle", (int)(h -> handle));
if (status != ISC_R_SUCCESS) {
omapi_object_dereference (&message, "dhcpctl_object_refresh");
return status;
@@ -453,7 +453,7 @@ dhcpctl_status dhcpctl_object_remove (dhcpctl_handle connection,
}
status = omapi_set_int_value (message, (omapi_object_t *)0, "handle",
- ro -> remote_handle);
+ (int)(ro -> remote_handle));
if (status != ISC_R_SUCCESS) {
omapi_object_dereference (&message,
"dhcpctl_object_delete");
diff --git a/dhcpctl/dhcpctl.h b/dhcpctl/dhcpctl.h
index c37c28d2..9d81dff3 100644
--- a/dhcpctl/dhcpctl.h
+++ b/dhcpctl/dhcpctl.h
@@ -56,16 +56,17 @@ omapi_object_type_t *dhcpctl_remote_type;
dhcpctl_status dhcpctl_initialize (void);
dhcpctl_status dhcpctl_connect (dhcpctl_handle *,
- char *, int, dhcpctl_handle);
+ const char *, int, dhcpctl_handle);
dhcpctl_status dhcpctl_wait_for_completion (dhcpctl_handle, dhcpctl_status *);
dhcpctl_status dhcpctl_get_value (dhcpctl_data_string *,
- dhcpctl_handle, char *);
-dhcpctl_status dhcpctl_get_boolean (int *, dhcpctl_handle, char *);
-dhcpctl_status dhcpctl_set_value (dhcpctl_handle, dhcpctl_data_string, char *);
+ dhcpctl_handle, const char *);
+dhcpctl_status dhcpctl_get_boolean (int *, dhcpctl_handle, const char *);
+dhcpctl_status dhcpctl_set_value (dhcpctl_handle,
+ dhcpctl_data_string, const char *);
dhcpctl_status dhcpctl_set_string_value (dhcpctl_handle, const char *,
const char *);
-dhcpctl_status dhcpctl_set_boolean_value (dhcpctl_handle, int, char *);
-dhcpctl_status dhcpctl_set_int_value (dhcpctl_handle, int, char *);
+dhcpctl_status dhcpctl_set_boolean_value (dhcpctl_handle, int, const char *);
+dhcpctl_status dhcpctl_set_int_value (dhcpctl_handle, int, const char *);
dhcpctl_status dhcpctl_object_update (dhcpctl_handle, dhcpctl_handle);
dhcpctl_status dhcpctl_object_refresh (dhcpctl_handle, dhcpctl_handle);
dhcpctl_status dhcpctl_object_remove (dhcpctl_handle, dhcpctl_handle);
@@ -79,24 +80,25 @@ isc_result_t dhcpctl_callback_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcpctl_callback_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcpctl_callback_destroy (omapi_object_t *, char *);
+isc_result_t dhcpctl_callback_destroy (omapi_object_t *, const char *);
isc_result_t dhcpctl_callback_signal_handler (omapi_object_t *,
- char *, va_list);
+ const char *, va_list);
isc_result_t dhcpctl_callback_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
dhcpctl_status dhcpctl_open_object (dhcpctl_handle, dhcpctl_handle, int);
-dhcpctl_status dhcpctl_new_object (dhcpctl_handle *, dhcpctl_handle, char *);
+dhcpctl_status dhcpctl_new_object (dhcpctl_handle *,
+ dhcpctl_handle, const char *);
isc_result_t dhcpctl_remote_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_typed_data_t *);
isc_result_t dhcpctl_remote_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcpctl_remote_destroy (omapi_object_t *, char *);
+isc_result_t dhcpctl_remote_destroy (omapi_object_t *, const char *);
isc_result_t dhcpctl_remote_signal_handler (omapi_object_t *,
- char *, va_list);
+ const char *, va_list);
isc_result_t dhcpctl_remote_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
diff --git a/dhcpctl/remote.c b/dhcpctl/remote.c
index aa95742e..c65a86dc 100644
--- a/dhcpctl/remote.c
+++ b/dhcpctl/remote.c
@@ -33,7 +33,7 @@
dhcpctl_status dhcpctl_new_object (dhcpctl_handle *h,
dhcpctl_handle connection,
- char *object_type)
+ const char *object_type)
{
dhcpctl_remote_object_t *m;
omapi_object_t *g;
@@ -215,7 +215,7 @@ isc_result_t dhcpctl_remote_get_value (omapi_object_t *h,
}
isc_result_t dhcpctl_remote_signal_handler (omapi_object_t *o,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
dhcpctl_remote_object_t *p;
omapi_typed_data_t *tv;
@@ -249,7 +249,7 @@ isc_result_t dhcpctl_remote_signal_handler (omapi_object_t *o,
return ISC_R_SUCCESS;
}
-isc_result_t dhcpctl_remote_destroy (omapi_object_t *h, char *name)
+isc_result_t dhcpctl_remote_destroy (omapi_object_t *h, const char *name)
{
dhcpctl_remote_object_t *p;
if (h -> type != dhcpctl_remote_type)
diff --git a/dhcpctl/test.c b/dhcpctl/test.c
index f2465ec1..380be5e9 100644
--- a/dhcpctl/test.c
+++ b/dhcpctl/test.c
@@ -222,8 +222,7 @@ option smtp-server 10.0.0.1;",
exit (1);
}
- printf ("host name = %*.*s\n", result -> len, result -> len,
- result -> value);
+ printf ("host name = %*s\n", result -> len, result -> value);
#if 0
status = dhcpctl_object_remove (connection, host_handle);
diff --git a/includes/auth.h b/includes/auth.h
index 5bc61f92..51094324 100644
--- a/includes/auth.h
+++ b/includes/auth.h
@@ -32,7 +32,7 @@ struct signature_state {
};
struct auth_key {
- int length;
+ unsigned length;
u_int8_t data [1];
};
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 8992c97d..58a93078 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -70,7 +70,7 @@ struct parse {
char *token_line;
char *prev_line;
char *cur_line;
- char *tlname;
+ const char *tlname;
int eol_token;
char line1 [81];
@@ -91,8 +91,8 @@ struct parse {
int warnings_occurred;
int file;
char *inbuf;
- int bufix, buflen;
- int bufsiz;
+ unsigned bufix, buflen;
+ unsigned bufsiz;
};
/* Variable-length array of data. */
@@ -155,7 +155,7 @@ struct option_state {
struct packet {
struct dhcp_packet *raw;
int refcnt;
- int packet_length;
+ unsigned packet_length;
int packet_type;
int options_valid;
int client_port;
@@ -211,8 +211,8 @@ struct lease {
struct iaddr ip_addr;
TIME starts, ends, timestamp;
unsigned char *uid;
- int uid_len;
- int uid_max;
+ unsigned uid_len;
+ unsigned uid_max;
unsigned char uid_buf [32];
char *hostname;
char *client_hostname;
@@ -503,7 +503,7 @@ struct failover_peer {
struct shared_network {
OMAPI_OBJECT_PREAMBLE;
struct shared_network *next;
- char *name;
+ const char *name;
struct subnet *subnets;
struct interface_info *interface;
struct pool *pools;
@@ -529,7 +529,7 @@ struct subnet {
struct collection {
struct collection *next;
- char *name;
+ const char *name;
struct class *classes;
};
@@ -538,7 +538,7 @@ struct class {
OMAPI_OBJECT_PREAMBLE;
struct class *nic; /* Next in collection. */
struct class *superclass; /* Set for spawned classes only. */
- char *name; /* Not set for spawned classes. */
+ const char *name; /* Not set for spawned classes. */
/* A class may be configured to permit a limited number of leases. */
int lease_limit;
@@ -635,7 +635,7 @@ struct client_config {
u_int32_t requested_lease; /* Requested lease time, if user
doesn't configure one. */
struct string_list *media; /* Possible network media values. */
- char *script_name; /* Name of config script. */
+ const char *script_name; /* Name of config script. */
enum policy bootp_policy;
/* Ignore, accept or prefer BOOTP
responses. */
@@ -670,7 +670,7 @@ struct client_state {
TIME interval; /* What's the current resend interval? */
struct string_list *medium; /* Last media type tried. */
struct dhcp_packet packet; /* Outgoing DHCP packet. */
- int packet_length; /* Actual length of generated packet. */
+ unsigned packet_length; /* Actual length of generated packet. */
struct iaddr requested_address; /* Address we would like to get. */
@@ -689,11 +689,11 @@ struct interface_info {
u_int8_t *circuit_id; /* Circuit ID associated with this
interface. */
- int circuit_id_len; /* Length of Circuit ID, if there
+ unsigned circuit_id_len; /* Length of Circuit ID, if there
is one. */
u_int8_t *remote_id; /* Remote ID associated with this
interface (if any). */
- int remote_id_len; /* Length of Remote ID. */
+ unsigned remote_id_len; /* Length of Remote ID. */
char name [IFNAMSIZ]; /* Its name... */
int rfdesc; /* Its read file descriptor. */
@@ -766,7 +766,7 @@ struct dns_query {
struct dns_answer *answer; /* Answer, internal format. */
unsigned char *query; /* Query formatted for DNS server. */
- int len; /* Length of entire query. */
+ unsigned len; /* Length of entire query. */
int sent; /* The query has been sent. */
struct dns_wakeup *wakeups; /* Wakeups to call if this query is
answered. */
@@ -840,35 +840,36 @@ typedef unsigned char option_mask [16];
/* options.c */
int parse_options PROTO ((struct packet *));
-int parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
+int parse_option_buffer PROTO ((struct packet *, unsigned char *, unsigned));
int parse_agent_information_option PROTO ((struct packet *, int, u_int8_t *));
int cons_options PROTO ((struct packet *, struct dhcp_packet *, struct lease *,
int, struct option_state *, struct option_state *,
int, int, int, struct data_string *));
-int store_options PROTO ((unsigned char *, int, struct packet *,
+int store_options PROTO ((unsigned char *, unsigned, struct packet *,
struct lease *,
struct option_state *, struct option_state *,
- int *, int, int, int, int));
-char *pretty_print_option PROTO ((unsigned int,
- unsigned char *, int, int, int));
+ unsigned *, int, unsigned, unsigned, int));
+const char *pretty_print_option PROTO ((unsigned int, const unsigned char *,
+ unsigned, int, int));
void do_packet PROTO ((struct interface_info *,
- struct dhcp_packet *, int,
+ struct dhcp_packet *, unsigned,
unsigned int, struct iaddr, struct hardware *));
int hashed_option_get PROTO ((struct data_string *, struct universe *,
struct packet *, struct lease *,
struct option_state *, struct option_state *,
- struct option_state *, int));
+ struct option_state *, unsigned));
int agent_option_get PROTO ((struct data_string *, struct universe *,
struct packet *, struct lease *,
struct option_state *, struct option_state *,
- struct option_state *, int));
+ struct option_state *, unsigned));
void hashed_option_set PROTO ((struct universe *, struct option_state *,
struct option_cache *,
enum statement_op));
struct option_cache *lookup_option PROTO ((struct universe *,
- struct option_state *, int));
+ struct option_state *, unsigned));
struct option_cache *lookup_hashed_option PROTO ((struct universe *,
- struct option_state *, int));
+ struct option_state *,
+ unsigned));
void save_option PROTO ((struct universe *,
struct option_state *, struct option_cache *));
void save_hashed_option PROTO ((struct universe *,
@@ -876,7 +877,7 @@ void save_hashed_option PROTO ((struct universe *,
void delete_option PROTO ((struct universe *, struct option_state *, int));
void delete_hashed_option PROTO ((struct universe *,
struct option_state *, int));
-int option_cache_dereference PROTO ((struct option_cache **, char *));
+int option_cache_dereference PROTO ((struct option_cache **, const char *));
int hashed_option_state_dereference PROTO ((struct universe *,
struct option_state *));
int agent_option_state_dereference PROTO ((struct universe *,
@@ -897,11 +898,11 @@ int hashed_option_space_encapsulate PROTO ((struct data_string *,
struct universe *));
/* errwarn.c */
-void log_fatal PROTO ((char *, ...));
-int log_error PROTO ((char *, ...));
-int log_info PROTO ((char *, ...));
-int log_debug PROTO ((char *, ...));
-int parse_warn PROTO ((struct parse *, char *, ...));
+void log_fatal PROTO ((const char *, ...));
+int log_error PROTO ((const char *, ...));
+int log_info PROTO ((const char *, ...));
+int log_debug PROTO ((const char *, ...));
+int parse_warn PROTO ((struct parse *, const char *, ...));
/* dhcpd.c */
extern TIME cur_time;
@@ -913,9 +914,9 @@ extern u_int16_t remote_port;
extern int log_priority;
extern int log_perror;
-extern char *path_dhcpd_conf;
-extern char *path_dhcpd_db;
-extern char *path_dhcpd_pid;
+extern const char *path_dhcpd_conf;
+extern const char *path_dhcpd_db;
+extern const char *path_dhcpd_pid;
extern int dhcp_max_agent_option_packet_length;
@@ -925,10 +926,11 @@ void lease_pinged PROTO ((struct iaddr, u_int8_t *, int));
void lease_ping_timeout PROTO ((void *));
/* conflex.c */
-isc_result_t new_parse PROTO ((struct parse **, int, char *, int, char *));
+isc_result_t new_parse PROTO ((struct parse **, int,
+ char *, unsigned, const char *));
isc_result_t end_parse PROTO ((struct parse **));
-enum dhcp_token next_token PROTO ((char **, struct parse *));
-enum dhcp_token peek_token PROTO ((char **, struct parse *));
+enum dhcp_token next_token PROTO ((const char **, struct parse *));
+enum dhcp_token peek_token PROTO ((const char **, struct parse *));
/* confpars.c */
isc_result_t readconf PROTO ((void));
@@ -964,11 +966,12 @@ int parse_ip_addr_or_hostname PROTO ((struct expression **,
void parse_hardware_param PROTO ((struct parse *, struct hardware *));
void parse_lease_time PROTO ((struct parse *, TIME *));
unsigned char *parse_numeric_aggregate PROTO ((struct parse *,
- unsigned char *, int *,
- int, int, int));
-void convert_num PROTO ((struct parse *, unsigned char *, char *, int, int));
+ unsigned char *, unsigned *,
+ int, int, unsigned));
+void convert_num PROTO ((struct parse *, unsigned char *, const char *,
+ int, unsigned));
TIME parse_date PROTO ((struct parse *));
-struct option *parse_option_name PROTO ((struct parse *, int));
+struct option *parse_option_name PROTO ((struct parse *, int, int *));
void parse_option_space_decl PROTO ((struct parse *));
int parse_option_code_definition PROTO ((struct parse *, struct option *));
int parse_cshl PROTO ((struct data_string *, struct parse *));
@@ -994,19 +997,20 @@ int parse_expression PROTO ((struct expression **, struct parse *, int *,
int parse_option_statement PROTO ((struct executable_statement **,
struct parse *, int,
struct option *, enum statement_op));
-int parse_option_token PROTO ((struct expression **, struct parse *, char *,
- struct expression *, int, int));
+int parse_option_token PROTO ((struct expression **, struct parse *,
+ const char *, struct expression *, int, int));
int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int));
int parse_auth_key PROTO ((struct data_string *, struct parse *));
/* tree.c */
pair cons PROTO ((caddr_t, pair));
int make_const_option_cache PROTO ((struct option_cache **, struct buffer **,
- u_int8_t *, int, struct option *, char *));
-int make_host_lookup PROTO ((struct expression **, char *));
-int enter_dns_host PROTO ((struct dns_host_entry **, char *));
+ u_int8_t *, unsigned, struct option *,
+ const char *));
+int make_host_lookup PROTO ((struct expression **, const char *));
+int enter_dns_host PROTO ((struct dns_host_entry **, const char *));
int make_const_data PROTO ((struct expression **,
- unsigned char *, int, int, int));
+ const unsigned char *, unsigned, int, int));
int make_concat PROTO ((struct expression **,
struct expression *, struct expression *));
int make_encapsulation PROTO ((struct expression **, struct data_string *));
@@ -1040,10 +1044,10 @@ int evaluate_boolean_expression_result PROTO ((struct packet *, struct lease *,
struct option_state *,
struct option_state *,
struct expression *));
-void expression_dereference PROTO ((struct expression **, char *));
+void expression_dereference PROTO ((struct expression **, const char *));
void data_string_copy PROTO ((struct data_string *,
- struct data_string *, char *));
-void data_string_forget PROTO ((struct data_string *, char *));
+ struct data_string *, const char *));
+void data_string_forget PROTO ((struct data_string *, const char *));
void data_string_truncate PROTO ((struct data_string *, int));
int is_boolean_expression PROTO ((struct expression *));
int is_data_expression PROTO ((struct expression *));
@@ -1070,7 +1074,7 @@ struct lease *find_lease PROTO ((struct packet *,
struct lease *mockup_lease PROTO ((struct packet *,
struct shared_network *,
struct host_decl *));
-void static_lease_dereference PROTO ((struct lease *, char *));
+void static_lease_dereference PROTO ((struct lease *, const char *));
struct lease *allocate_lease PROTO ((struct packet *, struct pool *, int));
int permitted PROTO ((struct packet *, struct permit *));
@@ -1080,100 +1084,105 @@ int locate_network PROTO ((struct packet *));
void bootp PROTO ((struct packet *));
/* memory.c */
-struct group *clone_group PROTO ((struct group *, char *));
+struct group *clone_group PROTO ((struct group *, const char *));
/* alloc.c */
-VOIDPTR dmalloc PROTO ((int, char *));
-void dfree PROTO ((VOIDPTR, char *));
-struct dhcp_packet *new_dhcp_packet PROTO ((char *));
-struct hash_table *new_hash_table PROTO ((int, char *));
-struct hash_bucket *new_hash_bucket PROTO ((char *));
-struct lease *new_lease PROTO ((char *));
-struct lease *new_leases PROTO ((int, char *));
-struct subnet *new_subnet PROTO ((char *));
-struct class *new_class PROTO ((char *));
-struct shared_network *new_shared_network PROTO ((char *));
-struct group *new_group PROTO ((char *));
-struct protocol *new_protocol PROTO ((char *));
-struct lease_state *new_lease_state PROTO ((char *));
-struct domain_search_list *new_domain_search_list PROTO ((char *));
-struct name_server *new_name_server PROTO ((char *));
-void free_name_server PROTO ((struct name_server *, char *));
-struct option *new_option PROTO ((char *));
-void free_option PROTO ((struct option *, char *));
-struct universe *new_universe PROTO ((char *));
-void free_universe PROTO ((struct universe *, char *));
-void free_domain_search_list PROTO ((struct domain_search_list *, char *));
-void free_lease_state PROTO ((struct lease_state *, char *));
-void free_protocol PROTO ((struct protocol *, char *));
-void free_group PROTO ((struct group *, char *));
-void free_shared_network PROTO ((struct shared_network *, char *));
-void free_class PROTO ((struct class *, char *));
-void free_subnet PROTO ((struct subnet *, char *));
-void free_lease PROTO ((struct lease *, char *));
-void free_hash_bucket PROTO ((struct hash_bucket *, char *));
-void free_hash_table PROTO ((struct hash_table *, char *));
-void free_dhcp_packet PROTO ((struct dhcp_packet *, char *));
-struct client_lease *new_client_lease PROTO ((char *));
-void free_client_lease PROTO ((struct client_lease *, char *));
-struct pool *new_pool PROTO ((char *));
-void free_pool PROTO ((struct pool *, char *));
-struct failover_peer *new_failover_peer PROTO ((char *));
-void free_failover_peer PROTO ((struct failover_peer *, char *));
-struct auth_key *new_auth_key PROTO ((int, char *));
-void free_auth_key PROTO ((struct auth_key *, char *));
-struct permit *new_permit PROTO ((char *));
-void free_permit PROTO ((struct permit *, char *));
-pair new_pair PROTO ((char *));
-void free_pair PROTO ((pair, char *));
-int expression_allocate PROTO ((struct expression **, char *));
+VOIDPTR dmalloc PROTO ((unsigned, const char *));
+void dfree PROTO ((VOIDPTR, const char *));
+struct dhcp_packet *new_dhcp_packet PROTO ((const char *));
+struct hash_table *new_hash_table PROTO ((int, const char *));
+struct hash_bucket *new_hash_bucket PROTO ((const char *));
+struct lease *new_lease PROTO ((const char *));
+struct lease *new_leases PROTO ((unsigned, const char *));
+struct subnet *new_subnet PROTO ((const char *));
+struct class *new_class PROTO ((const char *));
+struct shared_network *new_shared_network PROTO ((const char *));
+struct group *new_group PROTO ((const char *));
+struct protocol *new_protocol PROTO ((const char *));
+struct lease_state *new_lease_state PROTO ((const char *));
+struct domain_search_list *new_domain_search_list PROTO ((const char *));
+struct name_server *new_name_server PROTO ((const char *));
+void free_name_server PROTO ((struct name_server *, const char *));
+struct option *new_option PROTO ((const char *));
+void free_option PROTO ((struct option *, const char *));
+struct universe *new_universe PROTO ((const char *));
+void free_universe PROTO ((struct universe *, const char *));
+void free_domain_search_list PROTO ((struct domain_search_list *,
+ const char *));
+void free_lease_state PROTO ((struct lease_state *, const char *));
+void free_protocol PROTO ((struct protocol *, const char *));
+void free_group PROTO ((struct group *, const char *));
+void free_shared_network PROTO ((struct shared_network *, const char *));
+void free_class PROTO ((struct class *, const char *));
+void free_subnet PROTO ((struct subnet *, const char *));
+void free_lease PROTO ((struct lease *, const char *));
+void free_hash_bucket PROTO ((struct hash_bucket *, const char *));
+void free_hash_table PROTO ((struct hash_table *, const char *));
+void free_dhcp_packet PROTO ((struct dhcp_packet *, const char *));
+struct client_lease *new_client_lease PROTO ((const char *));
+void free_client_lease PROTO ((struct client_lease *, const char *));
+struct pool *new_pool PROTO ((const char *));
+void free_pool PROTO ((struct pool *, const char *));
+struct failover_peer *new_failover_peer PROTO ((const char *));
+void free_failover_peer PROTO ((struct failover_peer *, const char *));
+struct auth_key *new_auth_key PROTO ((unsigned, const char *));
+void free_auth_key PROTO ((struct auth_key *, const char *));
+struct permit *new_permit PROTO ((const char *));
+void free_permit PROTO ((struct permit *, const char *));
+pair new_pair PROTO ((const char *));
+void free_pair PROTO ((pair, const char *));
+int expression_allocate PROTO ((struct expression **, const char *));
int expression_reference PROTO ((struct expression **,
- struct expression *, char *));
-void free_expression PROTO ((struct expression *, char *));
-int option_cache_allocate PROTO ((struct option_cache **, char *));
+ struct expression *, const char *));
+void free_expression PROTO ((struct expression *, const char *));
+int option_cache_allocate PROTO ((struct option_cache **, const char *));
int option_cache_reference PROTO ((struct option_cache **,
- struct option_cache *, char *));
-int buffer_allocate PROTO ((struct buffer **, int, char *));
-int buffer_reference PROTO ((struct buffer **, struct buffer *, char *));
-int buffer_dereference PROTO ((struct buffer **, char *));
-int dns_host_entry_allocate PROTO ((struct dns_host_entry **, char *, char *));
+ struct option_cache *, const char *));
+int buffer_allocate PROTO ((struct buffer **, unsigned, const char *));
+int buffer_reference PROTO ((struct buffer **, struct buffer *, const char *));
+int buffer_dereference PROTO ((struct buffer **, const char *));
+int dns_host_entry_allocate PROTO ((struct dns_host_entry **,
+ const char *, const char *));
int dns_host_entry_reference PROTO ((struct dns_host_entry **,
- struct dns_host_entry *, char *));
-int dns_host_entry_dereference PROTO ((struct dns_host_entry **, char *));
-int option_state_allocate PROTO ((struct option_state **, char *));
+ struct dns_host_entry *, const char *));
+int dns_host_entry_dereference PROTO ((struct dns_host_entry **,
+ const char *));
+int option_state_allocate PROTO ((struct option_state **, const char *));
int option_state_reference PROTO ((struct option_state **,
- struct option_state *, char *));
-int option_state_dereference PROTO ((struct option_state **, char *));
+ struct option_state *, const char *));
+int option_state_dereference PROTO ((struct option_state **, const char *));
int executable_statement_allocate PROTO ((struct executable_statement **,
- char *));
+ const char *));
int executable_statement_reference PROTO ((struct executable_statement **,
struct executable_statement *,
- char *));
+ const char *));
int executable_statement_dereference PROTO ((struct executable_statement **,
- char *));
+ const char *));
void write_statements (FILE *, struct executable_statement *, int);
-int packet_allocate PROTO ((struct packet **, char *));
-int packet_reference PROTO ((struct packet **, struct packet *, char *));
-int packet_dereference PROTO ((struct packet **, char *));
+int packet_allocate PROTO ((struct packet **, const char *));
+int packet_reference PROTO ((struct packet **, struct packet *, const char *));
+int packet_dereference PROTO ((struct packet **, const char *));
/* print.c */
char *print_hw_addr PROTO ((int, int, unsigned char *));
void print_lease PROTO ((struct lease *));
-void dump_raw PROTO ((unsigned char *, int));
+void dump_raw PROTO ((const unsigned char *, unsigned));
void dump_packet PROTO ((struct packet *));
void hash_dump PROTO ((struct hash_table *));
-char *print_hex_1 PROTO ((int, u_int8_t *, int));
-char *print_hex_2 PROTO ((int, u_int8_t *, int));
-char *print_hex_3 PROTO ((int, u_int8_t *, int));
-char *print_dotted_quads PROTO ((int, u_int8_t *));
-char *print_dec_1 PROTO ((int));
-char *print_dec_2 PROTO ((int));
+char *print_hex_1 PROTO ((unsigned, const u_int8_t *, unsigned));
+char *print_hex_2 PROTO ((unsigned, const u_int8_t *, unsigned));
+char *print_hex_3 PROTO ((unsigned, const u_int8_t *, unsigned));
+char *print_dotted_quads PROTO ((unsigned, const u_int8_t *));
+char *print_dec_1 PROTO ((unsigned long));
+char *print_dec_2 PROTO ((unsigned long));
void print_expression PROTO ((char *, struct expression *));
-int token_print_indent_concat (FILE *, int, int, char *, char *, ...);
-int token_indent_data_string (FILE *, int, int, char *, char *,
+int token_print_indent_concat (FILE *, int, int,
+ const char *, const char *, ...);
+int token_indent_data_string (FILE *, int, int, const char *, const char *,
struct data_string *);
-int token_print_indent (FILE *, int, int, char *, char *, char *);
+int token_print_indent (FILE *, int, int,
+ const char *, const char *, const char *);
void indent_spaces (FILE *, int);
/* socket.c */
@@ -1334,7 +1343,7 @@ extern struct interface_info *interfaces,
extern struct protocol *protocols;
extern int quiet_interface_discovery;
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
- struct dhcp_packet *, int,
+ struct dhcp_packet *, unsigned,
unsigned int,
struct iaddr, struct hardware *));
extern struct timeout *timeouts;
@@ -1349,15 +1358,16 @@ isc_result_t interface_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *, omapi_typed_data_t *);
isc_result_t interface_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *, omapi_value_t **);
-isc_result_t interface_destroy (omapi_object_t *, char *);
-isc_result_t interface_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t interface_destroy (omapi_object_t *, const char *);
+isc_result_t interface_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t interface_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *));
void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *));
-struct protocol *add_protocol PROTO ((char *, int,
+struct protocol *add_protocol PROTO ((const char *, int,
void (*) PROTO ((struct protocol *)),
void *));
@@ -1366,9 +1376,11 @@ void remove_protocol PROTO ((struct protocol *));
/* hash.c */
struct hash_table *new_hash PROTO ((void));
void add_hash PROTO ((struct hash_table *,
- unsigned char *, int, unsigned char *));
-void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int));
-unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int));
+ const unsigned char *, unsigned, unsigned char *));
+void delete_hash_entry PROTO ((struct hash_table *,
+ const unsigned char *, unsigned));
+unsigned char *hash_lookup PROTO ((struct hash_table *,
+ const unsigned char *, unsigned));
/* tables.c */
extern struct universe dhcp_universe;
@@ -1379,25 +1391,26 @@ extern struct universe server_universe;
extern struct option server_options [256];
extern int dhcp_option_default_priority_list [];
extern int dhcp_option_default_priority_list_count;
-extern char *hardware_types [256];
+extern const char *hardware_types [256];
int universe_count, universe_max;
struct universe **universes;
extern struct hash_table universe_hash;
void initialize_universes PROTO ((void));
/* convert.c */
-u_int32_t getULong PROTO ((unsigned char *));
-int32_t getLong PROTO ((unsigned char *));
-u_int32_t getUShort PROTO ((unsigned char *));
-int32_t getShort PROTO ((unsigned char *));
-u_int32_t getUChar PROTO ((unsigned char *));
+u_int32_t getULong PROTO ((const unsigned char *));
+int32_t getLong PROTO ((const unsigned char *));
+u_int32_t getUShort PROTO ((const unsigned char *));
+int32_t getShort PROTO ((const unsigned char *));
+u_int32_t getUChar PROTO ((const unsigned char *));
void putULong PROTO ((unsigned char *, u_int32_t));
void putLong PROTO ((unsigned char *, int32_t));
void putUShort PROTO ((unsigned char *, u_int32_t));
void putShort PROTO ((unsigned char *, int32_t));
void putUChar PROTO ((unsigned char *, u_int32_t));
-int converted_length PROTO ((unsigned char *, unsigned int, unsigned int));
-int binary_to_ascii PROTO ((unsigned char *, unsigned char *,
+int converted_length PROTO ((const unsigned char *,
+ unsigned int, unsigned int));
+int binary_to_ascii PROTO ((unsigned char *, const unsigned char *,
unsigned int, unsigned int));
/* inet.c */
@@ -1409,9 +1422,9 @@ int addr_eq PROTO ((struct iaddr, struct iaddr));
char *piaddr PROTO ((struct iaddr));
/* dhclient.c */
-extern char *path_dhclient_conf;
-extern char *path_dhclient_db;
-extern char *path_dhclient_pid;
+extern const char *path_dhclient_conf;
+extern const char *path_dhclient_db;
+extern const char *path_dhclient_pid;
extern int interfaces_requested;
extern struct client_config top_level_config;
@@ -1449,10 +1462,10 @@ void write_client_lease PROTO ((struct client_state *,
struct client_lease *, int));
char *dhcp_option_ev_name PROTO ((struct option *));
-void script_init PROTO ((struct client_state *, char *,
+void script_init PROTO ((struct client_state *, const char *,
struct string_list *));
void script_write_params PROTO ((struct client_state *,
- char *, struct client_lease *));
+ const char *, struct client_lease *));
int script_go PROTO ((struct client_state *));
struct client_lease *packet_to_lease PROTO ((struct packet *));
@@ -1464,40 +1477,40 @@ void client_location_changed PROTO ((void));
int write_lease PROTO ((struct lease *));
int write_host PROTO ((struct host_decl *));
int write_group PROTO ((struct group_object *));
-int db_printable PROTO ((char *));
-int db_printable_len PROTO ((char *, int));
+int db_printable PROTO ((const char *));
+int db_printable_len PROTO ((const char *, unsigned));
int write_billing_class PROTO ((struct class *));
int commit_leases PROTO ((void));
void db_startup PROTO ((int));
void new_lease_file PROTO ((void));
/* packet.c */
-u_int32_t checksum PROTO ((unsigned char *, int, u_int32_t));
+u_int32_t checksum PROTO ((unsigned char *, unsigned, u_int32_t));
u_int32_t wrapsum PROTO ((u_int32_t));
void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
- int *, struct hardware *));
+ unsigned *, struct hardware *));
void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- int *, u_int32_t, u_int32_t, u_int32_t,
- unsigned char *, int));
+ unsigned *, u_int32_t, u_int32_t,
+ u_int32_t, unsigned char *, unsigned));
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
- int, struct hardware *));
+ unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- int, struct sockaddr_in *,
- unsigned char *, int));
+ unsigned, struct sockaddr_in *,
+ unsigned char *, unsigned));
/* ethernet.c */
void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
- int *, struct hardware *));
+ unsigned *, struct hardware *));
ssize_t decode_ethernet_header PROTO ((struct interface_info *,
unsigned char *,
- int, struct hardware *));
+ unsigned, struct hardware *));
/* tr.c */
void assemble_tr_header PROTO ((struct interface_info *, unsigned char *,
- int *, struct hardware *));
+ unsigned *, struct hardware *));
ssize_t decode_tr_header PROTO ((struct interface_info *,
unsigned char *,
- int, struct hardware *));
+ unsigned, struct hardware *));
/* dhxpxlt.c */
void convert_statement PROTO ((struct parse *));
@@ -1542,11 +1555,11 @@ isc_result_t read_client_conf PROTO ((void));
void read_client_leases PROTO ((void));
void parse_client_statement PROTO ((struct parse *, struct interface_info *,
struct client_config *));
-int parse_X PROTO ((struct parse *, u_int8_t *, int));
+int parse_X PROTO ((struct parse *, u_int8_t *, unsigned));
void parse_option_list PROTO ((struct parse *, u_int32_t **));
void parse_interface_declaration PROTO ((struct parse *,
struct client_config *, char *));
-struct interface_info *interface_or_dummy PROTO ((char *));
+struct interface_info *interface_or_dummy PROTO ((const char *));
void make_client_state PROTO ((struct client_state **));
void make_client_config PROTO ((struct client_state *,
struct client_config *));
@@ -1561,17 +1574,17 @@ int parse_ip_addr PROTO ((struct parse *, struct iaddr *));
void parse_reject_statement PROTO ((struct parse *, struct client_config *));
/* dhcrelay.c */
-void relay PROTO ((struct interface_info *, struct dhcp_packet *, int,
+void relay PROTO ((struct interface_info *, struct dhcp_packet *, unsigned,
unsigned int, struct iaddr, struct hardware *));
int strip_relay_agent_options PROTO ((struct interface_info *,
struct interface_info **,
- struct dhcp_packet *, int));
+ struct dhcp_packet *, unsigned));
int find_interface_by_agent_option PROTO ((struct dhcp_packet *,
struct interface_info **,
u_int8_t *, int));
-int add_relay_agent_options PROTO ((struct interface_info *ip,
- struct dhcp_packet *packet,
- int length, struct in_addr giaddr));
+int add_relay_agent_options PROTO ((struct interface_info *,
+ struct dhcp_packet *,
+ unsigned, struct in_addr));
/* icmp.c */
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,
@@ -1585,8 +1598,8 @@ void dns_startup PROTO ((void));
struct dns_query *find_dns_query PROTO ((struct dns_question *, int));
void destroy_dns_query PROTO ((struct dns_query *));
struct dns_query *ns_inaddr_lookup PROTO ((struct iaddr, struct dns_wakeup *));
-struct dns_query *ns_query PROTO ((struct dns_question *,
- unsigned char *, int, struct dns_wakeup *));
+struct dns_query *ns_query PROTO ((struct dns_question *, unsigned char *,
+ unsigned, struct dns_wakeup *));
void dns_timeout PROTO ((void *));
void dns_packet PROTO ((struct protocol *));
@@ -1616,7 +1629,7 @@ void classify_client PROTO ((struct packet *));
int check_collection PROTO ((struct packet *, struct lease *,
struct collection *));
void classify PROTO ((struct packet *, struct class *));
-struct class *find_class PROTO ((char *));
+struct class *find_class PROTO ((const char *));
int unbill_class PROTO ((struct lease *, struct class *));
int bill_class PROTO ((struct lease *, struct class *));
@@ -1633,7 +1646,7 @@ void execute_statements_in_scope PROTO ((struct packet *,
/* auth.c */
void enter_auth_key PROTO ((struct data_string *, struct auth_key *));
-struct auth_key *auth_key_lookup PROTO ((struct data_string *));
+const struct auth_key *auth_key_lookup PROTO ((struct data_string *));
/* failover.c */
void enter_failover_peer PROTO ((struct failover_peer *));
@@ -1655,8 +1668,9 @@ isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcp_lease_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_lease_destroy (omapi_object_t *, char *);
-isc_result_t dhcp_lease_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *);
+isc_result_t dhcp_lease_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t dhcp_lease_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1672,8 +1686,9 @@ isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_group_destroy (omapi_object_t *, char *);
-isc_result_t dhcp_group_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t dhcp_group_destroy (omapi_object_t *, const char *);
+isc_result_t dhcp_group_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t dhcp_group_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1689,8 +1704,9 @@ isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcp_host_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_host_destroy (omapi_object_t *, char *);
-isc_result_t dhcp_host_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t dhcp_host_destroy (omapi_object_t *, const char *);
+isc_result_t dhcp_host_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t dhcp_host_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1706,8 +1722,9 @@ isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcp_pool_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_pool_destroy (omapi_object_t *, char *);
-isc_result_t dhcp_pool_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *);
+isc_result_t dhcp_pool_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t dhcp_pool_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1724,9 +1741,9 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
isc_result_t dhcp_shared_network_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_shared_network_destroy (omapi_object_t *, char *);
+isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *);
isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
- char *, va_list);
+ const char *, va_list);
isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1740,8 +1757,9 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_subnet_destroy (omapi_object_t *, char *);
-isc_result_t dhcp_subnet_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *);
+isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1755,8 +1773,9 @@ isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t dhcp_class_destroy (omapi_object_t *, char *);
-isc_result_t dhcp_class_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t dhcp_class_destroy (omapi_object_t *, const char *);
+isc_result_t dhcp_class_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t dhcp_class_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -1780,8 +1799,9 @@ extern omapi_object_type_t *dhcp_type_host;
isc_result_t enter_host PROTO ((struct host_decl *, int, int));
isc_result_t delete_host PROTO ((struct host_decl *, int));
-struct host_decl *find_hosts_by_haddr PROTO ((int, unsigned char *, int));
-struct host_decl *find_hosts_by_uid PROTO ((unsigned char *, int));
+struct host_decl *find_hosts_by_haddr PROTO ((int, const unsigned char *,
+ unsigned));
+struct host_decl *find_hosts_by_uid PROTO ((const unsigned char *, unsigned));
struct subnet *find_host_for_network PROTO ((struct host_decl **,
struct iaddr *,
struct shared_network *));
@@ -1798,10 +1818,10 @@ void enter_subnet PROTO ((struct subnet *));
void enter_lease PROTO ((struct lease *));
int supersede_lease PROTO ((struct lease *, struct lease *, int));
void release_lease PROTO ((struct lease *, struct packet *));
-void abandon_lease PROTO ((struct lease *, char *));
+void abandon_lease PROTO ((struct lease *, const char *));
void dissociate_lease PROTO ((struct lease *));
-struct lease *find_lease_by_uid PROTO ((unsigned char *, int));
-struct lease *find_lease_by_hw_addr PROTO ((unsigned char *, int));
+struct lease *find_lease_by_uid PROTO ((const unsigned char *, unsigned));
+struct lease *find_lease_by_hw_addr PROTO ((const unsigned char *, unsigned));
struct lease *find_lease_by_ip_addr PROTO ((struct iaddr));
void uid_hash_add PROTO ((struct lease *));
void uid_hash_delete PROTO ((struct lease *));
diff --git a/includes/hash.h b/includes/hash.h
index 6fd1aeaf..ce4ac47c 100644
--- a/includes/hash.h
+++ b/includes/hash.h
@@ -24,18 +24,18 @@
struct hash_bucket {
struct hash_bucket *next;
- unsigned char *name;
- int len;
+ const unsigned char *name;
+ unsigned len;
unsigned char *value;
};
struct hash_table {
- int hash_count;
+ unsigned hash_count;
struct hash_bucket *buckets [DEFAULT_HASH_SIZE];
};
struct named_hash {
struct named_hash *next;
- char *name;
+ const char *name;
struct hash_table *hash;
};
diff --git a/includes/inet.h b/includes/inet.h
index cde1822a..5a247d4a 100644
--- a/includes/inet.h
+++ b/includes/inet.h
@@ -23,7 +23,7 @@
/* An internet address of up to 128 bits. */
struct iaddr {
- int len;
+ unsigned len;
unsigned char iabuf [16];
};
diff --git a/includes/isc/result.h b/includes/isc/result.h
index 6c589905..71d60125 100644
--- a/includes/isc/result.h
+++ b/includes/isc/result.h
@@ -75,7 +75,7 @@ ISC_LANG_BEGINDECLS
#define ISC_R_NRESULTS 47 /* Number of results */
-char * isc_result_totext(isc_result_t);
+const char * isc_result_totext(isc_result_t);
isc_result_t isc_result_register(unsigned int base,
unsigned int nresults,
char **text,
diff --git a/includes/omapip/alloc.h b/includes/omapip/alloc.h
index 62717073..5cbcc6fd 100644
--- a/includes/omapip/alloc.h
+++ b/includes/omapip/alloc.h
@@ -21,23 +21,26 @@
*/
isc_result_t omapi_object_reference (omapi_object_t **,
- omapi_object_t *, char *);
-isc_result_t omapi_object_dereference (omapi_object_t **, char *);
+ omapi_object_t *, const char *);
+isc_result_t omapi_object_dereference (omapi_object_t **, const char *);
-isc_result_t omapi_buffer_new (omapi_buffer_t **, char *);
+isc_result_t omapi_buffer_new (omapi_buffer_t **, const char *);
isc_result_t omapi_buffer_reference (omapi_buffer_t **,
- omapi_buffer_t *, char *);
-isc_result_t omapi_buffer_dereference (omapi_buffer_t **, char *);
+ omapi_buffer_t *, const char *);
+isc_result_t omapi_buffer_dereference (omapi_buffer_t **, const char *);
isc_result_t omapi_typed_data_new (omapi_typed_data_t **,
omapi_datatype_t, ...);
isc_result_t omapi_typed_data_reference (omapi_typed_data_t **,
- omapi_typed_data_t *, char *);
-isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **, char *);
-isc_result_t omapi_data_string_new (omapi_data_string_t **, int, char *);
+ omapi_typed_data_t *, const char *);
+isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **,
+ const char *);
+isc_result_t omapi_data_string_new (omapi_data_string_t **,
+ unsigned, const char *);
isc_result_t omapi_data_string_reference (omapi_data_string_t **,
- omapi_data_string_t *, char *);
-isc_result_t omapi_data_string_dereference (omapi_data_string_t **, char *);
-isc_result_t omapi_value_new (omapi_value_t **, char *);
+ omapi_data_string_t *, const char *);
+isc_result_t omapi_data_string_dereference (omapi_data_string_t **,
+ const char *);
+isc_result_t omapi_value_new (omapi_value_t **, const char *);
isc_result_t omapi_value_reference (omapi_value_t **,
- omapi_value_t *, char *);
-isc_result_t omapi_value_dereference (omapi_value_t **, char *);
+ omapi_value_t *, const char *);
+isc_result_t omapi_value_dereference (omapi_value_t **, const char *);
diff --git a/includes/omapip/buffer.h b/includes/omapip/buffer.h
index 132dc9fc..5b844519 100644
--- a/includes/omapip/buffer.h
+++ b/includes/omapip/buffer.h
@@ -53,14 +53,14 @@ typedef struct _omapi_buffer {
? (x) -> tail - (x) -> head \
: sizeof ((x) -> buf) - ((x) -> head - (x) -> tail)) - 1)
-isc_result_t omapi_connection_require (omapi_object_t *, int);
+isc_result_t omapi_connection_require (omapi_object_t *, unsigned);
isc_result_t omapi_connection_copyout (unsigned char *,
- omapi_object_t *, int);
+ omapi_object_t *, unsigned);
isc_result_t omapi_connection_copyin (omapi_object_t *,
- unsigned char *, int);
+ const unsigned char *, unsigned);
isc_result_t omapi_connection_flush (omapi_object_t *);
isc_result_t omapi_connection_get_uint32 (omapi_object_t *, u_int32_t *);
isc_result_t omapi_connection_put_uint32 (omapi_object_t *, u_int32_t);
isc_result_t omapi_connection_get_uint16 (omapi_object_t *, u_int16_t *);
-isc_result_t omapi_connection_put_uint16 (omapi_object_t *, u_int16_t);
+isc_result_t omapi_connection_put_uint16 (omapi_object_t *, u_int32_t);
diff --git a/includes/omapip/omapip.h b/includes/omapip/omapip.h
index e498d920..25a6f9c9 100644
--- a/includes/omapip/omapip.h
+++ b/includes/omapip/omapip.h
@@ -58,13 +58,13 @@ typedef u_int32_t omapi_handle_t;
/* OMAPI protocol header, version 1.00 */
typedef struct {
- int authlen; /* Length of authenticator. */
- int authid; /* Authenticator object ID. */
- int op; /* Opcode. */
+ unsigned authlen; /* Length of authenticator. */
+ unsigned authid; /* Authenticator object ID. */
+ unsigned op; /* Opcode. */
omapi_handle_t handle; /* Handle of object being operated on,
or zero. */
- int id; /* Transaction ID. */
- int rid; /* ID of transaction to which this is a response. */
+ unsigned id; /* Transaction ID. */
+ unsigned rid; /* ID of transaction to which this is a response. */
} omapi_protocol_header_t;
struct __omapi_object;
@@ -82,7 +82,7 @@ typedef struct {
omapi_datatype_t type;
union {
struct {
- int len;
+ unsigned len;
#define OMAPI_TYPED_DATA_NOBUFFER_LEN (sizeof (int) + \
sizeof (omapi_datatype_t) + \
sizeof (int))
@@ -110,7 +110,7 @@ typedef struct {
typedef struct {
int refcnt;
- int len;
+ unsigned len;
#define OMAPI_DATA_STRING_EMPTY_SIZE (2 * sizeof (int))
u_int8_t value [1];
} omapi_data_string_t;
@@ -122,7 +122,7 @@ typedef struct {
} omapi_value_t;
typedef struct __omapi_object_type_t {
- char *name;
+ const char *name;
struct __omapi_object_type_t *next;
isc_result_t (*set_value) (omapi_object_t *, omapi_object_t *,
@@ -131,8 +131,9 @@ typedef struct __omapi_object_type_t {
isc_result_t (*get_value) (omapi_object_t *,
omapi_object_t *,
omapi_data_string_t *, omapi_value_t **);
- isc_result_t (*destroy) (omapi_object_t *, char *);
- isc_result_t (*signal_handler) (omapi_object_t *, char *, va_list);
+ isc_result_t (*destroy) (omapi_object_t *, const char *);
+ isc_result_t (*signal_handler) (omapi_object_t *,
+ const char *, va_list);
isc_result_t (*stuff_values) (omapi_object_t *,
omapi_object_t *, omapi_object_t *);
isc_result_t (*lookup) (omapi_object_t **, omapi_object_t *,
@@ -187,20 +188,20 @@ typedef struct __omapi_message_object {
struct __omapi_message_object *next, *prev;
omapi_object_t *object;
omapi_object_t *notify_object;
- int authlen;
+ unsigned authlen;
omapi_typed_data_t *authenticator;
- int authid;
+ unsigned authid;
omapi_object_t *id_object;
- int op;
+ unsigned op;
omapi_handle_t h;
- int id;
- int rid;
+ unsigned id;
+ unsigned rid;
} omapi_message_object_t;
typedef struct {
OMAPI_OBJECT_PREAMBLE;
- int header_size;
- int protocol_version;
+ unsigned header_size;
+ unsigned protocol_version;
u_int32_t next_xid;
omapi_object_t *authinfo; /* Default authinfo to use. */
@@ -274,10 +275,10 @@ typedef struct __omapi_handle_table {
#include <omapip/alloc.h>
isc_result_t omapi_protocol_connect (omapi_object_t *,
- char *, int, omapi_object_t *);
+ const char *, int, omapi_object_t *);
isc_result_t omapi_protocol_listen (omapi_object_t *, int, int);
isc_result_t omapi_protocol_accept (omapi_object_t *);
-isc_result_t omapi_protocol_send_intro (omapi_object_t *, int, int);
+isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned);
isc_result_t omapi_protocol_ready (omapi_object_t *);
isc_result_t omapi_protocol_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
@@ -289,12 +290,13 @@ isc_result_t omapi_protocol_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
-isc_result_t omapi_protocol_destroy (omapi_object_t *, char *);
+isc_result_t omapi_protocol_destroy (omapi_object_t *, const char *);
isc_result_t omapi_protocol_send_message (omapi_object_t *,
omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
-isc_result_t omapi_protocol_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t omapi_protocol_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t omapi_protocol_listener_set_value (omapi_object_t *,
omapi_object_t *,
omapi_data_string_t *,
@@ -303,18 +305,18 @@ isc_result_t omapi_protocol_listener_get_value (omapi_object_t *,
omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t omapi_protocol_listener_destroy (omapi_object_t *, char *);
+isc_result_t omapi_protocol_listener_destroy (omapi_object_t *, const char *);
isc_result_t omapi_protocol_listener_signal (omapi_object_t *,
- char *, va_list);
+ const char *, va_list);
isc_result_t omapi_protocol_listener_stuff (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
isc_result_t omapi_protocol_send_status (omapi_object_t *, omapi_object_t *,
- isc_result_t, int, char *);
+ isc_result_t, unsigned, const char *);
isc_result_t omapi_protocol_send_update (omapi_object_t *, omapi_object_t *,
- int, omapi_object_t *);
+ unsigned, omapi_object_t *);
-isc_result_t omapi_connect (omapi_object_t *, char *, int);
+isc_result_t omapi_connect (omapi_object_t *, const char *, int);
isc_result_t omapi_disconnect (omapi_object_t *, int);
int omapi_connection_readfd (omapi_object_t *);
int omapi_connection_writefd (omapi_object_t *);
@@ -327,16 +329,16 @@ isc_result_t omapi_connection_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t omapi_connection_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t omapi_connection_destroy (omapi_object_t *, char *);
+isc_result_t omapi_connection_destroy (omapi_object_t *, const char *);
isc_result_t omapi_connection_signal_handler (omapi_object_t *,
- char *, va_list);
+ const char *, va_list);
isc_result_t omapi_connection_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
isc_result_t omapi_connection_write_typed_data (omapi_object_t *,
omapi_typed_data_t *);
-isc_result_t omapi_connection_put_name (omapi_object_t *, char *);
-isc_result_t omapi_connection_put_string (omapi_object_t *, char *);
+isc_result_t omapi_connection_put_name (omapi_object_t *, const char *);
+isc_result_t omapi_connection_put_string (omapi_object_t *, const char *);
isc_result_t omapi_connection_put_handle (omapi_object_t *c,
omapi_object_t *h);
@@ -351,8 +353,9 @@ isc_result_t omapi_listener_set_value (omapi_object_t *, omapi_object_t *,
isc_result_t omapi_listener_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t omapi_listener_destroy (omapi_object_t *, char *);
-isc_result_t omapi_listener_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t omapi_listener_destroy (omapi_object_t *, const char *);
+isc_result_t omapi_listener_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t omapi_listener_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -371,35 +374,38 @@ isc_result_t omapi_io_set_value (omapi_object_t *, omapi_object_t *,
omapi_typed_data_t *);
isc_result_t omapi_io_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *, omapi_value_t **);
-isc_result_t omapi_io_destroy (omapi_object_t *, char *);
-isc_result_t omapi_io_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t omapi_io_destroy (omapi_object_t *, const char *);
+isc_result_t omapi_io_signal_handler (omapi_object_t *, const char *, va_list);
isc_result_t omapi_io_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
-isc_result_t omapi_waiter_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t omapi_waiter_signal_handler (omapi_object_t *,
+ const char *, va_list);
-isc_result_t omapi_generic_new (omapi_object_t **, char *);
+isc_result_t omapi_generic_new (omapi_object_t **, const char *);
isc_result_t omapi_generic_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_typed_data_t *);
isc_result_t omapi_generic_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t omapi_generic_destroy (omapi_object_t *, char *);
-isc_result_t omapi_generic_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t omapi_generic_destroy (omapi_object_t *, const char *);
+isc_result_t omapi_generic_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t omapi_generic_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
-isc_result_t omapi_message_new (omapi_object_t **, char *);
+isc_result_t omapi_message_new (omapi_object_t **, const char *);
isc_result_t omapi_message_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_typed_data_t *);
isc_result_t omapi_message_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
-isc_result_t omapi_message_destroy (omapi_object_t *, char *);
-isc_result_t omapi_message_signal_handler (omapi_object_t *, char *, va_list);
+isc_result_t omapi_message_destroy (omapi_object_t *, const char *);
+isc_result_t omapi_message_signal_handler (omapi_object_t *,
+ const char *, va_list);
isc_result_t omapi_message_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -421,7 +427,7 @@ extern omapi_object_type_t *omapi_object_types;
isc_result_t omapi_init (void);
isc_result_t omapi_object_type_register (omapi_object_type_t **,
- char *,
+ const char *,
isc_result_t (*)
(omapi_object_t *,
omapi_object_t *,
@@ -433,9 +439,10 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **,
omapi_data_string_t *,
omapi_value_t **),
isc_result_t (*) (omapi_object_t *,
- char *),
+ const char *),
isc_result_t (*) (omapi_object_t *,
- char *, va_list),
+ const char *,
+ va_list),
isc_result_t (*) (omapi_object_t *,
omapi_object_t *,
omapi_object_t *),
@@ -446,26 +453,26 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **,
omapi_object_t *),
isc_result_t (*) (omapi_object_t *,
omapi_object_t *));
-isc_result_t omapi_signal (omapi_object_t *, char *, ...);
-isc_result_t omapi_signal_in (omapi_object_t *, char *, ...);
+isc_result_t omapi_signal (omapi_object_t *, const char *, ...);
+isc_result_t omapi_signal_in (omapi_object_t *, const char *, ...);
isc_result_t omapi_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_typed_data_t *);
isc_result_t omapi_set_value_str (omapi_object_t *, omapi_object_t *,
- char *, omapi_typed_data_t *);
+ const char *, omapi_typed_data_t *);
isc_result_t omapi_set_boolean_value (omapi_object_t *, omapi_object_t *,
- char *, int);
+ const char *, int);
isc_result_t omapi_set_int_value (omapi_object_t *, omapi_object_t *,
- char *, int);
+ const char *, int);
isc_result_t omapi_set_object_value (omapi_object_t *, omapi_object_t *,
- char *, omapi_object_t *);
+ const char *, omapi_object_t *);
isc_result_t omapi_set_string_value (omapi_object_t *, omapi_object_t *,
- char *, char *);
+ const char *, const char *);
isc_result_t omapi_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
isc_result_t omapi_get_value_str (omapi_object_t *, omapi_object_t *,
- char *, omapi_value_t **);
+ const char *, omapi_value_t **);
isc_result_t omapi_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
@@ -474,18 +481,18 @@ isc_result_t omapi_object_create (omapi_object_t **, omapi_object_t *,
isc_result_t omapi_object_update (omapi_object_t *, omapi_object_t *,
omapi_object_t *, omapi_handle_t);
int omapi_data_string_cmp (omapi_data_string_t *, omapi_data_string_t *);
-int omapi_ds_strcmp (omapi_data_string_t *, char *);
-int omapi_td_strcmp (omapi_typed_data_t *, char *);
+int omapi_ds_strcmp (omapi_data_string_t *, const char *);
+int omapi_td_strcmp (omapi_typed_data_t *, const char *);
isc_result_t omapi_make_value (omapi_value_t **, omapi_data_string_t *,
- omapi_typed_data_t *, char *);
+ omapi_typed_data_t *, const char *);
isc_result_t omapi_make_const_value (omapi_value_t **, omapi_data_string_t *,
- u_int8_t *, int, char *);
+ const u_int8_t *, unsigned, const char *);
isc_result_t omapi_make_int_value (omapi_value_t **, omapi_data_string_t *,
- int, char *);
+ int, const char *);
isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *,
- omapi_object_t *, char *);
+ omapi_object_t *, const char *);
isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *,
- char *, char *);
+ char *, const char *);
isc_result_t omapi_get_int_value (u_int32_t *, omapi_typed_data_t *);
diff --git a/includes/tree.h b/includes/tree.h
index 1e225f07..51da51d0 100644
--- a/includes/tree.h
+++ b/includes/tree.h
@@ -50,8 +50,8 @@ struct buffer {
/* A string of data bytes, possibly accompanied by a larger buffer. */
struct data_string {
struct buffer *buffer;
- unsigned char *data;
- int len; /* Does not include NUL terminator, if any. */
+ const unsigned char *data;
+ unsigned len; /* Does not include NUL terminator, if any. */
int terminated;
};
@@ -169,16 +169,16 @@ struct decoded_option_state; /* forward */
struct lease; /* forward */
struct universe {
- char *name;
+ const char *name;
struct option_cache *(*lookup_func) PROTO ((struct universe *,
struct option_state *,
- int));
+ unsigned));
void (*save_func) PROTO ((struct universe *, struct option_state *,
struct option_cache *));
int (*get_func) PROTO ((struct data_string *, struct universe *,
struct packet *, struct lease *,
struct option_state *, struct option_state *,
- struct option_state *, int));
+ struct option_state *, unsigned));
void (*set_func) PROTO ((struct universe *, struct option_state *,
struct option_cache *, enum statement_op));
@@ -198,10 +198,10 @@ struct universe {
};
struct option {
- char *name;
- char *format;
+ const char *name;
+ const char *format;
struct universe *universe;
- int code;
+ unsigned code;
};
enum expression_context {
diff --git a/omapip/alloc.c b/omapip/alloc.c
index 6c7410fb..8d93751b 100644
--- a/omapip/alloc.c
+++ b/omapip/alloc.c
@@ -25,7 +25,7 @@
isc_result_t omapi_object_reference (omapi_object_t **r,
omapi_object_t *h,
- char *name)
+ const char *name)
{
if (!h || !r)
return ISC_R_INVALIDARG;
@@ -43,7 +43,7 @@ isc_result_t omapi_object_reference (omapi_object_t **r,
}
isc_result_t omapi_object_dereference (omapi_object_t **h,
- char *name)
+ const char *name)
{
int outer_reference = 0;
int inner_reference = 0;
@@ -139,7 +139,7 @@ isc_result_t omapi_object_dereference (omapi_object_t **h,
}
isc_result_t omapi_buffer_new (omapi_buffer_t **h,
- char *name)
+ const char *name)
{
omapi_buffer_t *t;
isc_result_t status;
@@ -156,7 +156,7 @@ isc_result_t omapi_buffer_new (omapi_buffer_t **h,
isc_result_t omapi_buffer_reference (omapi_buffer_t **r,
omapi_buffer_t *h,
- char *name)
+ const char *name)
{
if (!h || !r)
return ISC_R_INVALIDARG;
@@ -174,7 +174,7 @@ isc_result_t omapi_buffer_reference (omapi_buffer_t **r,
}
isc_result_t omapi_buffer_dereference (omapi_buffer_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
@@ -205,8 +205,9 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
{
va_list l;
omapi_typed_data_t *new;
- int len;
- int val;
+ unsigned len;
+ unsigned val;
+ int intval;
char *s;
isc_result_t status;
@@ -215,7 +216,7 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
switch (type) {
case omapi_datatype_int:
len = OMAPI_TYPED_DATA_INT_LEN;
- val = va_arg (l, int);
+ intval = va_arg (l, int);
break;
case omapi_datatype_string:
s = va_arg (l, char *);
@@ -223,7 +224,7 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
len = OMAPI_TYPED_DATA_NOBUFFER_LEN + val;
break;
case omapi_datatype_data:
- val = va_arg (l, int);
+ val = va_arg (l, unsigned);
len = OMAPI_TYPED_DATA_NOBUFFER_LEN + val;
break;
case omapi_datatype_object:
@@ -240,7 +241,7 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
switch (type) {
case omapi_datatype_int:
- new -> u.integer = val;
+ new -> u.integer = intval;
break;
case omapi_datatype_string:
memcpy (new -> u.buffer.value, s, val);
@@ -265,7 +266,7 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
isc_result_t omapi_typed_data_reference (omapi_typed_data_t **r,
omapi_typed_data_t *h,
- char *name)
+ const char *name)
{
if (!h || !r)
return ISC_R_INVALIDARG;
@@ -283,7 +284,7 @@ isc_result_t omapi_typed_data_reference (omapi_typed_data_t **r,
}
isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
@@ -323,7 +324,7 @@ isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h,
}
isc_result_t omapi_data_string_new (omapi_data_string_t **d,
- int len, char *name)
+ unsigned len, const char *name)
{
omapi_data_string_t *new;
@@ -337,7 +338,7 @@ isc_result_t omapi_data_string_new (omapi_data_string_t **d,
isc_result_t omapi_data_string_reference (omapi_data_string_t **r,
omapi_data_string_t *h,
- char *name)
+ const char *name)
{
if (!h || !r)
return ISC_R_INVALIDARG;
@@ -355,7 +356,7 @@ isc_result_t omapi_data_string_reference (omapi_data_string_t **r,
}
isc_result_t omapi_data_string_dereference (omapi_data_string_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
@@ -384,7 +385,7 @@ isc_result_t omapi_data_string_dereference (omapi_data_string_t **h,
}
isc_result_t omapi_value_new (omapi_value_t **d,
- char *name)
+ const char *name)
{
omapi_value_t *new;
@@ -397,7 +398,7 @@ isc_result_t omapi_value_new (omapi_value_t **d,
isc_result_t omapi_value_reference (omapi_value_t **r,
omapi_value_t *h,
- char *name)
+ const char *name)
{
if (!h || !r)
return ISC_R_INVALIDARG;
@@ -415,7 +416,7 @@ isc_result_t omapi_value_reference (omapi_value_t **r,
}
isc_result_t omapi_value_dereference (omapi_value_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
diff --git a/omapip/buffer.c b/omapip/buffer.c
index 5c6f99c2..25c3b351 100644
--- a/omapip/buffer.c
+++ b/omapip/buffer.c
@@ -29,9 +29,10 @@ isc_result_t omapi_connection_reader (omapi_object_t *h)
{
omapi_buffer_t *buffer;
isc_result_t status;
- int read_len, read_status;
+ unsigned read_len;
+ int read_status;
omapi_connection_object_t *c;
- int bytes_to_read;
+ unsigned bytes_to_read;
if (!h || h -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
@@ -110,13 +111,13 @@ isc_result_t omapi_connection_reader (omapi_object_t *h)
/* Put some bytes into the output buffer for a connection. */
isc_result_t omapi_connection_copyin (omapi_object_t *h,
- unsigned char *bufp,
- int len)
+ const unsigned char *bufp,
+ unsigned len)
{
omapi_buffer_t *buffer;
isc_result_t status;
int bytes_copied = 0;
- int copy_len;
+ unsigned copy_len;
omapi_connection_object_t *c;
/* Make sure len is valid. */
@@ -173,10 +174,10 @@ isc_result_t omapi_connection_copyin (omapi_object_t *h,
isc_result_t omapi_connection_copyout (unsigned char *buf,
omapi_object_t *h,
- int size)
+ unsigned size)
{
- int bytes_remaining;
- int bytes_this_copy;
+ unsigned bytes_remaining;
+ unsigned bytes_this_copy;
omapi_buffer_t *buffer;
unsigned char *bufp;
omapi_connection_object_t *c;
@@ -246,8 +247,8 @@ isc_result_t omapi_connection_copyout (unsigned char *buf,
isc_result_t omapi_connection_writer (omapi_object_t *h)
{
- int bytes_this_write;
- int bytes_written;
+ unsigned bytes_this_write;
+ unsigned bytes_written;
omapi_buffer_t *buffer;
unsigned char *bufp;
omapi_connection_object_t *c;
@@ -383,7 +384,7 @@ isc_result_t omapi_connection_get_uint16 (omapi_object_t *c,
}
isc_result_t omapi_connection_put_uint16 (omapi_object_t *c,
- u_int16_t value)
+ u_int32_t value)
{
u_int16_t inbuf;
isc_result_t status;
@@ -405,7 +406,8 @@ isc_result_t omapi_connection_write_typed_data (omapi_object_t *c,
status = omapi_connection_put_uint32 (c, sizeof (u_int32_t));
if (status != ISC_R_SUCCESS)
return status;
- return omapi_connection_put_uint32 (c, data -> u.integer);
+ return omapi_connection_put_uint32 (c, ((u_int32_t)
+ (data -> u.integer)));
case omapi_datatype_string:
case omapi_datatype_data:
@@ -429,28 +431,29 @@ isc_result_t omapi_connection_write_typed_data (omapi_object_t *c,
return ISC_R_INVALIDARG;
}
-isc_result_t omapi_connection_put_name (omapi_object_t *c, char *name)
+isc_result_t omapi_connection_put_name (omapi_object_t *c, const char *name)
{
isc_result_t status;
- int len = strlen (name);
+ unsigned len = strlen (name);
status = omapi_connection_put_uint16 (c, len);
if (status != ISC_R_SUCCESS)
return status;
- return omapi_connection_copyin (c, (unsigned char *)name, len);
+ return omapi_connection_copyin (c, (const unsigned char *)name, len);
}
-isc_result_t omapi_connection_put_string (omapi_object_t *c, char *string)
+isc_result_t omapi_connection_put_string (omapi_object_t *c,
+ const char *string)
{
isc_result_t status;
- int len;
+ unsigned len;
len = strlen (string);
status = omapi_connection_put_uint32 (c, len);
if (status != ISC_R_SUCCESS)
return status;
- return omapi_connection_copyin (c, (unsigned char *)string, len);
+ return omapi_connection_copyin (c, (const unsigned char *)string, len);
}
isc_result_t omapi_connection_put_handle (omapi_object_t *c, omapi_object_t *h)
diff --git a/omapip/connection.c b/omapip/connection.c
index d0890bbe..7916fe32 100644
--- a/omapip/connection.c
+++ b/omapip/connection.c
@@ -23,7 +23,7 @@
#include <omapip/omapip.h>
isc_result_t omapi_connect (omapi_object_t *c,
- char *server_name,
+ const char *server_name,
int port)
{
struct hostent *he;
@@ -196,7 +196,7 @@ isc_result_t omapi_disconnect (omapi_object_t *h,
return ISC_R_SUCCESS;
}
-isc_result_t omapi_connection_require (omapi_object_t *h, int bytes)
+isc_result_t omapi_connection_require (omapi_object_t *h, unsigned bytes)
{
omapi_connection_object_t *c;
@@ -292,7 +292,7 @@ isc_result_t omapi_connection_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_connection_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_connection_destroy (omapi_object_t *h, const char *name)
{
omapi_connection_object_t *c;
@@ -307,7 +307,7 @@ isc_result_t omapi_connection_destroy (omapi_object_t *h, char *name)
}
isc_result_t omapi_connection_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
if (h -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
diff --git a/omapip/dispatch.c b/omapip/dispatch.c
index ea238700..257a1a40 100644
--- a/omapip/dispatch.c
+++ b/omapip/dispatch.c
@@ -342,7 +342,7 @@ isc_result_t omapi_io_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_io_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_io_destroy (omapi_object_t *h, const char *name)
{
if (h -> type != omapi_type_io_object)
return ISC_R_INVALIDARG;
@@ -350,7 +350,7 @@ isc_result_t omapi_io_destroy (omapi_object_t *h, char *name)
}
isc_result_t omapi_io_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
if (h -> type != omapi_type_io_object)
return ISC_R_INVALIDARG;
@@ -375,7 +375,7 @@ isc_result_t omapi_io_stuff_values (omapi_object_t *c,
}
isc_result_t omapi_waiter_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
omapi_waiter_object_t *waiter;
diff --git a/omapip/generic.c b/omapip/generic.c
index 7cc43676..4f19b736 100644
--- a/omapip/generic.c
+++ b/omapip/generic.c
@@ -22,7 +22,7 @@
#include <omapip/omapip.h>
-isc_result_t omapi_generic_new (omapi_object_t **gen, char *name)
+isc_result_t omapi_generic_new (omapi_object_t **gen, const char *name)
{
omapi_generic_object_t *obj;
@@ -173,7 +173,7 @@ isc_result_t omapi_generic_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_generic_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_generic_destroy (omapi_object_t *h, const char *name)
{
omapi_generic_object_t *g;
int i;
@@ -197,7 +197,7 @@ isc_result_t omapi_generic_destroy (omapi_object_t *h, char *name)
}
isc_result_t omapi_generic_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
if (h -> type != omapi_type_generic)
return ISC_R_INVALIDARG;
diff --git a/omapip/listener.c b/omapip/listener.c
index b83cbdd2..dea6e616 100644
--- a/omapip/listener.c
+++ b/omapip/listener.c
@@ -123,7 +123,7 @@ isc_result_t omapi_accept (omapi_object_t *h)
omapi_listener_object_t *listener;
if (h -> type != omapi_type_listener)
- return -1;
+ return ISC_R_INVALIDARG;
listener = (omapi_listener_object_t *)h;
/* Get the handle. */
@@ -201,7 +201,7 @@ isc_result_t omapi_listener_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_listener_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_listener_destroy (omapi_object_t *h, const char *name)
{
omapi_listener_object_t *l;
@@ -217,7 +217,7 @@ isc_result_t omapi_listener_destroy (omapi_object_t *h, char *name)
}
isc_result_t omapi_listener_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
if (h -> type != omapi_type_listener)
return ISC_R_INVALIDARG;
diff --git a/omapip/message.c b/omapip/message.c
index e3c49f89..4efdcae2 100644
--- a/omapip/message.c
+++ b/omapip/message.c
@@ -24,7 +24,7 @@
omapi_message_object_t *omapi_registered_messages;
-isc_result_t omapi_message_new (omapi_object_t **o, char *name)
+isc_result_t omapi_message_new (omapi_object_t **o, const char *name)
{
omapi_message_object_t *m;
omapi_object_t *g;
@@ -175,7 +175,7 @@ isc_result_t omapi_message_get_value (omapi_object_t *h,
/* Look for values that are in the message data structure. */
if (!omapi_ds_strcmp (name, "authlen"))
- return omapi_make_int_value (value, name, m -> authlen,
+ return omapi_make_int_value (value, name, (int)m -> authlen,
"omapi_message_get_value");
else if (!omapi_ds_strcmp (name, "authenticator")) {
if (m -> authenticator)
@@ -185,19 +185,19 @@ isc_result_t omapi_message_get_value (omapi_object_t *h,
else
return ISC_R_NOTFOUND;
} else if (!omapi_ds_strcmp (name, "authid")) {
- return omapi_make_int_value (value, name, m -> authid,
+ return omapi_make_int_value (value, name, (int)m -> authid,
"omapi_message_get_value");
} else if (!omapi_ds_strcmp (name, "op")) {
- return omapi_make_int_value (value, name, m -> op,
+ return omapi_make_int_value (value, name, (int)m -> op,
"omapi_message_get_value");
} else if (!omapi_ds_strcmp (name, "handle")) {
- return omapi_make_int_value (value, name, m -> handle,
+ return omapi_make_int_value (value, name, (int)m -> handle,
"omapi_message_get_value");
} else if (!omapi_ds_strcmp (name, "id")) {
- return omapi_make_int_value (value, name, m -> id,
+ return omapi_make_int_value (value, name, (int)m -> id,
"omapi_message_get_value");
} else if (!omapi_ds_strcmp (name, "rid")) {
- return omapi_make_int_value (value, name, m -> rid,
+ return omapi_make_int_value (value, name, (int)m -> rid,
"omapi_message_get_value");
}
@@ -208,7 +208,7 @@ isc_result_t omapi_message_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_message_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_message_destroy (omapi_object_t *h, const char *name)
{
int i;
@@ -234,7 +234,7 @@ isc_result_t omapi_message_destroy (omapi_object_t *h, char *name)
}
isc_result_t omapi_message_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
omapi_message_object_t *m;
if (h -> type != omapi_type_message)
diff --git a/omapip/protocol.c b/omapip/protocol.c
index 95d80b09..71690f44 100644
--- a/omapip/protocol.c
+++ b/omapip/protocol.c
@@ -23,7 +23,7 @@
#include <omapip/omapip.h>
isc_result_t omapi_protocol_connect (omapi_object_t *h,
- char *server_name,
+ const char *server_name,
int port,
omapi_object_t *authinfo)
{
@@ -78,8 +78,8 @@ isc_result_t omapi_protocol_connect (omapi_object_t *h,
/* Send the protocol introduction message. */
isc_result_t omapi_protocol_send_intro (omapi_object_t *h,
- int ver,
- int hsize)
+ unsigned ver,
+ unsigned hsize)
{
isc_result_t status;
omapi_protocol_object_t *p;
@@ -223,7 +223,7 @@ isc_result_t omapi_protocol_send_message (omapi_object_t *po,
isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
isc_result_t status;
omapi_protocol_object_t *p;
@@ -518,7 +518,7 @@ isc_result_t omapi_protocol_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_protocol_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_protocol_destroy (omapi_object_t *h, const char *name)
{
omapi_protocol_object_t *p;
if (h -> type != omapi_type_protocol)
@@ -592,7 +592,7 @@ isc_result_t omapi_protocol_listen (omapi_object_t *h,
create a new protocol connection, otherwise pass the signal down. */
isc_result_t omapi_protocol_listener_signal (omapi_object_t *o,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
isc_result_t status;
omapi_object_t *c;
@@ -677,7 +677,8 @@ isc_result_t omapi_protocol_listener_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
-isc_result_t omapi_protocol_listener_destroy (omapi_object_t *h, char *name)
+isc_result_t omapi_protocol_listener_destroy (omapi_object_t *h,
+ const char *name)
{
if (h -> type != omapi_type_protocol_listener)
return ISC_R_INVALIDARG;
@@ -705,7 +706,7 @@ isc_result_t omapi_protocol_listener_stuff (omapi_object_t *c,
isc_result_t omapi_protocol_send_status (omapi_object_t *po,
omapi_object_t *id,
isc_result_t waitstatus,
- int rid, char *msg)
+ unsigned rid, const char *msg)
{
isc_result_t status;
omapi_object_t *message = (omapi_object_t *)0;
@@ -726,7 +727,7 @@ isc_result_t omapi_protocol_send_status (omapi_object_t *po,
}
status = omapi_set_int_value (message, (omapi_object_t *)0,
- "rid", rid);
+ "rid", (int)rid);
if (status != ISC_R_SUCCESS) {
omapi_object_dereference (&message,
"omapi_protocol_send_status");
@@ -734,7 +735,7 @@ isc_result_t omapi_protocol_send_status (omapi_object_t *po,
}
status = omapi_set_int_value (message, (omapi_object_t *)0,
- "result", waitstatus);
+ "result", (int)waitstatus);
if (status != ISC_R_SUCCESS) {
omapi_object_dereference (&message,
"omapi_protocol_send_status");
@@ -758,7 +759,7 @@ isc_result_t omapi_protocol_send_status (omapi_object_t *po,
isc_result_t omapi_protocol_send_update (omapi_object_t *po,
omapi_object_t *id,
- int rid,
+ unsigned rid,
omapi_object_t *object)
{
isc_result_t status;
@@ -782,7 +783,7 @@ isc_result_t omapi_protocol_send_update (omapi_object_t *po,
if (rid) {
omapi_handle_t handle;
status = omapi_set_int_value (message, (omapi_object_t *)0,
- "rid", rid);
+ "rid", (int)rid);
if (status != ISC_R_SUCCESS) {
omapi_object_dereference
(&message, "omapi_protocol_send_update");
@@ -796,7 +797,7 @@ isc_result_t omapi_protocol_send_update (omapi_object_t *po,
return status;
}
status = omapi_set_int_value (message, (omapi_object_t *)0,
- "handle", handle);
+ "handle", (int)handle);
if (status != ISC_R_SUCCESS) {
omapi_object_dereference
(&message, "omapi_protocol_send_update");
diff --git a/omapip/result.c b/omapip/result.c
index 1d4e52a2..57660d89 100644
--- a/omapip/result.c
+++ b/omapip/result.c
@@ -23,7 +23,7 @@
#include <omapip/omapip.h>
-static char *text[ISC_R_NRESULTS] = {
+static const char *text[ISC_R_NRESULTS] = {
"success", /* 0 */
"out of memory", /* 1 */
"timed out", /* 2 */
@@ -73,7 +73,7 @@ static char *text[ISC_R_NRESULTS] = {
"no key specified", /* 46 */
};
-char *isc_result_totext (isc_result_t result)
+const char *isc_result_totext (isc_result_t result)
{
if (result >= ISC_R_SUCCESS && result < ISC_R_NRESULTS)
return text [result];
diff --git a/omapip/support.c b/omapip/support.c
index ed472cf4..a438c73e 100644
--- a/omapip/support.c
+++ b/omapip/support.c
@@ -134,7 +134,7 @@ isc_result_t omapi_init (void)
}
isc_result_t omapi_object_type_register (omapi_object_type_t **type,
- char *name,
+ const char *name,
isc_result_t (*set_value)
(omapi_object_t *,
omapi_object_t *,
@@ -146,10 +146,11 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **type,
omapi_data_string_t *,
omapi_value_t **),
isc_result_t (*destroy)
- (omapi_object_t *, char *),
+ (omapi_object_t *,
+ const char *),
isc_result_t (*signal_handler)
(omapi_object_t *,
- char *, va_list),
+ const char *, va_list),
isc_result_t (*stuff_values)
(omapi_object_t *,
omapi_object_t *,
@@ -188,7 +189,7 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **type,
return ISC_R_SUCCESS;
}
-isc_result_t omapi_signal (omapi_object_t *handle, char *name, ...)
+isc_result_t omapi_signal (omapi_object_t *handle, const char *name, ...)
{
va_list ap;
omapi_object_t *outer;
@@ -206,7 +207,7 @@ isc_result_t omapi_signal (omapi_object_t *handle, char *name, ...)
return status;
}
-isc_result_t omapi_signal_in (omapi_object_t *handle, char *name, ...)
+isc_result_t omapi_signal_in (omapi_object_t *handle, const char *name, ...)
{
va_list ap;
omapi_object_t *outer;
@@ -242,7 +243,7 @@ isc_result_t omapi_set_value (omapi_object_t *h,
isc_result_t omapi_set_value_str (omapi_object_t *h,
omapi_object_t *id,
- char *name,
+ const char *name,
omapi_typed_data_t *value)
{
omapi_object_t *outer;
@@ -260,7 +261,7 @@ isc_result_t omapi_set_value_str (omapi_object_t *h,
}
isc_result_t omapi_set_boolean_value (omapi_object_t *h, omapi_object_t *id,
- char *name, int value)
+ const char *name, int value)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -288,7 +289,7 @@ isc_result_t omapi_set_boolean_value (omapi_object_t *h, omapi_object_t *id,
}
isc_result_t omapi_set_int_value (omapi_object_t *h, omapi_object_t *id,
- char *name, int value)
+ const char *name, int value)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -316,7 +317,7 @@ isc_result_t omapi_set_int_value (omapi_object_t *h, omapi_object_t *id,
}
isc_result_t omapi_set_object_value (omapi_object_t *h, omapi_object_t *id,
- char *name, omapi_object_t *value)
+ const char *name, omapi_object_t *value)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -344,7 +345,7 @@ isc_result_t omapi_set_object_value (omapi_object_t *h, omapi_object_t *id,
}
isc_result_t omapi_set_string_value (omapi_object_t *h, omapi_object_t *id,
- char *name, char *value)
+ const char *name, const char *value)
{
isc_result_t status;
omapi_typed_data_t *tv = (omapi_typed_data_t *)0;
@@ -388,7 +389,7 @@ isc_result_t omapi_get_value (omapi_object_t *h,
isc_result_t omapi_get_value_str (omapi_object_t *h,
omapi_object_t *id,
- char *name,
+ const char *name,
omapi_value_t **value)
{
omapi_object_t *outer;
@@ -451,7 +452,7 @@ isc_result_t omapi_object_update (omapi_object_t *obj, omapi_object_t *id,
return status;
}
if (handle)
- omapi_set_int_value (obj, id, "remote-handle", handle);
+ omapi_set_int_value (obj, id, "remote-handle", (int)handle);
status = omapi_signal (obj, "updated");
if (status != ISC_R_NOTFOUND)
return status;
@@ -460,7 +461,7 @@ isc_result_t omapi_object_update (omapi_object_t *obj, omapi_object_t *id,
int omapi_data_string_cmp (omapi_data_string_t *s1, omapi_data_string_t *s2)
{
- int len;
+ unsigned len;
int rv;
if (s1 -> len > s2 -> len)
@@ -477,9 +478,9 @@ int omapi_data_string_cmp (omapi_data_string_t *s1, omapi_data_string_t *s2)
return 0;
}
-int omapi_ds_strcmp (omapi_data_string_t *s1, char *s2)
+int omapi_ds_strcmp (omapi_data_string_t *s1, const char *s2)
{
- int len, slen;
+ unsigned len, slen;
int rv;
slen = strlen (s2);
@@ -497,9 +498,9 @@ int omapi_ds_strcmp (omapi_data_string_t *s1, char *s2)
return 0;
}
-int omapi_td_strcmp (omapi_typed_data_t *s1, char *s2)
+int omapi_td_strcmp (omapi_typed_data_t *s1, const char *s2)
{
- int len, slen;
+ unsigned len, slen;
int rv;
/* If the data type is not compatible, never equal. */
@@ -523,7 +524,7 @@ int omapi_td_strcmp (omapi_typed_data_t *s1, char *s2)
}
isc_result_t omapi_make_value (omapi_value_t **vp, omapi_data_string_t *name,
- omapi_typed_data_t *value, char *caller)
+ omapi_typed_data_t *value, const char *caller)
{
isc_result_t status;
@@ -549,7 +550,8 @@ isc_result_t omapi_make_value (omapi_value_t **vp, omapi_data_string_t *name,
isc_result_t omapi_make_const_value (omapi_value_t **vp,
omapi_data_string_t *name,
- u_int8_t *value, int len, char *caller)
+ const u_int8_t *value,
+ unsigned len, const char *caller)
{
isc_result_t status;
@@ -576,7 +578,7 @@ isc_result_t omapi_make_const_value (omapi_value_t **vp,
isc_result_t omapi_make_int_value (omapi_value_t **vp,
omapi_data_string_t *name,
- int value, char *caller)
+ int value, const char *caller)
{
isc_result_t status;
@@ -603,7 +605,8 @@ isc_result_t omapi_make_int_value (omapi_value_t **vp,
isc_result_t omapi_make_handle_value (omapi_value_t **vp,
omapi_data_string_t *name,
- omapi_object_t *value, char *caller)
+ omapi_object_t *value,
+ const char *caller)
{
isc_result_t status;
@@ -636,7 +639,7 @@ isc_result_t omapi_make_handle_value (omapi_value_t **vp,
isc_result_t omapi_make_string_value (omapi_value_t **vp,
omapi_data_string_t *name,
- char *value, char *caller)
+ char *value, const char *caller)
{
isc_result_t status;
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 26f9256d..126412bf 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -22,7 +22,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcrelay.c,v 1.34 1999/09/09 21:00:13 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcrelay.c,v 1.35 1999/10/07 06:36:28 mellon Exp $ Copyright (c) 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -43,7 +43,7 @@ int lexchar;
char *token_line;
char *tlname;
-char *path_dhcrelay_pid = _PATH_DHCRELAY_PID;
+const char *path_dhcrelay_pid = _PATH_DHCRELAY_PID;
int bogus_agent_drops = 0; /* Packets dropped because agent option
field was specified and we're not relaying
@@ -287,7 +287,7 @@ int main (argc, argv, envp)
void relay (ip, packet, length, from_port, from, hfrom)
struct interface_info *ip;
struct dhcp_packet *packet;
- int length;
+ unsigned length;
unsigned int from_port;
struct iaddr from;
struct hardware *hfrom;
@@ -464,7 +464,7 @@ struct subnet *find_subnet (addr)
int strip_relay_agent_options (in, out, packet, length)
struct interface_info *in, **out;
struct dhcp_packet *packet;
- int length;
+ unsigned length;
{
int is_dhcp = 0;
u_int8_t *op, *sp, *max;
@@ -527,7 +527,7 @@ int strip_relay_agent_options (in, out, packet, length)
/* Skip over other options. */
default:
if (sp != op)
- memcpy (sp, op, op [1] + 2);
+ memcpy (sp, op, (unsigned)(op [1] + 2));
sp += op [1] + 2;
op += op [1] + 2;
break;
@@ -584,7 +584,7 @@ int find_interface_by_agent_option (packet, out, buf, len)
{
int i;
u_int8_t *circuit_id = 0;
- int circuit_id_len;
+ unsigned circuit_id_len;
struct interface_info *ip;
while (i < len) {
@@ -644,6 +644,7 @@ int find_interface_by_agent_option (packet, out, buf, len)
int add_relay_agent_options (ip, packet, length, giaddr)
struct interface_info *ip;
struct dhcp_packet *packet;
+ unsigned length;
struct in_addr giaddr;
{
int is_dhcp = 0, agent_options_present = 0;
@@ -717,7 +718,7 @@ int add_relay_agent_options (ip, packet, length, giaddr)
default:
end_pad = 0;
if (sp != op)
- memcpy (sp, op, op [1] + 2);
+ memcpy (sp, op, (unsigned)(op [1] + 2));
sp += op [1] + 2;
op += op [1] + 2;
break;
@@ -759,7 +760,7 @@ int add_relay_agent_options (ip, packet, length, giaddr)
if (ip -> remote_id) {
*sp++ = RAI_REMOTE_ID;
if (ip -> remote_id_len > 255 || ip -> remote_id_len < 1)
- log_fatal ("completely bogus remote id length %d on %s\n",
+ log_fatal ("bogus remote id length %d on %s\n",
ip -> circuit_id_len, ip -> name);
*sp++ = ip -> remote_id_len;
memcpy (sp, ip -> remote_id, ip -> remote_id_len);
diff --git a/server/bootp.c b/server/bootp.c
index 583da9b5..224e93e5 100644
--- a/server/bootp.c
+++ b/server/bootp.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: bootp.c,v 1.54 1999/07/31 18:07:16 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bootp.c,v 1.55 1999/10/07 06:36:29 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -42,7 +42,7 @@ void bootp (packet)
struct subnet *subnet;
struct lease *lease;
struct iaddr ip_address;
- int i;
+ unsigned i;
struct data_string d1;
struct option_cache *oc;
char msgbuf [1024];
diff --git a/server/class.c b/server/class.c
index 522dcbc5..1799711c 100644
--- a/server/class.c
+++ b/server/class.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: class.c,v 1.13 1999/07/31 18:09:51 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: class.c,v 1.14 1999/10/07 06:36:30 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -183,7 +183,7 @@ void classify (packet, class)
}
struct class *find_class (name)
- char *name;
+ const char *name;
{
struct collection *lp;
struct class *cp;
diff --git a/server/confpars.c b/server/confpars.c
index 222b116a..dec99ab9 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.86 1999/10/07 02:14:09 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.87 1999/10/07 06:36:30 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -37,7 +37,7 @@ isc_result_t readconf ()
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
enum dhcp_token token;
int declaration = 0;
int status;
@@ -80,7 +80,7 @@ isc_result_t read_leases ()
{
struct parse *cfile;
int file;
- char *val;
+ const char *val;
enum dhcp_token token;
isc_result_t status;
@@ -188,7 +188,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
int declaration;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct shared_network *share;
char *t, *n;
struct expression *expr;
@@ -199,6 +199,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
struct option_cache *cache;
int lose;
struct data_string key_id;
+ int known;
token = peek_token (&val, cfile);
@@ -437,7 +438,8 @@ int parse_statement (cfile, group, type, host_decl, declaration)
return declaration;
}
- option = parse_option_name (cfile, 1);
+ known = 0;
+ option = parse_option_name (cfile, 1, &known);
if (option) {
token = peek_token (&val, cfile);
if (token == CODE) {
@@ -460,7 +462,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
/* If this wasn't an option code definition, don't
allow an unknown option. */
- if (option -> code == -1) {
+ if (!known) {
parse_warn (cfile, "unknown option %s.%s",
option -> universe -> name,
option -> name);
@@ -492,7 +494,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
if (is_identifier (token)) {
option = ((struct option *)
hash_lookup (server_universe.hash,
- (unsigned char *)val, 0));
+ (const unsigned char *)val, 0));
if (option) {
token = next_token (&val, cfile);
if (!parse_option_statement
@@ -579,7 +581,7 @@ void parse_failover_peer (cfile, group, type)
int type;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct failover_peer *peer;
TIME *tp;
char *name;
@@ -724,7 +726,7 @@ enum failover_state parse_failover_state (cfile)
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
token = next_token (&val, cfile);
switch (token) {
@@ -752,7 +754,7 @@ void parse_pool_statement (cfile, group, type)
int type;
{
enum dhcp_token token;
- char *val;
+ const char *val;
int done = 0;
struct pool *pool, **p;
struct permit *permit;
@@ -899,7 +901,7 @@ int parse_boolean (cfile)
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
int rv;
token = next_token (&val, cfile);
@@ -926,7 +928,7 @@ int parse_lbrace (cfile)
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
token = next_token (&val, cfile);
if (token != LBRACE) {
@@ -944,7 +946,7 @@ void parse_host_declaration (cfile, group)
struct parse *cfile;
struct group *group;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct host_decl *host;
char *name;
@@ -1015,7 +1017,7 @@ void parse_host_declaration (cfile, group)
}
go = ((struct group_object *)
hash_lookup (group_name_hash,
- (unsigned char *)val,
+ (const unsigned char *)val,
strlen (val)));
if (!go) {
parse_warn (cfile, "unknown group %s in host %s",
@@ -1038,9 +1040,9 @@ void parse_host_declaration (cfile, group)
}
if (token == UID) {
- char *s;
+ const char *s;
unsigned char *t = 0;
- int len;
+ unsigned len;
token = next_token (&val, cfile);
data_string_forget (&host -> client_identifier,
@@ -1063,7 +1065,7 @@ void parse_host_declaration (cfile, group)
"expecting hex list.");
skip_to_semi (cfile);
}
- s = (char *)t;
+ s = (const char *)t;
}
if (!buffer_allocate
(&host -> client_identifier.buffer,
@@ -1074,7 +1076,7 @@ void parse_host_declaration (cfile, group)
host -> client_identifier.data =
host -> client_identifier.buffer -> data;
host -> client_identifier.len = len;
- memcpy (host -> client_identifier.data, s,
+ memcpy (host -> client_identifier.buffer -> data, s,
len + host -> client_identifier.terminated);
if (t)
dfree (t, "parse_host_declaration");
@@ -1130,13 +1132,13 @@ struct class *parse_class_declaration (cfile, group, type)
struct group *group;
int type;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct class *class = (struct class *)0, *pc;
int declaration = 0;
int lose = 0;
struct data_string data;
- char *name;
+ const char *name;
struct executable_statement *stmt = (struct executable_statement *)0;
struct expression *expr;
int new = 1;
@@ -1184,10 +1186,12 @@ struct class *parse_class_declaration (cfile, group, type)
name = type ? "implicit-vendor-class" : "implicit-user-class";
} else if (type == 2) {
- if (!(name = dmalloc (strlen (val) + 1,
- "parse_class_declaration")))
+ char *tname;
+ if (!(tname = dmalloc (strlen (val) + 1,
+ "parse_class_declaration")))
log_fatal ("No memory for class name %s.", val);
- strcpy (name, val);
+ strcpy (tname, val);
+ name = tname;
} else {
name = (char *)0;
}
@@ -1204,7 +1208,7 @@ struct class *parse_class_declaration (cfile, group, type)
return (struct class *)0;
data.terminated = 1;
data.data = &data.buffer -> data [0];
- strcpy ((char *)data.data, val);
+ strcpy ((char *)data.buffer -> data, val);
} else if (token == NUMBER_OR_NAME || token == NUMBER) {
memset (&data, 0, sizeof data);
if (!parse_cshl (&data, cfile))
@@ -1425,7 +1429,7 @@ void parse_shared_net_declaration (cfile, group)
struct parse *cfile;
struct group *group;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct shared_network *share;
char *name;
@@ -1494,12 +1498,12 @@ void parse_subnet_declaration (cfile, share)
struct parse *cfile;
struct shared_network *share;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct subnet *subnet, *t, *u;
struct iaddr iaddr;
unsigned char addr [4];
- int len = sizeof addr;
+ unsigned len = sizeof addr;
int declaration = 0;
subnet = new_subnet ("parse_subnet_declaration");
@@ -1579,7 +1583,7 @@ void parse_group_declaration (cfile, group)
struct parse *cfile;
struct group *group;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct group *g;
int declaration = 0;
@@ -1667,7 +1671,7 @@ int parse_fixed_addr_param (oc, cfile)
struct option_cache **oc;
struct parse *cfile;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct expression *expr = (struct expression *)0;
struct expression *tmp, *new;
@@ -1747,10 +1751,10 @@ TIME parse_timestamp (cfile)
struct lease *parse_lease_declaration (cfile)
struct parse *cfile;
{
- char *val;
+ const char *val;
enum dhcp_token token;
unsigned char addr [4];
- int len = sizeof addr;
+ unsigned len = sizeof addr;
int seenmask = 0;
int seenbit;
char tbuf [32];
@@ -1813,15 +1817,17 @@ struct lease *parse_lease_declaration (cfile)
seenbit = 8;
token = peek_token (&val, cfile);
if (token == STRING) {
+ unsigned char *tuid;
token = next_token (&val, cfile);
lease.uid_len = strlen (val);
- lease.uid = (unsigned char *)
+ tuid = (unsigned char *)
malloc (lease.uid_len);
- if (!lease.uid) {
+ if (!tuid) {
log_error ("no space for uid");
return (struct lease *)0;
}
- memcpy (lease.uid, val, lease.uid_len);
+ memcpy (tuid, val, lease.uid_len);
+ lease.uid = tuid;
parse_semi (cfile);
} else {
lease.uid_len = 0;
@@ -2018,9 +2024,9 @@ void parse_address_range (cfile, group, type, pool)
{
struct iaddr low, high, net;
unsigned char addr [4];
- int len = sizeof addr;
+ unsigned len = sizeof addr;
enum dhcp_token token;
- char *val;
+ const char *val;
int dynamic = 0;
struct subnet *subnet;
struct shared_network *share;
diff --git a/server/db.c b/server/db.c
index c7822eb7..1f3427a1 100644
--- a/server/db.c
+++ b/server/db.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: db.c,v 1.33 1999/10/07 02:14:10 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: db.c,v 1.34 1999/10/07 06:36:31 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -102,11 +102,10 @@ int write_lease (lease)
}
if (lease -> uid_len) {
int i;
- if (db_printable_len ((char *)lease -> uid,
+ if (db_printable_len ((const char *)lease -> uid,
lease -> uid_len)) {
- fprintf (db_file, "\n\tuid \"%*.*s\";",
- lease -> uid_len, lease -> uid_len,
- lease -> uid);
+ fprintf (db_file, "\n\tuid \"%*s\";",
+ lease -> uid_len, lease -> uid);
} else {
errno = 0;
fprintf (db_file, "\n\tuid %2.2x", lease -> uid [0]);
@@ -245,11 +244,10 @@ int write_host (host)
if (host -> client_identifier.len) {
int i;
errno = 0;
- if (db_printable_len ((char *)
+ if (db_printable_len ((const char *)
host -> client_identifier.data,
host -> client_identifier.len)) {
- fprintf (db_file, "\n\tuid \"%*.*s\";",
- host -> client_identifier.len,
+ fprintf (db_file, "\n\tuid \"%*s\";",
host -> client_identifier.len,
host -> client_identifier.data);
} else {
@@ -398,7 +396,7 @@ int write_group (group)
}
int db_printable (s)
- char *s;
+ const char *s;
{
int i;
for (i = 0; s [i]; i++)
@@ -408,8 +406,8 @@ int db_printable (s)
}
int db_printable_len (s, len)
- char *s;
- int len;
+ const char *s;
+ unsigned len;
{
int i;
for (i = 0; i < len; i++)
@@ -444,8 +442,7 @@ int write_billing_class (class)
break;
if (i == class -> hash_string.len) {
errno = 0;
- fprintf (db_file, " \"%*.*s\";",
- class -> hash_string.len,
+ fprintf (db_file, " \"%*s\";",
class -> hash_string.len,
class -> hash_string.data);
if (errno)
diff --git a/server/dhcp.c b/server/dhcp.c
index c98868bf..ce5bec43 100644
--- a/server/dhcp.c
+++ b/server/dhcp.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dhcp.c,v 1.113 1999/10/05 03:25:38 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcp.c,v 1.114 1999/10/07 06:36:31 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -351,7 +351,8 @@ void dhcpinform (packet)
unsigned char dhcpack = DHCPACK;
struct subnet *subnet;
struct iaddr cip;
- int i, j, nulltp;
+ unsigned i, j;
+ int nulltp;
struct sockaddr_in to;
struct in_addr from;
@@ -536,9 +537,9 @@ void dhcpinform (packet)
if ((oc = lookup_option (&server_universe, options, i)) &&
evaluate_option_cache (&d1, packet, (struct lease *)0,
packet -> options, options, oc)) {
- struct universe *u;
+ const struct universe *u;
- u = ((struct universe *)
+ u = ((const struct universe *)
hash_lookup (&universe_hash, d1.data, d1.len));
if (!u) {
log_error ("unknown option space %s.", d1.data);
@@ -801,7 +802,8 @@ void ack_lease (packet, lease, offer, when, msg)
struct expression *expr;
int status;
- int i, j, s1, s2;
+ unsigned i, j;
+ int s1, s2;
int val;
/* If we're already acking this lease, don't do it again. */
@@ -1257,14 +1259,16 @@ void ack_lease (packet, lease, offer, when, msg)
lt.uid_max = sizeof lt.uid_buf;
lt.uid_len = d1.len;
} else {
+ unsigned char *tuid;
lt.uid_max = d1.len;
lt.uid_len = d1.len;
- lt.uid = (unsigned char *)dmalloc (lt.uid_max,
- "ack_lease");
+ tuid = (unsigned char *)dmalloc (lt.uid_max,
+ "ack_lease");
/* XXX inelegant */
- if (!lt.uid)
+ if (!tuid)
log_fatal ("no memory for large uid.");
- memcpy (lt.uid, d1.data, lt.uid_len);
+ memcpy (tuid, d1.data, lt.uid_len);
+ lt.uid = tuid;
}
data_string_forget (&d1, "ack_lease");
}
@@ -1430,7 +1434,7 @@ void ack_lease (packet, lease, offer, when, msg)
state -> offered_expiry - cur_time;
putULong ((unsigned char *)&state -> expiry,
- offered_lease_time);
+ (unsigned long)offered_lease_time);
i = DHO_DHCP_LEASE_TIME;
if (lookup_option (&dhcp_universe, state -> options, i))
log_error ("dhcp-lease-time option for %s overridden.",
@@ -1450,7 +1454,7 @@ void ack_lease (packet, lease, offer, when, msg)
/* Renewal time is lease time * 0.5. */
offered_lease_time /= 2;
putULong ((unsigned char *)&state -> renewal,
- offered_lease_time);
+ (unsigned long)offered_lease_time);
i = DHO_DHCP_RENEWAL_TIME;
if (lookup_option (&dhcp_universe, state -> options, i))
log_error ("overriding dhcp-renewal-time for %s.",
@@ -1472,7 +1476,7 @@ void ack_lease (packet, lease, offer, when, msg)
offered_lease_time += (offered_lease_time / 2
+ offered_lease_time / 4);
putULong ((unsigned char *)&state -> rebind,
- offered_lease_time);
+ (unsigned)offered_lease_time);
i = DHO_DHCP_REBINDING_TIME;
if (lookup_option (&dhcp_universe, state -> options, i))
log_error ("overriding dhcp-rebinding-time for %s.",
@@ -1643,9 +1647,9 @@ void ack_lease (packet, lease, offer, when, msg)
if ((oc = lookup_option (&server_universe, state -> options, i)) &&
evaluate_option_cache (&d1, packet, lease,
packet -> options, state -> options, oc)) {
- struct universe *u;
+ const struct universe *u;
- u = ((struct universe *)
+ u = ((const struct universe *)
hash_lookup (&universe_hash, d1.data, d1.len));
if (!u) {
log_error ("unknown option space %s.", d1.data);
@@ -1708,7 +1712,7 @@ void dhcp_reply (lease)
struct lease *lease;
{
int bufs = 0;
- int packet_length;
+ unsigned packet_length;
struct dhcp_packet raw;
struct sockaddr_in to;
struct in_addr from;
@@ -2407,7 +2411,7 @@ struct lease *mockup_lease (packet, share, hp)
return (struct lease *)0;
mock.next = mock.prev = (struct lease *)0;
mock.host = hp;
- mock.uid = hp -> client_identifier.data;
+ (const char *)mock.uid = hp -> client_identifier.data;
mock.uid_len = hp -> client_identifier.len;
mock.hardware_addr = hp -> interface;
mock.starts = mock.timestamp = mock.ends = MIN_TIME;
@@ -2422,7 +2426,7 @@ struct lease *mockup_lease (packet, share, hp)
void static_lease_dereference (lease, name)
struct lease *lease;
- char *name;
+ const char *name;
{
if (!(lease -> flags & STATIC_LEASE))
return;
diff --git a/server/dhcpd.c b/server/dhcpd.c
index 7010c05f..42beb894 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -22,7 +22,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcpd.c,v 1.74 1999/10/01 03:26:01 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.75 1999/10/07 06:36:32 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
#endif
static char copyright[] =
@@ -55,9 +55,9 @@ int log_perror = -1;
int log_perror = 1;
#endif
-char *path_dhcpd_conf = _PATH_DHCPD_CONF;
-char *path_dhcpd_db = _PATH_DHCPD_DB;
-char *path_dhcpd_pid = _PATH_DHCPD_PID;
+const char *path_dhcpd_conf = _PATH_DHCPD_CONF;
+const char *path_dhcpd_db = _PATH_DHCPD_DB;
+const char *path_dhcpd_pid = _PATH_DHCPD_PID;
int dhcp_max_agent_option_packet_length = DHCP_MTU_MAX;
@@ -80,7 +80,7 @@ int main (argc, argv, envp)
char *server = (char *)0;
isc_result_t result;
omapi_object_t *listener;
- int seed;
+ unsigned seed;
struct interface_info *ip;
/* Initially, log errors to stderr as well as to syslogd. */
@@ -224,10 +224,10 @@ int main (argc, argv, envp)
classification_setup ();
/* Initialize the omapi system. */
- status = omapi_init ();
+ result = omapi_init ();
if (status != ISC_R_SUCCESS)
log_fatal ("Can't initialize OMAPI: %s\n",
- isc_result_totext (status));
+ isc_result_totext (result));
/* Set up the OMAPI wrappers for various server database internal
objects. */
@@ -270,15 +270,15 @@ int main (argc, argv, envp)
/* Start up a listener for the object management API protocol. */
listener = (omapi_object_t *)0;
- status = omapi_generic_new (&listener, "main");
- if (status != ISC_R_SUCCESS)
+ result = omapi_generic_new (&listener, "main");
+ if (result != ISC_R_SUCCESS)
log_fatal ("Can't allocate new generic object: %s\n",
- isc_result_totext (status));
- status = omapi_protocol_listen (listener,
+ isc_result_totext (result));
+ result = omapi_protocol_listen (listener,
OMAPI_PROTOCOL_PORT, 1);
- if (status != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS)
log_fatal ("Can't start OMAPI protocol: %s",
- isc_result_totext (status));
+ isc_result_totext (result));
#ifndef DEBUG
if (daemon) {
diff --git a/server/dhcpd.cat8 b/server/dhcpd.cat8
index 8d3381d5..282efe63 100644
--- a/server/dhcpd.cat8
+++ b/server/dhcpd.cat8
@@ -8,8 +8,8 @@ NNAAMMEE
dhcpd - Dynamic Host Configuration Protocol Server
SSYYNNOOPPSSIISS
- ddhhccppdd [ --pp _p_o_r_t ] [ --ff ] [ --dd ] [ --qq ] [ --ccff _c_o_n_f_i_g_-_f_i_l_e ]
- [ --llff _l_e_a_s_e_-_f_i_l_e ] [ _i_f_0 [ _._._._i_f_N ] ]
+ ddhhccppdd [ --pp _p_o_r_t ] [ --ff ] [ --dd ] [ --qq ] [ --tt | --TT ] [ --ccff
+ _c_o_n_f_i_g_-_f_i_l_e ] [ --llff _l_e_a_s_e_-_f_i_l_e ] [ _i_f_0 [ _._._._i_f_N ] ]
DDEESSCCRRIIPPTTIIOONN
The Internet Software Consortium DHCP Server, dhcpd,
@@ -167,6 +167,16 @@ dhcpd(8) dhcpd(8)
copyright message on startup. To avoid printing this
message, the --qq flag may be specified.
+ The DHCP server reads two files on startup: a configura­
+ tion file, and a lease database. If the --tt flag is spec­
+ ified, the server will simply test the configuration file
+ for correct syntax, but will not attempt to perform any
+ network operations. This can be used to test the a new
+ configuration file automatically before installing it.
+
+ The --TT flag can be used to test the lease database file in
+ a similar way.
+
CCOONNFFIIGGUURRAATTIIOONN
The syntax of the dhcpd.conf(5) file is discussed seper­
ately. This section should be used as an overview of the
@@ -180,28 +190,28 @@ SSuubbnneettss
tion, in order to dynamically allocate addresses, it must
be assigned one or more ranges of addresses on each subnet
which it can in turn assign to client hosts as they boot.
- Thus, a very simple configuration providing DHCP support
- might look like this:
- subnet 239.252.197.0 netmask 255.255.255.0 {
- range 239.252.197.10 239.252.197.250;
- }
- Multiple address ranges may be specified like this:
- subnet 239.252.197.0 netmask 255.255.255.0 {
+ 3
- 3
+dhcpd(8) dhcpd(8)
+ Thus, a very simple configuration providing DHCP support
+ might look like this:
-dhcpd(8) dhcpd(8)
+ subnet 239.252.197.0 netmask 255.255.255.0 {
+ range 239.252.197.10 239.252.197.250;
+ }
+ Multiple address ranges may be specified like this:
+ subnet 239.252.197.0 netmask 255.255.255.0 {
range 239.252.197.10 239.252.197.107;
range 239.252.197.113 239.252.197.250;
}
@@ -246,16 +256,6 @@ LLeeaassee LLeennggtthhss
Each subnet need not have the same lease--in the case of
an office environment and a manufacturing environment
served by the same DHCP server, it might make sense to
- have widely disparate values for default and maximum lease
- times on each subnet.
-
-BBOOOOTTPP SSuuppppoorrtt
- Each BOOTP client must be explicitly declared in the
- dhcpd.conf file. A very basic client declaration will
- specify the client network interface's hardware address
- and the IP address to assign to that client. If the
- client needs to be able to load a boot file from the
- server, that file's name must be specified. A simple
@@ -268,6 +268,16 @@ BBOOOOTTPP SSuuppppoorrtt
dhcpd(8) dhcpd(8)
+ have widely disparate values for default and maximum lease
+ times on each subnet.
+
+BBOOOOTTPP SSuuppppoorrtt
+ Each BOOTP client must be explicitly declared in the
+ dhcpd.conf file. A very basic client declaration will
+ specify the client network interface's hardware address
+ and the IP address to assign to that client. If the
+ client needs to be able to load a boot file from the
+ server, that file's name must be specified. A simple
bootp client declaration might look like this:
host haagen {
@@ -312,27 +322,26 @@ OOppttiioonnss
filename "/tftpboot/haagen.boot";
option domain-name-servers 192.5.5.1;
option domain-name "vix.com";
- }
- A more complete description of the dhcpd.conf file syntax
- is provided in dhcpd.conf(5).
-
-FFIILLEESS
- //eettcc//ddhhccppdd..ccoonnff,, //vvaarr//ddbb//ddhhccppdd..lleeaasseess,, //vvaarr//rruunn//ddhhccppdd..ppiidd,,
- //vvaarr//ddbb//ddhhccppdd..lleeaasseess~~..
+ 5
- 5
+dhcpd(8) dhcpd(8)
+ }
-dhcpd(8) dhcpd(8)
+ A more complete description of the dhcpd.conf file syntax
+ is provided in dhcpd.conf(5).
+FFIILLEESS
+ //eettcc//ddhhccppdd..ccoonnff,, //vvaarr//ddbb//ddhhccppdd..lleeaasseess,, //vvaarr//rruunn//ddhhccppdd..ppiidd,,
+ //vvaarr//ddbb//ddhhccppdd..lleeaasseess~~..
SSEEEE AALLSSOO
dhclient(8), dhcrelay(8), dhcpd.conf(5), dhcpd.leases(5)
@@ -382,15 +391,6 @@ AAUUTTHHOORR
-
-
-
-
-
-
-
-
-
6
diff --git a/server/dhcpd.conf.cat5 b/server/dhcpd.conf.cat5
index de1cbe16..a5e639d7 100644
--- a/server/dhcpd.conf.cat5
+++ b/server/dhcpd.conf.cat5
@@ -472,6 +472,7 @@ dhcpd.conf(5) dhcpd.conf(5)
versions of the DHCP server, but it important to be aware
of it at lease for the time being.
+SSUUBBCCLLAASSSSEESS
In addition to classes, it is possible to declare sub­
classes. A subclass is a class with the same name as a
regular class, but with a specific submatch expression
@@ -481,29 +482,78 @@ dhcpd.conf(5) dhcpd.conf(5)
that it will be quicker to find the subclasses. Sub­
classes work as follows:
- class "vendor-classes" {
- match option vendor-class-identifier;
+ class "allocation-class-1" {
+ match pick-first-value (option dhcp-client-identifier, hardware);
}
- subclass "vendor-classes" "SUNW.Ultra-5_10" {
- option vendor-encapsulated-options
- 2:AC:11:41:1:
- 3:12:73:75:6e:64:68:63:70:2d:73:65:72:76:65:72:31:37:2d:31:
- 4:12:2f:65:78:70:6f:72:74:2f:72:6f:6f:74:2f:73:70:61:72:63;
+ class "allocation-class-2" {
+ match pick-first-value (option dhcp-client-identifier, hardware);
}
- subclass "vendor-classes" "SUNW.i86pc" {
- option vendor-encapsulated-options
- 2:4:AC:11:41:1:
- 3:12:73:75:6e:64:68:63:70:2d:73:65:72:76:65:72:31:37:2d:31:
- 4:12:2f:65:78:70:6f:72:74:2f:72:6f:6f:74:2f:69:38:36:70:63;
+ subclass "allocation-class-1" 1:8:0:2b:4c:39:ad;
+ subclass "allocation-class-2" 1:8:0:2b:a9:cc:e3;
+ subclass "allocation-class-1" 1:0:0:c4:aa:29:44;
+
+ subnet 10.0.0.0 netmask 255.255.255.0 {
+ pool {
+ allow members of "allocation-class-1";
+ range 10.0.0.11 10.0.0.50;
+ }
+ pool {
+ allow members of "allocation-class-2";
+ range 10.0.0.51 10.0.0.100;
+ }
+ }
+
+ The data following the class name in the subclass declara­
+ tion is a constant value to use in matching the match
+ expression for the class. When class matching is done,
+ the server will evaluate the match expression and then
+ look the result up in the hash table. If it finds a
+ match, the client is considered a member of both the class
+ and the subclass.
+
+ Subclasses can be declared with or without scope. In the
+ above example, the sole purpose of the subclass is to
+ allow some clients access to one address pool, while other
+ clients are given access to the other pool, so these sub­
+ classes are declared without scopes. If part of the pur­
+ pose of the subclass were to define different parameter
+ values for some clients, you might want to declare some
+
+
+
+ 8
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
+ subclasses with scopes.
+
+ In the above example, if you had a single client that
+ needed some configuration parameters, while most didn't,
+ you might write the following subclass declaration for
+ that client:
+
+ subclass "allocation-class-2" 08:00:2b:a1:11:31 {
+ option root-path "samsara:/var/diskless/alphapc";
+ filename "/tftpboot/netbsd.alphapc-diskless";
}
- The string following the class name for the subclasses
- specifies the string that is expected to match the expres­
- sion in the class declaration for the vendor-classes
- class.
+ In this example, we've used subclassing as a way to con­
+ trol address allocation on a per-client basis. However,
+ it's also possible to use subclassing in ways that are not
+ specific to clients - for example, to use the value of the
+ vendor-class-identifier option to determine what values to
+ send in the vendor-encapsulated-options option. An exam­
+ ple of this is shown under the VENDOR ENCAPSULATED OPTIONS
+ head later on in this document.
+PPEERR--CCLLAASSSS AADDDDRREESSSS AASSSSIIGGNNMMEENNTT LLIIMMIITTSS
You may specify a limit to the number of clients in a
class that can be assigned leases. The effect of this
will be to make it difficult for a new client in a class
@@ -521,17 +571,7 @@ dhcpd.conf(5) dhcpd.conf(5)
This will produce a class in which a maximum of four mem­
bers may hold a lease at one time.
-
-
- 8
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
+SSPPAAWWNNIINNGG CCLLAASSSSEESS
It is possible to declare a _s_p_a_w_n_i_n_g _c_l_a_s_s. A spawning
class is a class that automatically produces subclasses
based on what the client sends. The reason that spawning
@@ -546,10 +586,23 @@ dhcpd.conf(5) dhcpd.conf(5)
Many cable modem head-end systems can be configured to add
a Relay Agent Information option to DHCP packets when
+
+
+
+ 9
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
relaying them to the DHCP server. These systems typi­
cally add a circuit ID or remote ID option that uniquely
identifies the customer site. To take advantage of this,
you can write a class declaration as follows:
+
class "customer" {
match if exists agent.circuit-id;
spawn with option agent.circuit-id;
@@ -573,23 +626,36 @@ dhcpd.conf(5) dhcpd.conf(5)
ple is given only because it is a fairly straightforward
one.
-RREEFFEERREENNCCEE:: DDEECCLLAARRAATTIIOONNSS
- TThhee _s_h_a_r_e_d_-_n_e_t_w_o_r_k ssttaatteemmeenntt
+RREEFFEERREENNCCEE:: EEVVEENNTTSS
+ There are three kinds of events that can happen regarding
+ a lease, and it is possible to declare statements that
+ occur when any of these events happen. These events are
+ the commit event, when the server has made a commitment of
+ a certain lease to a client, the release event, when the
+ client has released the server from its commitment, and
+ the expiry event, when the commitment expires.
- sshhaarreedd--nneettwwoorrkk _n_a_m_e {{
- [ _p_a_r_a_m_e_t_e_r_s ]
- [ _d_e_c_l_a_r_a_t_i_o_n_s ]
- }}
+ Currently, only the commit event is fully supported. The
+ commit event occurs just before the DHCP server sends a
+ DHCPACK message to a DHCP client, or a BOOTREPLY message
+ to a BOOTP client.
- The _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement is used to inform the DHCP
- server that some IP subnets actually share the same physi­
- cal network. Any subnets in a shared network should be
- declared within a _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement. Parameters
- specified in the _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement will be used
+ The release event is partially supported, but currently
+ will not occur if the server is restarted after the lease
+ is assigned. This will be fixed in the near future.
+ The expiry event is not currently supported at all. This
+ will also be fixed in the reasonably near future.
+ To declare a set of statements to execute when an event
+ happens, you must use the oonn statement, followed by the
+ name of the event, followed by a series of statements to
+ execute when the event happens, enclosed in braces. For
+ example:
- 9
+
+
+ 10
@@ -598,6 +664,34 @@ RREEFFEERREENNCCEE:: DDEECCLLAARRAATTIIOONNSS
dhcpd.conf(5) dhcpd.conf(5)
+ on commit {
+ if dns-update ("a",
+ concat (option host-name, ".ssd.example.net"),
+ binary-to-ascii (10, 8, ".", leased-address),
+ lease-time) {
+ if dns-update ("ptr", concat(binary-to-ascii(10, 8, ".",
+ reverse(1, leased-address)),
+ ".in-addr.arpa"),
+ concat (option host-name,
+ ".ssd.example.net"),
+ lease-time) {
+ }
+ }
+ }
+
+RREEFFEERREENNCCEE:: DDEECCLLAARRAATTIIOONNSS
+ TThhee _s_h_a_r_e_d_-_n_e_t_w_o_r_k ssttaatteemmeenntt
+
+ sshhaarreedd--nneettwwoorrkk _n_a_m_e {{
+ [ _p_a_r_a_m_e_t_e_r_s ]
+ [ _d_e_c_l_a_r_a_t_i_o_n_s ]
+ }}
+
+ The _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement is used to inform the DHCP
+ server that some IP subnets actually share the same physi­
+ cal network. Any subnets in a shared network should be
+ declared within a _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement. Parameters
+ specified in the _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement will be used
when booting clients on those subnets unless parameters
provided at the subnet or host level override them. If
any subnet in a shared network has addresses available for
@@ -624,6 +718,18 @@ dhcpd.conf(5) dhcpd.conf(5)
information to tell whether or not an IP address is on
that subnet. It may also be used to provide subnet-spe­
cific parameters and to specify what addresses may be
+
+
+
+ 11
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
dynamically allocated to clients booting on that subnet.
Such addresses are specified using the _r_a_n_g_e declaration.
@@ -652,18 +758,6 @@ dhcpd.conf(5) dhcpd.conf(5)
in a range. All IP addresses in the range should be in
the subnet in which the _r_a_n_g_e statement is declared. The
_d_y_n_a_m_i_c_-_b_o_o_t_p flag may be specified if addresses in the
-
-
-
- 10
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
specified range may be dynamically assigned to BOOTP
clients as well as DHCP clients. When specifying a sin­
gle address, _h_i_g_h_-_a_d_d_r_e_s_s can be omitted.
@@ -690,6 +784,18 @@ dhcpd.conf(5) dhcpd.conf(5)
the network to which the client is attached, then multiple
hhoosstt statements should be used.
+
+
+
+ 12
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
If a client is to be booted using a fixed address if it's
possible, but should be allocated a dynamic address other­
wise, then a hhoosstt statement must be specified without a
@@ -718,18 +824,6 @@ dhcpd.conf(5) dhcpd.conf(5)
The group statement is used simply to apply one or more
parameters to a group of declarations. It can be used to
group hosts, shared networks, subnets, or even other
-
-
-
- 11
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
groups.
RREEFFEERREENNCCEE:: AALLLLOOWW AANNDD DDEENNYY
@@ -756,6 +850,18 @@ AALLLLOOWW AANNDD DDEENNYY IINN SSCCOOPPEE
The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or
not to dynamically assign addresses to unknown clients.
Dynamic address assignment to unknown clients is aalllloowwed
+
+
+
+ 13
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
by default.
TThhee _b_o_o_t_p kkeeyywwoorrdd
@@ -784,18 +890,6 @@ AALLLLOOWW AANNDD DDEENNYY WWIITTHHIINN PPOOOOLL DDEECC
ous section work pretty much the same way whether the
client is sending a DHCPDISCOVER or a DHCPREQUEST message
- an address will be allocated to the client (either the
-
-
-
- 12
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
old address it's requesting, or a new address) and then
that address will be tested to see if it's okay to let the
client have it. If the client requested it, and it's not
@@ -822,6 +916,18 @@ dhcpd.conf(5) dhcpd.conf(5)
allocation process is done as described previously in the
ADDRESS ALLOCATION section.
+
+
+
+ 14
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
When declaring permit lists for address allocation pools,
the following syntaxes are recognized following the allow
or deny keyword:
@@ -851,17 +957,6 @@ dhcpd.conf(5) dhcpd.conf(5)
aauutthheennttiiccaatteedd cclliieennttss;;
-
-
- 13
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
If specified, this statement either allows or prevents
allocation from this pool to any client that has been
authenticated using the DHCP authentication protocol.
@@ -888,6 +983,17 @@ dhcpd.conf(5) dhcpd.conf(5)
RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS
TThhee _d_e_f_a_u_l_t_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt
+
+
+ 15
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
ddeeffaauulltt--lleeaassee--ttiimmee _t_i_m_e;;
_T_i_m_e should be the length in seconds that will be assigned
@@ -916,18 +1022,6 @@ RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS
_S_e_c_o_n_d_s should be the minimum number of seconds since a
client began trying to acquire a new lease before the DHCP
-
-
-
- 14
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
server will respond to its request. The number of seconds
is based on what the client reports, and the maximum value
that the client can report is 255 seconds. Generally,
@@ -954,6 +1048,18 @@ dhcpd.conf(5) dhcpd.conf(5)
a physical hardware interface type. Currently, only the
eetthheerrnneett and ttookkeenn--rriinngg types are recognized, although
support for a ffddddii hardware type (and others) would also
+
+
+
+ 16
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
be desirable. The _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s should be a set of
hexadecimal octets (numbers from 0 through ff) seperated
by colons. The _h_a_r_d_w_a_r_e statement may also be used for
@@ -982,18 +1088,6 @@ dhcpd.conf(5) dhcpd.conf(5)
nneexxtt--sseerrvveerr _s_e_r_v_e_r_-_n_a_m_e;;
The _n_e_x_t_-_s_e_r_v_e_r statement is used to specify the host
-
-
-
- 15
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
address of the server from which the initial boot file
(specified in the _f_i_l_e_n_a_m_e statement) is to be loaded.
_S_e_r_v_e_r_-_n_a_m_e should be a numeric IP address or a domain
@@ -1020,6 +1114,18 @@ dhcpd.conf(5) dhcpd.conf(5)
ddyynnaammiicc--bboooottpp--lleeaassee--ccuuttooffff _d_a_t_e;;
+
+
+
+ 17
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f statement sets the ending
time for all leases assigned dynamically to BOOTP clients.
Because BOOTP clients do not have any way of renewing
@@ -1048,18 +1154,6 @@ dhcpd.conf(5) dhcpd.conf(5)
ddyynnaammiicc--bboooottpp--lleeaassee--lleennggtthh _l_e_n_g_t_h;;
The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h statement is used to set
-
-
-
- 16
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
the length of leases dynamically assigned to BOOTP
clients. At some sites, it may be possible to assume
that a lease is no longer in use if its holder has not
@@ -1087,6 +1181,17 @@ dhcpd.conf(5) dhcpd.conf(5)
uussee--hhoosstt--ddeeccll--nnaammeess _f_l_a_g;;
+
+
+ 18
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
If the _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s parameter is true in a given
scope, then for every host declaration within that scope,
the name provided for the host declaration will be sup­
@@ -1114,18 +1219,6 @@ dhcpd.conf(5) dhcpd.conf(5)
TThhee _a_u_t_h_o_r_i_t_a_t_i_v_e ssttaatteemmeenntt
-
-
-
- 17
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
aauutthhoorriittaattiivvee;;
nnoott aauutthhoorriittaattiivvee;;
@@ -1153,6 +1246,18 @@ dhcpd.conf(5) dhcpd.conf(5)
Note that the most specific scope for which the concept of
authority makes any sense is the physical network segment
+
+
+
+ 19
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
- either a shared-network statement or a subnet statement
that is not contained within a shared-network statement.
It is not meaningful to specify that the server is author­
@@ -1181,17 +1286,6 @@ dhcpd.conf(5) dhcpd.conf(5)
TThhee _a_l_w_a_y_s_-_b_r_o_a_d_c_a_s_t ssttaatteemmeenntt
-
-
- 18
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
aallwwaayyss--bbrrooaaddccaasstt _f_l_a_g;;
The DHCP and BOOTP protocols both require DHCP and BOOTP
@@ -1218,6 +1312,18 @@ dhcpd.conf(5) dhcpd.conf(5)
forgotten any lease not mentioned in the DHCPREQUEST -
i.e., the client has only a single network interface _a_n_d
it does not remember leases it's holding on networks to
+
+
+
+ 20
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
which it is not currently attached. Neither of these
assumptions are guaranteed or provable, so we urge caution
in the use of this statement.
@@ -1246,18 +1352,6 @@ dhcpd.conf(5) dhcpd.conf(5)
The use of the server-identifier statement is not recom­
mended - the only reason to use it is to force a value
-
-
-
- 19
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
other than the default value to be sent on occasions where
the default value would be incorrect. The default value
is the first IP address associated with the physical net­
@@ -1284,6 +1378,18 @@ VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS
option, which allows vendors to define their own options
that will be sent encapsulated in a standard DHCP option.
The format of the vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss option is
+
+
+
+ 21
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
either a hunk of opaque data, or an actual option buffer
just like a standard DHCP option buffer.
@@ -1296,16 +1402,20 @@ VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS
ooppttiioonnss option in some scope.
To send a simple clump of data, simply provide a value for
- the option in the right scope, as in the example shown
- earlier in the CCLLIIEENNTT CCLLAASSSSIINNGG section.
+ the option in the right scope - for example:
- To define a new option space in which vendor options can
+ option vendor-encapsulated-options
+ 2:4:AC:11:41:1:
+ 3:12:73:75:6e:64:68:63:70:2d:73:65:72:76:65:72:31:37:2d:31:
+ 4:12:2f:65:78:70:6f:72:74:2f:72:6f:6f:74:2f:69:38:36:70:63;
+
+ To define a new option space in which vendor options can
be stored, use the option space statement:
ooppttiioonn ssppaaccee _n_a_m_e ;;
- The name can then be used in option definitions, as
- described in the ddhhccpp--ooppttiioonnss((55)) manual page. For exam­
+ The name can then be used in option definitions, as
+ described in the ddhhccpp--ooppttiioonnss((55)) manual page. For exam­
ple:
option space SUNW;
@@ -1313,25 +1423,16 @@ VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS
option SUNW.server-name code 3 = text;
option SUNW.root-path code 4 = text;
-
-
- 20
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
- Once you have defined an option space and some options,
- you can set up scopes that define values for those
- options, and you can say when to use them. For example,
- suppose you want to handle two different classes of
+ Once you have defined an option space and some options,
+ you can set up scopes that define values for those
+ options, and you can say when to use them. For example,
+ suppose you want to handle two different classes of
clients, as in the example in the CCLLIIEENNTT CCLLAASSSSIINNGG section.
- Using the option space definition we just did, the CCLLIIEENNTT
- CCLLAASSSSIINNGG example can be implemented more legibly as fol­
+ Using the option space definition shown in the previous
+ example, something very similar to the vendor-encapsu­
+ lated-options definition shown earlier can be done as fol­
lows:
+
class "vendor-classes" {
match option vendor-class-identifier;
}
@@ -1344,6 +1445,17 @@ dhcpd.conf(5) dhcpd.conf(5)
option SUNW.root-path "/export/root/sparc";
}
+
+
+ 22
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
subclass "vendor-classes" "SUNW.i86pc" {
vendor-option-space SUNW;
option SUNW.root-path "/export/root/i86pc";
@@ -1381,6 +1493,26 @@ AAUUTTHHOORR
- 21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 23
diff --git a/server/mdb.c b/server/mdb.c
index 401c460b..3ffb9a5e 100644
--- a/server/mdb.c
+++ b/server/mdb.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: mdb.c,v 1.7 1999/10/07 02:14:10 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: mdb.c,v 1.8 1999/10/07 06:36:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -333,8 +333,8 @@ isc_result_t delete_host (hd, commit)
struct host_decl *find_hosts_by_haddr (htype, haddr, hlen)
int htype;
- unsigned char *haddr;
- int hlen;
+ const unsigned char *haddr;
+ unsigned hlen;
{
struct host_decl *foo;
@@ -344,8 +344,8 @@ struct host_decl *find_hosts_by_haddr (htype, haddr, hlen)
}
struct host_decl *find_hosts_by_uid (data, len)
- unsigned char *data;
- int len;
+ const unsigned char *data;
+ unsigned len;
{
struct host_decl *foo;
@@ -518,7 +518,7 @@ void new_address_range (low, high, subnet, pool)
{
struct lease *address_range, *lp, *plp;
struct iaddr net;
- int min, max, i;
+ unsigned min, max, i;
char lowbuf [16], highbuf [16], netbuf [16];
struct shared_network *share = subnet -> shared_network;
@@ -1025,7 +1025,7 @@ void release_lease (lease, packet)
void abandon_lease (lease, message)
struct lease *lease;
- char *message;
+ const char *message;
{
struct lease lt;
@@ -1073,8 +1073,8 @@ struct lease *find_lease_by_ip_addr (addr)
}
struct lease *find_lease_by_uid (uid, len)
- unsigned char *uid;
- int len;
+ const unsigned char *uid;
+ unsigned len;
{
struct lease *lease = (struct lease *)hash_lookup (lease_uid_hash,
uid, len);
@@ -1082,8 +1082,8 @@ struct lease *find_lease_by_uid (uid, len)
}
struct lease *find_lease_by_hw_addr (hwaddr, hwlen)
- unsigned char *hwaddr;
- int hwlen;
+ const unsigned char *hwaddr;
+ unsigned hwlen;
{
struct lease *lease = (struct lease *)hash_lookup (lease_hw_addr_hash,
hwaddr, hwlen);
diff --git a/server/omapi.c b/server/omapi.c
index 26e5fa4e..d4e89801 100644
--- a/server/omapi.c
+++ b/server/omapi.c
@@ -29,7 +29,7 @@
#ifndef lint
static char copyright[] =
-"$Id: omapi.c,v 1.14 1999/10/07 02:14:10 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: omapi.c,v 1.15 1999/10/07 06:36:35 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -239,7 +239,7 @@ isc_result_t dhcp_lease_get_value (omapi_object_t *h, omapi_object_t *id,
return ISC_R_NOTFOUND;
}
-isc_result_t dhcp_lease_destroy (omapi_object_t *h, char *name)
+isc_result_t dhcp_lease_destroy (omapi_object_t *h, const char *name)
{
struct lease *lease;
isc_result_t status;
@@ -302,7 +302,7 @@ isc_result_t dhcp_lease_destroy (omapi_object_t *h, char *name)
}
isc_result_t dhcp_lease_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
struct lease *lease;
isc_result_t status;
@@ -355,7 +355,7 @@ isc_result_t dhcp_lease_stuff_values (omapi_object_t *c,
if (status != ISC_R_SUCCESS)
return status;
status = omapi_connection_put_uint32 (c, (lease -> flags &
- ABANDONED_LEASE) ? 1 : 0);
+ ABANDONED_LEASE) ? 1U : 0U);
if (status != ISC_R_SUCCESS)
return status;
@@ -365,8 +365,9 @@ isc_result_t dhcp_lease_stuff_values (omapi_object_t *c,
status = omapi_connection_put_uint32 (c, sizeof (int));
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_uint32 (c, (lease -> flags &
- BOOTP_LEASE) ? 1 : 0);
+ status = omapi_connection_put_uint32 (c, ((unsigned)
+ ((lease -> flags &
+ BOOTP_LEASE) ? 1 : 0)));
if (status != ISC_R_SUCCESS)
return status;
@@ -711,7 +712,7 @@ isc_result_t dhcp_group_get_value (omapi_object_t *h, omapi_object_t *id,
return ISC_R_NOTFOUND;
}
-isc_result_t dhcp_group_destroy (omapi_object_t *h, char *name)
+isc_result_t dhcp_group_destroy (omapi_object_t *h, const char *name)
{
struct group_object *group, *t;
isc_result_t status;
@@ -744,7 +745,7 @@ isc_result_t dhcp_group_destroy (omapi_object_t *h, char *name)
}
isc_result_t dhcp_group_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
struct group_object *group, *t;
isc_result_t status;
@@ -1027,7 +1028,7 @@ isc_result_t dhcp_host_set_value (omapi_object_t *h,
return ISC_R_NOMEMORY;
host -> client_identifier.data =
&host -> client_identifier.buffer -> data [0];
- memcpy (host -> client_identifier.data,
+ memcpy (host -> client_identifier.buffer -> data,
value -> u.buffer.value,
value -> u.buffer.len);
host -> client_identifier.len = value -> u.buffer.len;
@@ -1048,7 +1049,8 @@ isc_result_t dhcp_host_set_value (omapi_object_t *h,
"dhcp_host_set_value"))
return ISC_R_NOMEMORY;
ds.data = (&ds.buffer -> data [0]);
- memcpy (ds.data, value -> u.buffer.value, ds.len);
+ memcpy (ds.buffer -> data,
+ value -> u.buffer.value, ds.len);
if (!option_cache (&host -> fixed_addr,
&ds, (struct expression *)0,
(struct option *)0)) {
@@ -1186,7 +1188,7 @@ isc_result_t dhcp_host_get_value (omapi_object_t *h, omapi_object_t *id,
return ISC_R_NOTFOUND;
}
-isc_result_t dhcp_host_destroy (omapi_object_t *h, char *name)
+isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *name)
{
struct host_decl *host;
isc_result_t status;
@@ -1202,7 +1204,7 @@ isc_result_t dhcp_host_destroy (omapi_object_t *h, char *name)
}
isc_result_t dhcp_host_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
struct host_decl *host;
isc_result_t status;
@@ -1557,7 +1559,7 @@ isc_result_t dhcp_pool_get_value (omapi_object_t *h, omapi_object_t *id,
return ISC_R_NOTFOUND;
}
-isc_result_t dhcp_pool_destroy (omapi_object_t *h, char *name)
+isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *name)
{
struct pool *pool;
isc_result_t status;
@@ -1572,7 +1574,7 @@ isc_result_t dhcp_pool_destroy (omapi_object_t *h, char *name)
}
isc_result_t dhcp_pool_signal_handler (omapi_object_t *h,
- char *name, va_list ap)
+ const char *name, va_list ap)
{
struct pool *pool;
isc_result_t status;