## 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--
#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"
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
int token;
int declaration = 0;
struct client_config *config;
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
int token;
/* Open the lease file. If we can't open it, just return -
struct client_config *config;
{
int token;
- char *val;
+ const char *val;
struct option *option;
struct executable_statement *stmt, **p;
enum statement_op op;
char *name;
struct data_string key_id;
enum policy policy;
+ int known;
switch (peek_token (&val, cfile)) {
case AUTH_KEY:
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;
return;
}
- option = parse_option_name (cfile, 1);
+ option = parse_option_name (cfile, 1, &known);
if (!option)
return;
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);
{
int ix, i;
int token;
- char *val;
+ const char *val;
pair p = (pair)0, q, r;
ix = 0;
char *name;
{
int token;
- char *val;
+ const char *val;
struct client_state *client, **cp;
struct interface_info *ip;
}
struct interface_info *interface_or_dummy (name)
- char *name;
+ const char *name;
{
struct interface_info *ip;
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);
struct client_state **clientp;
{
int token;
- char *val;
+ const char *val;
char *t, *n;
struct interface_info *ip;
struct option_cache *oc;
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;
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;
int multiple;
{
int token;
- char *val;
+ const char *val;
struct string_list *cur, *tmp;
/* Find the last medium in the media list. */
struct client_config *config;
{
int token;
- char *val;
+ const char *val;
struct iaddr addr;
struct iaddrlist *list;
#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"
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;
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;
}
struct class *find_class (s)
- char *s;
+ const char *s;
{
return (struct class *)0;
}
{
struct iaddrlist *ap;
void (*handler) PROTO ((struct packet *));
- char *type;
+ const char *type;
switch (packet -> packet_type) {
case DHCPOFFER:
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;
/* 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])
/* 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])
u_int32_t *prl;
struct option_state **op;
{
- int i;
+ unsigned i;
struct option_cache *oc;
struct buffer *bp = (struct buffer *)0;
void script_init (client, reason, medium)
struct client_state *client;
- char *reason;
+ const char *reason;
struct string_list *medium;
{
int fd;
void script_write_params (client, prefix, lease)
struct client_state *client;
- char *prefix;
+ const char *prefix;
struct client_lease *lease;
{
int i;
ration will use the parameters declared outside of any
interface declaration, or the default settings.
+ p\bps\bse\beu\bud\bdo\bo "\b"_\bn_\ba_\bm_\be" "_\br_\be_\ba_\bl_\b-_\bn_\ba_\bm_\be"\b" {\b{ _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn_\bs _\b._\b._\b. }\b}
+
+ 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 _\br_\be_\ba_\bl_\b-_\bn_\ba_\bm_\be, 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 d\bdh\bhc\bcl\bli\bie\ben\bnt\bt-\b-s\bsc\bcr\bri\bip\bpt\bt(\b(8\b8)\b) for more information.
+
m\bme\bed\bdi\bia\ba "\b"_\bm_\be_\bd_\bi_\ba _\bs_\be_\bt_\bu_\bp"\b" _\b[ ,\b, "\b"_\bm_\be_\bd_\bi_\ba _\bs_\be_\bt_\bu_\bp"\b",\b, _\b._\b._\b. _\b];\b;
The m\bme\bed\bdi\bia\ba statement defines one or more media configura
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.
media "media 10baseT/UTP", "media 10base2/BNC";
}
+
+
+
+ 9
+
+
+
+
+
+dhclient.conf(5) dhclient.conf(5)
+
+
alias {
interface "ep0";
fixed-address 192.5.5.213;
- 9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
#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"
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)
void dfree (ptr, name)
VOIDPTR ptr;
- char *name;
+ const char *name;
{
if (!ptr) {
log_error ("dfree %s: free on null pointer.", 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),
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
}
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);
}
struct group *new_group (name)
- char *name;
+ const char *name;
{
struct group *rval =
dmalloc (sizeof (struct group), name);
}
struct protocol *new_protocol (name)
- char *name;
+ const char *name;
{
struct protocol *rval = dmalloc (sizeof (struct protocol), name);
return rval;
struct lease_state *free_lease_states;
struct lease_state *new_lease_state (name)
- char *name;
+ const char *name;
{
struct lease_state *rval;
}
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);
}
struct name_server *new_name_server (name)
- char *name;
+ const char *name;
{
struct name_server *rval =
dmalloc (sizeof (struct 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);
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
}
struct universe *new_universe (name)
- char *name;
+ const char *name;
{
struct universe *rval =
dmalloc (sizeof (struct 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);
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);
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));
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),
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)
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));
void free_permit (permit, name)
struct permit *permit;
- char *name;
+ const char *name;
{
dfree (permit, name);
}
pair free_pairs;
pair new_pair (name)
- char *name;
+ const char *name;
{
pair foo;
void free_pair (foo, name)
pair foo;
- char *name;
+ const char *name;
{
foo -> cdr = free_pairs;
free_pairs = foo;
int expression_allocate (cptr, name)
struct expression **cptr;
- char *name;
+ const char *name;
{
struct expression *rval;
void free_expression (expr, name)
struct expression *expr;
- char *name;
+ const char *name;
{
expr -> data.not = free_expressions;
free_expressions = expr;
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);
int option_cache_allocate (cptr, name)
struct option_cache **cptr;
- char *name;
+ const char *name;
{
struct option_cache *rval;
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);
int buffer_allocate (ptr, len, name)
struct buffer **ptr;
- int len;
- char *name;
+ unsigned len;
+ const char *name;
{
struct buffer *bp;
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",
int buffer_dereference (ptr, name)
struct buffer **ptr;
- char *name;
+ const char *name;
{
struct buffer *bp;
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;
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",
int dns_host_entry_dereference (ptr, name)
struct dns_host_entry **ptr;
- char *name;
+ const char *name;
{
struct dns_host_entry *bp;
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",
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",
int option_state_dereference (ptr, name)
struct option_state **ptr;
- char *name;
+ const char *name;
{
int i;
struct option_state *options;
int executable_statement_allocate (ptr, name)
struct executable_statement **ptr;
- char *name;
+ const char *name;
{
struct executable_statement *bp;
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",
int packet_allocate (ptr, name)
struct packet **ptr;
- char *name;
+ const char *name;
{
int size;
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",
int packet_dereference (ptr, name)
struct packet **ptr;
- char *name;
+ const char *name;
{
int i;
struct packet *packet;
#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"
(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);
}
#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"
struct parse **cfile;
int file;
char *inbuf;
- int buflen;
- char *name;
+ unsigned buflen;
+ const char *name;
{
struct parse *tmp;
}
enum dhcp_token next_token (rval, cfile)
- char **rval;
+ const char **rval;
struct parse *cfile;
{
int rv;
}
enum dhcp_token peek_token (rval, cfile)
- char **rval;
+ const char **rval;
struct parse *cfile;
{
int x;
#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;
}
int32_t getLong (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
long ibuf;
}
u_int32_t getUShort (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
unsigned short ibuf;
}
int32_t getShort (buf)
- unsigned char *buf;
+ const unsigned char *buf;
{
short ibuf;
}
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;
{
int binary_to_ascii (outbuf, inbuf, base, width)
unsigned char *outbuf;
- unsigned char *inbuf;
+ const unsigned char *inbuf;
unsigned int base;
unsigned int width;
{
The k\bkn\bno\bow\bwn\bn expression returns true if the client whose
request is currently being processed is known - that
is, if there's a host declaration for it.
+ s\bst\bta\bat\bti\bic\bc
+
+ The s\bst\bta\bat\bti\bic\bc expression returns true if the lease
+ assigned to the client whose request is currently being
+ processed is derived from a static address assignment.
D\bDA\bAT\bTA\bA E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS
- 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.
s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg (\b(_\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br,\b, _\bo_\bf_\bf_\bs_\be_\bt,\b, _\bl_\be_\bn_\bg_\bt_\bh)\b)
- The s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg operator evaluates the data expression
+ The s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg operator evaluates the data expression
and returns the substring of the result of that evalua
- tion that starts _\bo_\bf_\bf_\bs_\be_\bt bytes from the beginning, con
- tinuing for _\bl_\be_\bn_\bg_\bt_\bh bytes. _\bO_\bf_\bf_\bs_\be_\bt and _\bl_\be_\bn_\bg_\bt_\bh are both
- numeric expressions. If _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br, _\bo_\bf_\bf_\bs_\be_\bt or _\bl_\be_\bn_\bg_\bt_\bh
- evaluate to null, then the result is also null. If
- _\bo_\bf_\bf_\bs_\be_\bt is greater than or equal to the length of the
- evaluated data, then a zero-length data string is
- returned. If _\bl_\be_\bn_\bg_\bt_\bh _\bi_\bs _\bg_\br_\be_\ba_\bt_\be_\br _\bt_\bh_\be_\bn _\bt_\bh_\be _\br_\be_\bm_\ba_\bi_\bn_\bi_\bn_\bg
- _\bl_\be_\bn_\bg_\bt_\bh _\bo_\bf _\bt_\bh_\be _\be_\bv_\ba_\bl_\bu_\ba_\bt_\be_\bd _\bd_\ba_\bt_\ba _\ba_\bf_\bt_\be_\br _\bo_\bf_\bf_\bs_\be_\bt, then a data
- string containing all data from _\bo_\bf_\bf_\bs_\be_\bt to the end of
+ tion that starts _\bo_\bf_\bf_\bs_\be_\bt bytes from the beginning, con
+ tinuing for _\bl_\be_\bn_\bg_\bt_\bh bytes. _\bO_\bf_\bf_\bs_\be_\bt and _\bl_\be_\bn_\bg_\bt_\bh are both
+ numeric expressions. If _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br, _\bo_\bf_\bf_\bs_\be_\bt or _\bl_\be_\bn_\bg_\bt_\bh
+ evaluate to null, then the result is also null. If
+ _\bo_\bf_\bf_\bs_\be_\bt is greater than or equal to the length of the
+ evaluated data, then a zero-length data string is
+ returned. If _\bl_\be_\bn_\bg_\bt_\bh _\bi_\bs _\bg_\br_\be_\ba_\bt_\be_\br _\bt_\bh_\be_\bn _\bt_\bh_\be _\br_\be_\bm_\ba_\bi_\bn_\bi_\bn_\bg
+ _\bl_\be_\bn_\bg_\bt_\bh _\bo_\bf _\bt_\bh_\be _\be_\bv_\ba_\bl_\bu_\ba_\bt_\be_\bd _\bd_\ba_\bt_\ba _\ba_\bf_\bt_\be_\br _\bo_\bf_\bf_\bs_\be_\bt, then a data
+ string containing all data from _\bo_\bf_\bf_\bs_\be_\bt to the end of
the evaluated data is returned.
s\bsu\buf\bff\bfi\bix\bx (\b(_\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br,\b, _\bl_\be_\bn_\bg_\bt_\bh)\b)
The s\bsu\buf\bff\bfi\bix\bx operator evaluates _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br and returns the
- last _\bl_\be_\bn_\bg_\bt_\bh bytes of the result of that evaluation.
+ last _\bl_\be_\bn_\bg_\bt_\bh bytes of the result of that evaluation.
_\bL_\be_\bn_\bg_\bt_\bh is a numeric expression. If _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br or _\bl_\be_\bn_\bg_\bt_\bh
- evaluate to null, then the result is also null. If
+ evaluate to null, then the result is also null. If
_\bs_\bu_\bf_\bf_\bi_\bx 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.
o\bop\bpt\bti\bio\bon\bn _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be
- The o\bop\bpt\bti\bio\bon\bn operator returns the contents of the speci
- fied option in the packet to which the server is
+ The o\bop\bpt\bti\bio\bon\bn operator returns the contents of the speci
+ fied option in the packet to which the server is
responding.
- h\bha\bar\brd\bdw\bwa\bar\bre\be
-
- The h\bha\bar\brd\bdw\bwa\bar\bre\be operator returns a data string whose first
- element is the _\bh_\bt_\by_\bp_\be field of the packet being
-
3
dhcpd-options(5) dhcpd-options(5)
- considered, and whose subsequent elements are first
- _\bh_\bl_\be_\bn bytes of the _\bc_\bh_\ba_\bd_\bd_\br field of the packet, as speci
- fied in R\bRF\bFC\bC 2\b21\b13\b31\b1 . If there is no packet, or if the
- _\bh_\bl_\be_\bn field is invalid, then the result is null.
+ h\bha\bar\brd\bdw\bwa\bar\bre\be
+
+ The h\bha\bar\brd\bdw\bwa\bar\bre\be 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 _\bh_\bl_\be_\bn 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).
p\bpa\bac\bck\bke\bet\bt (\b(_\bo_\bf_\bf_\bs_\be_\bt,\b, _\bl_\be_\bn_\bg_\bt_\bh)\b)
A list of hexadecimal octet values, seperated by
colons, may be specified as a data expression.
- c\bco\bon\bnc\bca\bat\bt (\b(_\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b1,\b, _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b2)\b)
- 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.
-
+ c\bco\bon\bnc\bca\bat\bt (\b(_\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b1,\b, .\b..\b..\b.,\b, _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\bN)\b)
+ 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.
r\bre\bev\bve\ber\brs\bse\be (\b(_\bn_\bu_\bm_\be_\br_\bi_\bc_\b-_\be_\bx_\bp_\br_\b1,\b, _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b2)\b)
- 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.
l\ble\bea\bas\bse\bed\bd-\b-a\bad\bdd\bdr\bre\bes\bss\bs
- 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.
- b\bbi\bin\bna\bar\bry\by-\b-t\bto\bo-\b-a\bas\bsc\bci\bii\bi (\b(_\bn_\bu_\bm_\be_\br_\bi_\bc_\b-_\be_\bx_\bp_\br_\b1,\b, _\bn_\bu_\bm_\be_\br_\bi_\bc_\b-_\be_\bx_\bp_\br_\b2,\b, _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b1,\b,
- _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b2)\b)
- 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
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
+ b\bbi\bin\bna\bar\bry\by-\b-t\bto\bo-\b-a\bas\bsc\bci\bii\bi (\b(_\bn_\bu_\bm_\be_\br_\bi_\bc_\b-_\be_\bx_\bp_\br_\b1,\b, _\bn_\bu_\bm_\be_\br_\bi_\bc_\b-_\be_\bx_\bp_\br_\b2,\b, _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b1,\b,
+ _\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b2)\b)
+ 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:
e\ben\bnc\bco\bod\bde\be-\b-i\bin\bnt\bt (\b(_\bn_\bu_\bm_\be_\br_\bi_\bc_\b-_\be_\bx_\bp_\br,\b, _\bw_\bi_\bd_\bt_\bh)\b)
- 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.
+ p\bpi\bic\bck\bk-\b-f\bfi\bir\brs\bst\bt-\b-v\bva\bal\blu\bue\be (\b(_\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br_\b1 [ ... _\be_\bx_\bp_\brn ] )\b)
+ 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.
+
+ h\bho\bos\bst\bt-\b-d\bde\bec\bcl\bl-\b-n\bna\bam\bme\be
+ 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.
N\bNU\bUM\bME\bER\bRI\bIC\bC E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS
Numeric expressions are expressions that evaluate to an
e\bex\bxt\btr\bra\bac\bct\bt-\b-i\bin\bnt\bt (\b(_\bd_\ba_\bt_\ba_\b-_\be_\bx_\bp_\br,\b, _\bw_\bi_\bd_\bt_\bh)\b)
- The e\bex\bxt\btr\bra\bac\bct\bt-\b-i\bin\bnt\bt 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.
-
- _\bn_\bu_\bm_\bb_\be_\br
-
- Any number between zero and the maximum representable
- size may be specified as a numeric expression.
-
-S\bSE\bEE\bE A\bAL\bLS\bSO\bO
- dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcp-
- eval(5), dhcpd(8), dhclient(8), RFC2132, RFC2131.
-
-A\bAU\bUT\bTH\bHO\bOR\bR
- The Internet Software Consortium DHCP Distribution was
- written by Ted Lemon <mellon@isc.org> under a contract
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
- h\bht\btt\btp\bp:\b:/\b//\b/w\bww\bww\bw.\b.i\bis\bsc\bc.\b.o\bor\brg\bg/\b/i\bis\bsc\bc.\b.
-
-
-
-
-
-
-
-
-
-
+ The e\bex\bxt\btr\bra\bac\bct\bt-\b-i\bin\bnt\bt 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.
+ l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be
+ The duration of the current lease - that is, the dif
+ ference between the current time and the time that the
+ lease expires.
+ _\bn_\bu_\bm_\bb_\be_\br
+ Any number between zero and the maximum representable
+ size may be specified as a numeric expression.
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: D\bDY\bYN\bNA\bAM\bMI\bIC\bC D\bDN\bNS\bS U\bUP\bPD\bDA\bAT\bTE\bES\bS
+ 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.
+
+S\bSE\bEC\bCU\bUR\bRI\bIT\bTY\bY
+ 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 d\bdn\bns\bs-\b-
+ u\bup\bpd\bda\bat\bte\be expression. The d\bdn\bns\bs-\b-u\bup\bpd\bda\bat\bte\be 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 d\bdn\bns\bs-\b-u\bup\bpd\bda\bat\bte\beR\bR.\b.
+
+ 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 d\bdn\bns\bs-\b-u\bup\bpd\bda\bat\bte\be 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.
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcp-
+ eval(5), dhcpd(8), dhclient(8), RFC2132, RFC2131.
+A\bAU\bUT\bTH\bHO\bOR\bR
+ 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
+ h\bht\btt\btp\bp:\b:/\b//\b/w\bww\bww\bw.\b.i\bis\bsc\bc.\b.o\bor\brg\bg/\b/i\bis\bsc\bc.\b.
- 6
+ 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"
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;
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)
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;
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;
}
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;
#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"
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));
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,
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
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;
#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);
/* 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
{
/* 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
{
/* 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
{
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)
{
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
va_list list;
static char spaces [] = " ";
char lexbuf [256];
- int i, lix;
+ unsigned i, lix;
do_percentm (mbuf, fmt);
#ifndef NO_SNPRINTF
#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"
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;
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;
#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"
int executable_statement_dereference (ptr, name)
struct executable_statement **ptr;
- char *name;
+ const char *name;
{
struct executable_statement *bp;
struct executable_statement *r, *x;
int result;
int status;
- char *s, *t, *dot;
+ const char *s, *t, *dot;
int col;
if (!statements)
#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 ()
{
}
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... */
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;
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");
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;
return;
if (!len)
- len = strlen ((char *)name);
+ len = strlen ((const char *)name);
hashno = do_hash (name, len, table -> hash_count);
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) {
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;
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);
#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)
#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"
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
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;
/* 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;
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);
}
}
return 1;
}
+
/* public function to delete an A record */
int deleteA (lhs, rhs, lease)
const struct data_string *lhs;
#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
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;
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;
}
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;
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;
}
}
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;
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
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;
/* 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;
{
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;
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;
dp += 2;
break;
case 'b':
- sprintf (op, "%d", *(char *)dp++);
+ sprintf (op, "%d", *(const char *)dp++);
break;
case 'B':
sprintf (op, "%d", *dp++);
struct option_state *in_options;
struct option_state *cfg_options;
struct option_state *options;
- int code;
+ unsigned code;
{
struct option_cache *oc;
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;
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;
}
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);
struct option_cache *lookup_hashed_option (universe, options, code)
struct universe *universe;
struct option_state *options;
- int code;
+ unsigned code;
{
int hashix;
pair bptr;
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",
}
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");
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;
#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"
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
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)
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;
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)
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;
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);
#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"
int brace_count;
{
enum dhcp_token token;
- char *val;
+ const char *val;
do {
token = peek_token (&val, cfile);
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
token = next_token (&val, cfile);
if (token != SEMI) {
char *parse_string (cfile)
struct parse *cfile;
{
- char *val;
+ const char *val;
enum dhcp_token token;
char *s;
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;
*--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. */
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;
struct parse *cfile;
struct iaddr *addr;
{
- char *val;
+ const char *val;
enum dhcp_token token;
addr -> len = 4;
struct parse *cfile;
struct hardware *hardware;
{
- char *val;
+ const char *val;
enum dhcp_token token;
int hlen;
unsigned char *t;
struct parse *cfile;
TIME *timep;
{
- char *val;
+ const char *val;
enum dhcp_token token;
token = next_token (&val, cfile);
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) {
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;
*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,
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 };
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;
/* 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. */
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)
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. */
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;
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);
}
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);
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;
}
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 {
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);
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) {
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;
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;
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;
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;
int *lose;
{
enum dhcp_token token;
- char *val;
+ const char *val;
if (!executable_statement_allocate (result,
"parse_executable_statement"))
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.");
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);
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,
? 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,
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;
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;
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;
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];
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;
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 {
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;
int flag;
{
enum dhcp_token token;
- char *val;
+ const char *val;
unsigned char rf = flag;
struct expression *data = (struct expression *)0;
int status;
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);
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");
}
#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"
#endif
void dump_raw (buf, len)
- unsigned char *buf;
- int len;
+ const unsigned char *buf;
+ unsigned len;
{
int i;
char lbuf [80];
if (bp -> len)
dump_raw (bp -> name, bp -> len);
else
- log_info ((char *)bp -> name);
+ log_info ((const char *)bp -> name);
}
}
}
#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; \
#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;
}
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:
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;
}
}
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) {
}
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)",
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;
}
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);
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;
}
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);
}
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;
}
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) {
#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"
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
int token;
int declaration = 0;
struct name_server *sp, *sl, *ns;
#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"
{ "option-end", "e", &dhcp_universe, 255 },
};
-char *hardware_types [] = {
+const char *hardware_types [] = {
"unknown-0",
"ethernet",
"unknown-2",
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]);
}
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]);
}
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);
}
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;
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;
#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"
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;
(*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.");
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
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;
{
}
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;
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",
/* 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.
return 1;
#endif /* NSUPDATE */
+ case expr_none:
+ case expr_match:
case expr_substring:
case expr_suffix:
case expr_option:
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 {
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;
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");
s0 = 0;
} else {
result -> data = &result -> buffer -> data [0];
- result -> data [0] = len;
+ result -> buffer -> data [0] = len;
}
} else
result -> len = 0;
s0 = 0;
} else {
result -> data = &result -> buffer -> data [0];
- putUShort (result -> data, len);
+ putUShort (result -> buffer -> data, len);
}
} else
result -> len = 0;
s0 = 0;
} else {
result -> data = &result -> buffer -> data [0];
- putULong (result -> data, len);
+ putULong (result -> buffer -> data, len);
}
} else
result -> len = 0;
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!",
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;
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;
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 {
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 {
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)
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)
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;
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;
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;
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;
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);
void data_string_forget (data, name)
struct data_string *data;
- char *name;
+ const char *name;
{
if (data -> buffer)
buffer_dereference (&data -> buffer, name);
int indent;
{
struct expression *e;
- char *s;
+ const char *s;
char obuf [65];
int scol;
int width;
+++ /dev/null
-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
}
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;
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)
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;
"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);
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;
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;
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;
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;
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;
}
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");
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);
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 *);
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;
}
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;
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)
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);
};
struct auth_key {
- int length;
+ unsigned length;
u_int8_t data [1];
};
char *token_line;
char *prev_line;
char *cur_line;
- char *tlname;
+ const char *tlname;
int eol_token;
char line1 [81];
int warnings_occurred;
int file;
char *inbuf;
- int bufix, buflen;
- int bufsiz;
+ unsigned bufix, buflen;
+ unsigned bufsiz;
};
/* Variable-length array of data. */
struct packet {
struct dhcp_packet *raw;
int refcnt;
- int packet_length;
+ unsigned packet_length;
int packet_type;
int options_valid;
int client_port;
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;
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;
struct collection {
struct collection *next;
- char *name;
+ const char *name;
struct class *classes;
};
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;
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. */
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. */
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. */
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. */
/* 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 *,
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 *,
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;
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;
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));
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 *));
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 *));
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 *));
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 *));
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 */
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;
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 *));
/* 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;
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 */
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;
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 *));
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 *));
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 *));
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,
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 *));
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 *));
/* 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 *));
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 *);
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 *);
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 *);
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 *);
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 *);
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 *);
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 *);
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 *));
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 *));
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;
};
/* An internet address of up to 128 bits. */
struct iaddr {
- int len;
+ unsigned len;
unsigned char iabuf [16];
};
#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,
*/
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 *);
? (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);
/* 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;
omapi_datatype_t type;
union {
struct {
- int len;
+ unsigned len;
#define OMAPI_TYPED_DATA_NOBUFFER_LEN (sizeof (int) + \
sizeof (omapi_datatype_t) + \
sizeof (int))
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;
} 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 *,
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 *,
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. */
#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 *,
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 *,
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 *);
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);
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 *);
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 *);
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 *,
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 *),
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 *);
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 *);
/* 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;
};
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));
};
struct option {
- char *name;
- char *format;
+ const char *name;
+ const char *format;
struct universe *universe;
- int code;
+ unsigned code;
};
enum expression_context {
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;
}
isc_result_t omapi_object_dereference (omapi_object_t **h,
- char *name)
+ const char *name)
{
int outer_reference = 0;
int inner_reference = 0;
}
isc_result_t omapi_buffer_new (omapi_buffer_t **h,
- char *name)
+ const char *name)
{
omapi_buffer_t *t;
isc_result_t status;
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;
}
isc_result_t omapi_buffer_dereference (omapi_buffer_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
{
va_list l;
omapi_typed_data_t *new;
- int len;
- int val;
+ unsigned len;
+ unsigned val;
+ int intval;
char *s;
isc_result_t status;
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 *);
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:
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);
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;
}
isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
}
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;
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;
}
isc_result_t omapi_data_string_dereference (omapi_data_string_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
}
isc_result_t omapi_value_new (omapi_value_t **d,
- char *name)
+ const char *name)
{
omapi_value_t *new;
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;
}
isc_result_t omapi_value_dereference (omapi_value_t **h,
- char *name)
+ const char *name)
{
if (!h)
return ISC_R_INVALIDARG;
{
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;
/* 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. */
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;
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;
}
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;
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:
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)
#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;
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;
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;
}
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;
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;
}
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;
}
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;
#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;
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;
}
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;
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. */
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;
}
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;
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;
/* 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)
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");
}
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;
}
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)
#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)
{
/* 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;
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;
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)
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;
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;
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;
}
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");
}
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");
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;
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");
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");
#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 */
"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];
}
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 *,
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 *,
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;
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;
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;
}
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;
}
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;
}
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;
}
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;
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;
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;
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)
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);
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. */
}
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;
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;
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;
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;
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;
#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"
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
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;
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;
/* 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;
{
int i;
u_int8_t *circuit_id = 0;
- int circuit_id_len;
+ unsigned circuit_id_len;
struct interface_info *ip;
while (i < 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;
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;
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);
#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"
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];
#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"
}
struct class *find_class (name)
- char *name;
+ const char *name;
{
struct collection *lp;
struct class *cp;
#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"
{
int file;
struct parse *cfile;
- char *val;
+ const char *val;
enum dhcp_token token;
int declaration = 0;
int status;
{
struct parse *cfile;
int file;
- char *val;
+ const char *val;
enum dhcp_token token;
isc_result_t status;
int declaration;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct shared_network *share;
char *t, *n;
struct expression *expr;
struct option_cache *cache;
int lose;
struct data_string key_id;
+ int known;
token = peek_token (&val, cfile);
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) {
/* 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);
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
int type;
{
enum dhcp_token token;
- char *val;
+ const char *val;
struct failover_peer *peer;
TIME *tp;
char *name;
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
token = next_token (&val, cfile);
switch (token) {
int type;
{
enum dhcp_token token;
- char *val;
+ const char *val;
int done = 0;
struct pool *pool, **p;
struct permit *permit;
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
int rv;
token = next_token (&val, cfile);
struct parse *cfile;
{
enum dhcp_token token;
- char *val;
+ const char *val;
token = next_token (&val, cfile);
if (token != LBRACE) {
struct parse *cfile;
struct group *group;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct host_decl *host;
char *name;
}
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",
}
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,
"expecting hex list.");
skip_to_semi (cfile);
}
- s = (char *)t;
+ s = (const char *)t;
}
if (!buffer_allocate
(&host -> client_identifier.buffer,
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");
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;
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;
}
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))
struct parse *cfile;
struct group *group;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct shared_network *share;
char *name;
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");
struct parse *cfile;
struct group *group;
{
- char *val;
+ const char *val;
enum dhcp_token token;
struct group *g;
int declaration = 0;
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;
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];
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;
{
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;
#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"
}
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]);
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 {
}
int db_printable (s)
- char *s;
+ const char *s;
{
int i;
for (i = 0; s [i]; i++)
}
int db_printable_len (s, len)
- char *s;
- int len;
+ const char *s;
+ unsigned len;
{
int i;
for (i = 0; i < len; i++)
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)
#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"
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;
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);
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. */
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");
}
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.",
/* 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.",
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.",
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);
struct lease *lease;
{
int bufs = 0;
- int packet_length;
+ unsigned packet_length;
struct dhcp_packet raw;
struct sockaddr_in to;
struct in_addr from;
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;
void static_lease_dereference (lease, name)
struct lease *lease;
- char *name;
+ const char *name;
{
if (!(lease -> flags & STATIC_LEASE))
return;
#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[] =
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;
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. */
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. */
/* 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) {
dhcpd - Dynamic Host Configuration Protocol Server
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
- d\bdh\bhc\bcp\bpd\bd [ -\b-p\bp _\bp_\bo_\br_\bt ] [ -\b-f\bf ] [ -\b-d\bd ] [ -\b-q\bq ] [ -\b-c\bcf\bf _\bc_\bo_\bn_\bf_\bi_\bg_\b-_\bf_\bi_\bl_\be ]
- [ -\b-l\blf\bf _\bl_\be_\ba_\bs_\be_\b-_\bf_\bi_\bl_\be ] [ _\bi_\bf_\b0 [ _\b._\b._\b._\bi_\bf_\bN ] ]
+ d\bdh\bhc\bcp\bpd\bd [ -\b-p\bp _\bp_\bo_\br_\bt ] [ -\b-f\bf ] [ -\b-d\bd ] [ -\b-q\bq ] [ -\b-t\bt | -\b-T\bT ] [ -\b-c\bcf\bf
+ _\bc_\bo_\bn_\bf_\bi_\bg_\b-_\bf_\bi_\bl_\be ] [ -\b-l\blf\bf _\bl_\be_\ba_\bs_\be_\b-_\bf_\bi_\bl_\be ] [ _\bi_\bf_\b0 [ _\b._\b._\b._\bi_\bf_\bN ] ]
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
The Internet Software Consortium DHCP Server, dhcpd,
copyright message on startup. To avoid printing this
message, the -\b-q\bq flag may be specified.
+ The DHCP server reads two files on startup: a configura
+ tion file, and a lease database. If the -\b-t\bt 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 -\b-T\bT flag can be used to test the lease database file in
+ a similar way.
+
C\bCO\bON\bNF\bFI\bIG\bGU\bUR\bRA\bAT\bTI\bIO\bON\bN
The syntax of the dhcpd.conf(5) file is discussed seper
ately. This section should be used as an overview of the
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;
}
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.
-
-B\bBO\bOO\bOT\bTP\bP S\bSu\bup\bpp\bpo\bor\brt\bt
- 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
dhcpd(8) dhcpd(8)
+ have widely disparate values for default and maximum lease
+ times on each subnet.
+
+B\bBO\bOO\bOT\bTP\bP S\bSu\bup\bpp\bpo\bor\brt\bt
+ 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 {
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).
-
-F\bFI\bIL\bLE\bES\bS
- /\b/e\bet\btc\bc/\b/d\bdh\bhc\bcp\bpd\bd.\b.c\bco\bon\bnf\bf,\b, /\b/v\bva\bar\br/\b/d\bdb\bb/\b/d\bdh\bhc\bcp\bpd\bd.\b.l\ble\bea\bas\bse\bes\bs,\b, /\b/v\bva\bar\br/\b/r\bru\bun\bn/\b/d\bdh\bhc\bcp\bpd\bd.\b.p\bpi\bid\bd,\b,
- /\b/v\bva\bar\br/\b/d\bdb\bb/\b/d\bdh\bhc\bcp\bpd\bd.\b.l\ble\bea\bas\bse\bes\bs~\b~.\b.
+ 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).
+F\bFI\bIL\bLE\bES\bS
+ /\b/e\bet\btc\bc/\b/d\bdh\bhc\bcp\bpd\bd.\b.c\bco\bon\bnf\bf,\b, /\b/v\bva\bar\br/\b/d\bdb\bb/\b/d\bdh\bhc\bcp\bpd\bd.\b.l\ble\bea\bas\bse\bes\bs,\b, /\b/v\bva\bar\br/\b/r\bru\bun\bn/\b/d\bdh\bhc\bcp\bpd\bd.\b.p\bpi\bid\bd,\b,
+ /\b/v\bva\bar\br/\b/d\bdb\bb/\b/d\bdh\bhc\bcp\bpd\bd.\b.l\ble\bea\bas\bse\bes\bs~\b~.\b.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
dhclient(8), dhcrelay(8), dhcpd.conf(5), dhcpd.leases(5)
-
-
-
-
-
-
-
-
-
versions of the DHCP server, but it important to be aware
of it at lease for the time being.
+S\bSU\bUB\bBC\bCL\bLA\bAS\bSS\bSE\bES\bS
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
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.
+P\bPE\bER\bR-\b-C\bCL\bLA\bAS\bSS\bS A\bAD\bDD\bDR\bRE\bES\bSS\bS A\bAS\bSS\bSI\bIG\bGN\bNM\bME\bEN\bNT\bT L\bLI\bIM\bMI\bIT\bTS\bS
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
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)
-
-
+S\bSP\bPA\bAW\bWN\bNI\bIN\bNG\bG C\bCL\bLA\bAS\bSS\bSE\bES\bS
It is possible to declare a _\bs_\bp_\ba_\bw_\bn_\bi_\bn_\bg _\bc_\bl_\ba_\bs_\bs. A spawning
class is a class that automatically produces subclasses
based on what the client sends. The reason that spawning
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;
ple is given only because it is a fairly straightforward
one.
-R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: D\bDE\bEC\bCL\bLA\bAR\bRA\bAT\bTI\bIO\bON\bNS\bS
- T\bTh\bhe\be _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: E\bEV\bVE\bEN\bNT\bTS\bS
+ 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.
- s\bsh\bha\bar\bre\bed\bd-\b-n\bne\bet\btw\bwo\bor\brk\bk _\bn_\ba_\bm_\be {\b{
- [ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs ]
- [ _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn_\bs ]
- }\b}
+ 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 _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk 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 _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk statement. Parameters
- specified in the _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk 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 o\bon\bn 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
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) {
+ }
+ }
+ }
+
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: D\bDE\bEC\bCL\bLA\bAR\bRA\bAT\bTI\bIO\bON\bNS\bS
+ T\bTh\bhe\be _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+
+ s\bsh\bha\bar\bre\bed\bd-\b-n\bne\bet\btw\bwo\bor\brk\bk _\bn_\ba_\bm_\be {\b{
+ [ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs ]
+ [ _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn_\bs ]
+ }\b}
+
+ The _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk 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 _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk statement. Parameters
+ specified in the _\bs_\bh_\ba_\br_\be_\bd_\b-_\bn_\be_\bt_\bw_\bo_\br_\bk 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
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 _\br_\ba_\bn_\bg_\be declaration.
in a range. All IP addresses in the range should be in
the subnet in which the _\br_\ba_\bn_\bg_\be statement is declared. The
_\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp 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, _\bh_\bi_\bg_\bh_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs can be omitted.
the network to which the client is attached, then multiple
h\bho\bos\bst\bt 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 h\bho\bos\bst\bt statement must be specified without a
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.
R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: A\bAL\bLL\bLO\bOW\bW A\bAN\bND\bD D\bDE\bEN\bNY\bY
The u\bun\bnk\bkn\bno\bow\bwn\bn-\b-c\bcl\bli\bie\ben\bnt\bts\bs flag is used to tell dhcpd whether or
not to dynamically assign addresses to unknown clients.
Dynamic address assignment to unknown clients is a\bal\bll\blo\bow\bwed
+
+
+
+ 13
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
by default.
T\bTh\bhe\be _\bb_\bo_\bo_\bt_\bp k\bke\bey\byw\bwo\bor\brd\bd
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
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:
a\bau\but\bth\bhe\ben\bnt\bti\bic\bca\bat\bte\bed\bd c\bcl\bli\bie\ben\bnt\bts\bs;\b;
-
-
- 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.
R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS
T\bTh\bhe\be _\bd_\be_\bf_\ba_\bu_\bl_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bt_\bi_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+
+
+ 15
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
d\bde\bef\bfa\bau\bul\blt\bt-\b-l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be _\bt_\bi_\bm_\be;\b;
_\bT_\bi_\bm_\be should be the length in seconds that will be assigned
_\bS_\be_\bc_\bo_\bn_\bd_\bs 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,
a physical hardware interface type. Currently, only the
e\bet\bth\bhe\ber\brn\bne\bet\bt and t\bto\bok\bke\ben\bn-\b-r\bri\bin\bng\bg types are recognized, although
support for a f\bfd\bdd\bdi\bi hardware type (and others) would also
+
+
+
+ 16
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
be desirable. The _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs should be a set of
hexadecimal octets (numbers from 0 through ff) seperated
by colons. The _\bh_\ba_\br_\bd_\bw_\ba_\br_\be statement may also be used for
n\bne\bex\bxt\bt-\b-s\bse\ber\brv\bve\ber\br _\bs_\be_\br_\bv_\be_\br_\b-_\bn_\ba_\bm_\be;\b;
The _\bn_\be_\bx_\bt_\b-_\bs_\be_\br_\bv_\be_\br 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 _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be statement) is to be loaded.
_\bS_\be_\br_\bv_\be_\br_\b-_\bn_\ba_\bm_\be should be a numeric IP address or a domain
d\bdy\byn\bna\bam\bmi\bic\bc-\b-b\bbo\boo\bot\btp\bp-\b-l\ble\bea\bas\bse\be-\b-c\bcu\but\bto\bof\bff\bf _\bd_\ba_\bt_\be;\b;
+
+
+
+ 17
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
The _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bc_\bu_\bt_\bo_\bf_\bf statement sets the ending
time for all leases assigned dynamically to BOOTP clients.
Because BOOTP clients do not have any way of renewing
d\bdy\byn\bna\bam\bmi\bic\bc-\b-b\bbo\boo\bot\btp\bp-\b-l\ble\bea\bas\bse\be-\b-l\ble\ben\bng\bgt\bth\bh _\bl_\be_\bn_\bg_\bt_\bh;\b;
The _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bl_\be_\bn_\bg_\bt_\bh 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
u\bus\bse\be-\b-h\bho\bos\bst\bt-\b-d\bde\bec\bcl\bl-\b-n\bna\bam\bme\bes\bs _\bf_\bl_\ba_\bg;\b;
+
+
+ 18
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
If the _\bu_\bs_\be_\b-_\bh_\bo_\bs_\bt_\b-_\bd_\be_\bc_\bl_\b-_\bn_\ba_\bm_\be_\bs 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
T\bTh\bhe\be _\ba_\bu_\bt_\bh_\bo_\br_\bi_\bt_\ba_\bt_\bi_\bv_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
-
-
-
- 17
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
a\bau\but\bth\bho\bor\bri\bit\bta\bat\bti\biv\bve\be;\b;
n\bno\bot\bt a\bau\but\bth\bho\bor\bri\bit\bta\bat\bti\biv\bve\be;\b;
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
T\bTh\bhe\be _\ba_\bl_\bw_\ba_\by_\bs_\b-_\bb_\br_\bo_\ba_\bd_\bc_\ba_\bs_\bt s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
-
-
- 18
-
-
-
-
-
-dhcpd.conf(5) dhcpd.conf(5)
-
-
a\bal\blw\bwa\bay\bys\bs-\b-b\bbr\bro\boa\bad\bdc\bca\bas\bst\bt _\bf_\bl_\ba_\bg;\b;
The DHCP and BOOTP protocols both require DHCP and BOOTP
forgotten any lease not mentioned in the DHCPREQUEST -
i.e., the client has only a single network interface _\ba_\bn_\bd
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.
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
option, which allows vendors to define their own options
that will be sent encapsulated in a standard DHCP option.
The format of the v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs 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.
o\bop\bpt\bti\bio\bon\bns\bs 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 C\bCL\bLI\bIE\bEN\bNT\bT C\bCL\bLA\bAS\bSS\bSI\bIN\bNG\bG 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:
o\bop\bpt\bti\bio\bon\bn s\bsp\bpa\bac\bce\be _\bn_\ba_\bm_\be ;\b;
- The name can then be used in option definitions, as
- described in the d\bdh\bhc\bcp\bp-\b-o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b) manual page. For exam
+ The name can then be used in option definitions, as
+ described in the d\bdh\bhc\bcp\bp-\b-o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b) manual page. For exam
ple:
option space SUNW;
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 C\bCL\bLI\bIE\bEN\bNT\bT C\bCL\bLA\bAS\bSS\bSI\bIN\bNG\bG section.
- Using the option space definition we just did, the C\bCL\bLI\bIE\bEN\bNT\bT
- C\bCL\bLA\bAS\bSS\bSI\bIN\bNG\bG 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;
}
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";
- 21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 23
#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"
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;
}
struct host_decl *find_hosts_by_uid (data, len)
- unsigned char *data;
- int len;
+ const unsigned char *data;
+ unsigned len;
{
struct host_decl *foo;
{
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;
void abandon_lease (lease, message)
struct lease *lease;
- char *message;
+ const char *message;
{
struct lease lt;
}
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);
}
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);
#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"
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;
}
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;
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;
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;
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;
}
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;
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;
"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)) {
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;
}
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;
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;
}
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;