2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 14:25:41 +00:00

More portable internet addresses; fix endian bug; fix parser bugs

This commit is contained in:
Ted Lemon
1996-02-06 20:25:56 +00:00
parent bbeaeedce3
commit 089fb364df
35 changed files with 1283 additions and 696 deletions

View File

@@ -1,8 +1,9 @@
SRCS = dhcpd.c options.c errwarn.c convert.c conflex.c confpars.c \
tree.c memory.c bootp.c dhcp.c alloc.c print.c socket.c \
hash.c tables.c
hash.c tables.c inet.c
PROG = dhcpd
.include <bsd.prog.mk>
CFLAGS += -DDEBUG -g
CFLAGS += -DDEBUG -g -Wall -Wstrict-prototypes -Wno-unused \
-Wno-uninitialized -Werror

View File

@@ -1,6 +1,6 @@
/* alloc.c
Memory allocation...
Memory allocation... */
/*
* Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
@@ -55,7 +55,7 @@ VOIDPTR dmalloc (size, name)
{
VOIDPTR foo = (VOIDPTR)malloc (size);
if (!foo)
warn ("No memory for %s.\n");
warn ("No memory for %s.", name);
return foo;
}

View File

@@ -130,7 +130,7 @@ void bootp (packet)
/* If we got the magic cookie, send it back. */
if (packet -> options_valid)
memcpy (reply -> options, packet -> raw -> options, 4);
to.sin_port = packet -> client.sin_port;
to.sin_port = htons (packet -> client_port);
to.sin_family = AF_INET;
to.sin_len = sizeof to;
memset (to.sin_zero, 0, sizeof to.sin_zero);

View File

@@ -1,6 +1,6 @@
/* alloc.c
Memory allocation...
Memory allocation... */
/*
* Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
@@ -55,7 +55,7 @@ VOIDPTR dmalloc (size, name)
{
VOIDPTR foo = (VOIDPTR)malloc (size);
if (!foo)
warn ("No memory for %s.\n");
warn ("No memory for %s.", name);
return foo;
}

View File

@@ -87,6 +87,9 @@ static int get_token (cfile)
int c;
int i;
int ttok;
#ifdef DEBUG_TOKENS
static char tb [2];
#endif
do {
c = get_char (cfile);
@@ -109,7 +112,13 @@ static int get_token (cfile)
ttok = read_num_or_atom (c, cfile);
break;
} else {
#ifdef DEBUG_TOKENS
tb [0] = c;
tb [1] = 0;
tval = tb;
#else
tval = 0;
#endif
ttok = c;
break;
}
@@ -131,6 +140,9 @@ int next_token (rval, cfile)
}
if (rval)
*rval = tval;
#ifdef DEBUG_TOKENS
fprintf (stderr, "%s:%d ", tval, rv);
#endif
return rv;
}
@@ -142,6 +154,9 @@ int peek_token (rval, cfile)
token = get_token (cfile);
if (rval)
*rval = tval;
#ifdef DEBUG_TOKENS
fprintf (stderr, "(%s:%d) ", tval, token);
#endif
return token;
}
@@ -255,11 +270,15 @@ static int intern (atom, dfv)
int dfv;
{
switch (atom [0]) {
case 'h':
if (!strcasecmp (atom + 1, "ost"))
return HOST;
if (!strcasecmp (atom + 1, "ardware"))
return HARDWARE;
case 'c':
if (!strcasecmp (atom + 1, "lass"))
return CLASS;
break;
case 'e':
if (!strcasecmp (atom + 1, "thernet"))
return ETHERNET;
if (!strcasecmp (atom + 1, "nds"))
return ENDS;
break;
case 'f':
if (!strcasecmp (atom + 1, "ilename"))
@@ -267,14 +286,36 @@ static int intern (atom, dfv)
if (!strcasecmp (atom + 1, "ixed-address"))
return FIXED_ADDR;
break;
case 'e':
if (!strcasecmp (atom + 1, "thernet"))
return ETHERNET;
case 'h':
if (!strcasecmp (atom + 1, "ost"))
return HOST;
if (!strcasecmp (atom + 1, "ardware"))
return HARDWARE;
break;
case 'l':
if (!strcasecmp (atom + 1, "ease"))
return LEASE;
break;
case 'o':
if (!strcasecmp (atom + 1, "ption"))
return OPTION;
break;
case 'r':
if (!strcasecmp (atom + 1, "ange"))
return RANGE;
break;
case 's':
if (!strcasecmp (atom + 1, "tarts"))
return STARTS;
break;
case 't':
if (!strcasecmp (atom + 1, "timestamp"))
return TIMESTAMP;
break;
case 'u':
if (!strcasecmp (atom + 1, "id"))
return UID;
break;
}
return dfv;
}

View File

@@ -46,6 +46,8 @@ static char copyright[] =
#include "dhcpd.h"
static INLINE int do_hash PROTO ((char *, int, int));
struct hash_table *new_hash ()
{
struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE, "new_hash");
@@ -56,7 +58,7 @@ struct hash_table *new_hash ()
return rv;
}
static INLINE do_hash (name, len, size)
static INLINE int do_hash (name, len, size)
char *name;
int len;
int size;

154
common/inet.c Normal file
View File

@@ -0,0 +1,154 @@
/* inet.c
Subroutines to manipulate internet addresses in a safely portable
way... */
/*
* Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of The Internet Software Consortium nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
* Enterprises. To learn more about the Internet Software Consortium,
* see ``http://www.vix.com/isc''. To learn more about Vixie
* Enterprises, see ``http://www.vix.com''.
*/
#include "dhcpd.h"
/* Return just the network number of an internet address... */
struct iaddr subnet_number (addr, mask)
struct iaddr addr;
struct iaddr mask;
{
int i;
struct iaddr rv;
rv.len = 0;
/* Both addresses must have the same length... */
if (addr.len != mask.len)
return rv;
rv.len = addr.len;
for (i = 0; i < rv.len; i++)
rv.iabuf [i] = addr.iabuf [i] & mask.iabuf [i];
return rv;
}
/* Combine a network number and a integer to produce an internet address.
This won't work for subnets with more than 32 bits of host address, but
maybe this isn't a problem. */
struct iaddr ip_addr (subnet, mask, host_address)
struct iaddr subnet;
struct iaddr mask;
unsigned long host_address;
{
int i, j, k;
unsigned long swaddr;
struct iaddr rv;
unsigned char habuf [sizeof swaddr];
swaddr = htonl (host_address);
memcpy (habuf, &swaddr, sizeof swaddr);
/* Combine the subnet address and the host address. If
the host address is bigger than can fit in the subnet,
return a zero-length iaddr structure. */
rv = subnet;
j = rv.len - sizeof habuf;
for (i = sizeof habuf - 1; i >= 0; i--) {
if (mask.iabuf [i + j]) {
if (habuf [i] > ~mask.iabuf [i + j]) {
rv.len = 0;
return rv;
}
for (k = i - 1; k >= 0; k--) {
if (habuf [k]) {
rv.len = 0;
return rv;
}
}
rv.iabuf [i + j] &= habuf [i];
break;
}
rv.iabuf [i + j] = habuf [i];
}
return rv;
}
unsigned long host_addr (addr, mask)
struct iaddr addr;
struct iaddr mask;
{
int i;
unsigned long swaddr;
struct iaddr rv;
rv.len = 0;
/* Mask out the network bits... */
rv.len = addr.len;
for (i = 0; i < rv.len; i++)
rv.iabuf [i] = addr.iabuf [i] & ~mask.iabuf [i];
/* Copy out up to 32 bits... */
memcpy (&swaddr, &rv.iabuf [rv.len - sizeof swaddr], sizeof swaddr);
/* Swap it and return it. */
return ntohl (swaddr);
}
int addr_eq (addr1, addr2)
struct iaddr addr1, addr2;
{
if (addr1.len != addr2.len)
return 0;
return memcmp (addr1.iabuf, addr2.iabuf, addr1.len) == 0;
}
char *piaddr (addr)
struct iaddr addr;
{
static char pbuf [4 * 16];
char *s = pbuf;
int i;
if (addr.len == 0) {
strcpy (s, "<null address>");
}
for (i = 0; i < addr.len; i++) {
sprintf (s, "%s%d", i ? "." : "", addr.iabuf [i]);
s += strlen (s);
}
return pbuf;
}

View File

@@ -92,11 +92,11 @@ struct host_decl *find_host_by_addr (htype, haddr, hlen)
}
void new_address_range (low, high, netmask)
struct in_addr low, high, netmask;
struct iaddr low, high, netmask;
{
struct lease *address_range, *lp, *plp;
struct subnet *subnet;
struct in_addr net;
struct iaddr net;
int i, max;
char lowbuf [16], highbuf [16], netbuf [16];
@@ -111,11 +111,11 @@ void new_address_range (low, high, netmask)
lease_hw_addr_hash = new_hash ();
/* Make sure that high and low addresses are in same subnet. */
net.s_addr = SUBNET (low, netmask);
if (net.s_addr != SUBNET (high, netmask)) {
strcpy (lowbuf, inet_ntoa (low));
strcpy (highbuf, inet_ntoa (high));
strcpy (netbuf, inet_ntoa (netmask));
net = subnet_number (low, netmask);
if (!addr_eq (net, subnet_number (high, netmask))) {
strcpy (lowbuf, piaddr (low));
strcpy (highbuf, piaddr (high));
strcpy (netbuf, piaddr (netmask));
error ("Address range %s to %s, netmask %s spans %s!",
lowbuf, highbuf, netbuf, "multiple subnets");
}
@@ -133,27 +133,28 @@ void new_address_range (low, high, netmask)
}
/* Get the high and low host addresses... */
max = HOST_ADDR (high, netmask);
i = HOST_ADDR (low, netmask);
max = host_addr (high, netmask);
i = host_addr (low, netmask);
/* Allow range to be specified high-to-low as well as low-to-high. */
if (i > max) {
max = i;
i = HOST_ADDR (high, netmask);
i = host_addr (high, netmask);
}
/* Get a lease structure for each address in the range. */
address_range = new_leases (max - i + 1, "new_address_range");
if (!address_range) {
strcpy (lowbuf, inet_ntoa (low));
strcpy (highbuf, inet_ntoa (high));
strcpy (lowbuf, piaddr (low));
strcpy (highbuf, piaddr (high));
error ("No memory for address range %s-%s.", lowbuf, highbuf);
}
memset (address_range, 0, (sizeof *address_range) * (max - i + 1));
/* Fill out the lease structures with some minimal information. */
for (; i <= max; i++) {
address_range [i].ip_addr.s_addr = IP_ADDR (subnet -> net, i);
address_range [i].ip_addr =
ip_addr (subnet -> net, subnet -> netmask, i);
address_range [i].starts =
address_range [i].timestamp = MIN_TIME;
address_range [i].ends = MIN_TIME;
@@ -163,7 +164,8 @@ void new_address_range (low, high, netmask)
address_range [i].next = subnet -> leases;
address_range [i].prev = (struct lease *)0;
subnet -> leases = &address_range [i];
address_range [i].next -> prev = subnet -> leases;
if (address_range [i].next)
address_range [i].next -> prev = subnet -> leases;
add_hash (lease_ip_addr_hash,
(char *)&address_range [i].ip_addr,
sizeof address_range [i].ip_addr,
@@ -173,16 +175,16 @@ void new_address_range (low, high, netmask)
/* Find out if any dangling leases are in range... */
plp = (struct lease *)0;
for (lp = dangling_leases; lp; lp = lp -> next) {
struct in_addr lnet;
struct iaddr lnet;
int lhost;
lnet.s_addr = SUBNET (lp -> ip_addr, subnet -> netmask);
lhost = HOST_ADDR (lp -> ip_addr, subnet -> netmask);
lnet = subnet_number (lp -> ip_addr, subnet -> netmask);
lhost = host_addr (lp -> ip_addr, subnet -> netmask);
/* If it's in range, fill in the real lease structure with
the dangling lease's values, and remove the lease from
the list of dangling leases. */
if (lnet.s_addr == subnet -> net.s_addr &&
if (addr_eq (lnet, subnet -> net) &&
lhost >= i && lhost <= max) {
if (plp) {
plp -> next = lp -> next;
@@ -198,12 +200,12 @@ void new_address_range (low, high, netmask)
}
struct subnet *find_subnet (subnet)
struct in_addr subnet;
struct iaddr subnet;
{
struct subnet *rv;
return (struct subnet *)hash_lookup (subnet_hash,
(char *)&subnet, sizeof subnet);
(char *)subnet.iabuf, subnet.len);
}
/* Enter a new subnet into the subnet hash. */
@@ -211,8 +213,8 @@ struct subnet *find_subnet (subnet)
void enter_subnet (subnet)
struct subnet *subnet;
{
add_hash (subnet_hash, (char *)&subnet -> net,
sizeof subnet -> net, (unsigned char *)subnet);
add_hash (subnet_hash, (char *)subnet -> net.iabuf,
subnet -> net.len, (unsigned char *)subnet);
}
/* Enter a lease into the system. This is called by the parser each
@@ -232,7 +234,7 @@ void enter_lease (lease)
comp = new_lease ("enter_lease");
if (!comp) {
error ("No memory for lease %s\n",
inet_ntoa (lease -> ip_addr));
piaddr (lease -> ip_addr));
}
*comp = *lease;
lease -> next = dangling_leases;
@@ -273,7 +275,7 @@ void supersede_lease (comp, lease)
lease -> hardware_addr.haddr,
comp -> hardware_addr.hlen))))) {
warn ("Lease conflict at %s",
inet_ntoa (comp -> ip_addr));
piaddr (comp -> ip_addr));
} else {
/* If there's a Unique ID, dissociate it from the hash
table if necessary, and always free it. */
@@ -289,13 +291,13 @@ void supersede_lease (comp, lease)
free (comp -> uid);
}
if (comp -> hardware_addr.htype &&
(comp -> hardware_addr.hlen !=
lease -> hardware_addr.hlen) ||
(comp -> hardware_addr.htype !=
lease -> hardware_addr.htype) ||
memcmp (comp -> hardware_addr.haddr,
lease -> hardware_addr.haddr,
comp -> hardware_addr.hlen)) {
((comp -> hardware_addr.hlen !=
lease -> hardware_addr.hlen) ||
(comp -> hardware_addr.htype !=
lease -> hardware_addr.htype) ||
memcmp (comp -> hardware_addr.haddr,
lease -> hardware_addr.haddr,
comp -> hardware_addr.hlen))) {
delete_hash_entry (lease_hw_addr_hash,
comp -> hardware_addr.haddr,
comp -> hardware_addr.hlen);
@@ -393,3 +395,24 @@ void supersede_lease (comp, lease)
comp -> contain -> insertion_point = comp;
}
}
/* Locate the lease associated with a given IP address... */
struct lease *find_lease_by_ip_addr (addr)
struct iaddr addr;
{
struct lease *lease = (struct lease *)hash_lookup (lease_ip_addr_hash,
addr.iabuf,
addr.len);
return lease;
}
struct lease *find_lease_by_uid (uid, len)
unsigned char *uid;
int len;
{
struct lease *lease = (struct lease *)hash_lookup (lease_uid_hash,
uid, len);
return lease;
}

View File

@@ -152,7 +152,7 @@ void parse_option_buffer (packet, buffer, length)
void cons_options (inpacket, outpacket, hp, overload)
struct packet *inpacket;
struct dhcp_packet *outpacket;
struct packet *outpacket;
struct host_decl *hp;
int overload; /* Overload flags that may be set. */
{
@@ -163,13 +163,13 @@ void cons_options (inpacket, outpacket, hp, overload)
unsigned char *priority_list;
int priority_len;
unsigned char *buffer = inpacket -> raw -> options;
int buflen, bufix;
int buflen, bufix = 0;
int reserved = 3; /* Reserved space for overload. */
unsigned char *overload_ptr = (unsigned char *)0;
int stored_length [256];
int missed = 0;
int missed_code;
int missed_length;
int missed_code = 0;
int missed_length = 0;
int result;
int i;

View File

@@ -44,6 +44,8 @@ static char copyright[] =
"@(#) Copyright (c) 1995 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
char *print_hw_addr (htype, hlen, data)
int htype;
int hlen;

View File

@@ -159,6 +159,7 @@ unsigned char packbuf [65536]; /* Should cover the gnarliest MTU... */
void dispatch ()
{
struct sockaddr_in from;
struct iaddr ifrom;
int fromlen = sizeof from;
fd_set r, w, x;
struct socklist *l;
@@ -201,7 +202,10 @@ void dispatch ()
note ("request from %s, port %d",
inet_ntoa (from.sin_addr),
htons (from.sin_port));
do_packet (packbuf, result, &from, fromlen, l -> sock);
ifrom.len = 4;
memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
do_packet (packbuf, result, from.sin_port,
ifrom, l -> sock);
}
} while (1);
}

View File

@@ -65,262 +65,262 @@ static char copyright[] =
struct universe dhcp_universe;
struct option dhcp_options [256] = {
"pad", "", &dhcp_universe, 0,
"subnet-mask", "I", &dhcp_universe, 1,
"time-offset", "l", &dhcp_universe, 2,
"routers", "IA", &dhcp_universe, 3,
"time-servers", "IA", &dhcp_universe, 4,
"name-servers", "IA", &dhcp_universe, 5,
"domain-name-servers", "IA", &dhcp_universe, 6,
"log-servers", "IA", &dhcp_universe, 7,
"cookie-servers", "IA", &dhcp_universe, 8,
"lpr-servers", "IA", &dhcp_universe, 9,
"impress-servers", "IA", &dhcp_universe, 10,
"resource-location-servers", "IA", &dhcp_universe, 11,
"host-name", "t", &dhcp_universe, 12,
"boot-size", "S", &dhcp_universe, 13,
"merit-dump", "t", &dhcp_universe, 14,
"domain-name", "t", &dhcp_universe, 15,
"swap-server", "I", &dhcp_universe, 16,
"root-path", "t", &dhcp_universe, 17,
"extensions-path", "t", &dhcp_universe, 18,
"ip-forwarding", "f", &dhcp_universe, 19,
"non-local-source-routing", "f", &dhcp_universe, 20,
"policy-filter", "IIA", &dhcp_universe, 21,
"max-dgram-reassembly", "S", &dhcp_universe, 22,
"default-ip-ttl", "B", &dhcp_universe, 23,
"path-mtu-aging-timeout", "L", &dhcp_universe, 24,
"path-mtu-plateau-table", "SA", &dhcp_universe, 25,
"interface-mtu", "S", &dhcp_universe, 26,
"all-subnets-local", "f", &dhcp_universe, 27,
"broadcast-address", "I", &dhcp_universe, 28,
"perform-mask-discovery", "f", &dhcp_universe, 29,
"mask-supplier", "f", &dhcp_universe, 30,
"router-discovery", "f", &dhcp_universe, 31,
"router-solicitation-address", "I", &dhcp_universe, 32,
"static-routes", "IIA", &dhcp_universe, 33,
"trailer-encapsulation", "f", &dhcp_universe, 34,
"arp-cache-timeout", "L", &dhcp_universe, 35,
"ieee802.3-encapsulation", "f", &dhcp_universe, 36,
"default-tcp-ttl", "B", &dhcp_universe, 37,
"tcp-keepalive-interval", "L", &dhcp_universe, 38,
"tcp-keepalive-garbage", "f", &dhcp_universe, 39,
"nis-domain", "t", &dhcp_universe, 40,
"nis-servers", "IA", &dhcp_universe, 41,
"ntp-servers", "IA", &dhcp_universe, 42,
"vendor-encapsulated-options", "t", &dhcp_universe, 43,
"netbios-name-servers", "IA", &dhcp_universe, 44,
"netbios-dd-server", "IA", &dhcp_universe, 45,
"netbios-node-type", "B", &dhcp_universe, 46,
"netbios-scope", "t", &dhcp_universe, 47,
"font-servers", "IA", &dhcp_universe, 48,
"x-display-manager", "IA", &dhcp_universe, 49,
"dhcp-requested-address", "I", &dhcp_universe, 50,
"dhcp-lease-time", "L", &dhcp_universe, 51,
"dhcp-option-overload", "B", &dhcp_universe, 52,
"dhcp-message-type", "B", &dhcp_universe, 53,
"dhcp-server-identifier", "I", &dhcp_universe, 54,
"dhcp-parameter-request-list", "BA", &dhcp_universe, 55,
"dhcp-message", "t", &dhcp_universe, 56,
"dhcp-max-message-size", "S", &dhcp_universe, 57,
"dhcp-renewal-time", "L", &dhcp_universe, 58,
"dhcp-rebinding-time", "L", &dhcp_universe, 59,
"dhcp-class-identifier", "t", &dhcp_universe, 60,
"dhcp-client-identifier", "t", &dhcp_universe, 61,
"option-62", "", &dhcp_universe, 62,
"option-63", "", &dhcp_universe, 63,
"option-64", "", &dhcp_universe, 64,
"option-65", "", &dhcp_universe, 65,
"option-66", "", &dhcp_universe, 66,
"option-67", "", &dhcp_universe, 67,
"option-68", "", &dhcp_universe, 68,
"option-69", "", &dhcp_universe, 69,
"option-70", "", &dhcp_universe, 70,
"option-71", "", &dhcp_universe, 71,
"option-72", "", &dhcp_universe, 72,
"option-73", "", &dhcp_universe, 73,
"option-74", "", &dhcp_universe, 74,
"option-75", "", &dhcp_universe, 75,
"option-76", "", &dhcp_universe, 76,
"option-77", "", &dhcp_universe, 77,
"option-78", "", &dhcp_universe, 78,
"option-79", "", &dhcp_universe, 79,
"option-80", "", &dhcp_universe, 80,
"option-81", "", &dhcp_universe, 81,
"option-82", "", &dhcp_universe, 82,
"option-83", "", &dhcp_universe, 83,
"option-84", "", &dhcp_universe, 84,
"option-85", "", &dhcp_universe, 85,
"option-86", "", &dhcp_universe, 86,
"option-87", "", &dhcp_universe, 87,
"option-88", "", &dhcp_universe, 88,
"option-89", "", &dhcp_universe, 89,
"option-90", "", &dhcp_universe, 90,
"option-91", "", &dhcp_universe, 91,
"option-92", "", &dhcp_universe, 92,
"option-93", "", &dhcp_universe, 93,
"option-94", "", &dhcp_universe, 94,
"option-95", "", &dhcp_universe, 95,
"option-96", "", &dhcp_universe, 96,
"option-97", "", &dhcp_universe, 97,
"option-98", "", &dhcp_universe, 98,
"option-99", "", &dhcp_universe, 99,
"option-100", "", &dhcp_universe, 100,
"option-101", "", &dhcp_universe, 101,
"option-102", "", &dhcp_universe, 102,
"option-103", "", &dhcp_universe, 103,
"option-104", "", &dhcp_universe, 104,
"option-105", "", &dhcp_universe, 105,
"option-106", "", &dhcp_universe, 106,
"option-107", "", &dhcp_universe, 107,
"option-108", "", &dhcp_universe, 108,
"option-109", "", &dhcp_universe, 109,
"option-110", "", &dhcp_universe, 110,
"option-111", "", &dhcp_universe, 111,
"option-112", "", &dhcp_universe, 112,
"option-113", "", &dhcp_universe, 113,
"option-114", "", &dhcp_universe, 114,
"option-115", "", &dhcp_universe, 115,
"option-116", "", &dhcp_universe, 116,
"option-117", "", &dhcp_universe, 117,
"option-118", "", &dhcp_universe, 118,
"option-119", "", &dhcp_universe, 119,
"option-120", "", &dhcp_universe, 120,
"option-121", "", &dhcp_universe, 121,
"option-122", "", &dhcp_universe, 122,
"option-123", "", &dhcp_universe, 123,
"option-124", "", &dhcp_universe, 124,
"option-125", "", &dhcp_universe, 125,
"option-126", "", &dhcp_universe, 126,
"option-127", "", &dhcp_universe, 127,
"option-128", "", &dhcp_universe, 128,
"option-129", "", &dhcp_universe, 129,
"option-130", "", &dhcp_universe, 130,
"option-131", "", &dhcp_universe, 131,
"option-132", "", &dhcp_universe, 132,
"option-133", "", &dhcp_universe, 133,
"option-134", "", &dhcp_universe, 134,
"option-135", "", &dhcp_universe, 135,
"option-136", "", &dhcp_universe, 136,
"option-137", "", &dhcp_universe, 137,
"option-138", "", &dhcp_universe, 138,
"option-139", "", &dhcp_universe, 139,
"option-140", "", &dhcp_universe, 140,
"option-141", "", &dhcp_universe, 141,
"option-142", "", &dhcp_universe, 142,
"option-143", "", &dhcp_universe, 143,
"option-144", "", &dhcp_universe, 144,
"option-145", "", &dhcp_universe, 145,
"option-146", "", &dhcp_universe, 146,
"option-147", "", &dhcp_universe, 147,
"option-148", "", &dhcp_universe, 148,
"option-149", "", &dhcp_universe, 149,
"option-150", "", &dhcp_universe, 150,
"option-151", "", &dhcp_universe, 151,
"option-152", "", &dhcp_universe, 152,
"option-153", "", &dhcp_universe, 153,
"option-154", "", &dhcp_universe, 154,
"option-155", "", &dhcp_universe, 155,
"option-156", "", &dhcp_universe, 156,
"option-157", "", &dhcp_universe, 157,
"option-158", "", &dhcp_universe, 158,
"option-159", "", &dhcp_universe, 159,
"option-160", "", &dhcp_universe, 160,
"option-161", "", &dhcp_universe, 161,
"option-162", "", &dhcp_universe, 162,
"option-163", "", &dhcp_universe, 163,
"option-164", "", &dhcp_universe, 164,
"option-165", "", &dhcp_universe, 165,
"option-166", "", &dhcp_universe, 166,
"option-167", "", &dhcp_universe, 167,
"option-168", "", &dhcp_universe, 168,
"option-169", "", &dhcp_universe, 169,
"option-170", "", &dhcp_universe, 170,
"option-171", "", &dhcp_universe, 171,
"option-172", "", &dhcp_universe, 172,
"option-173", "", &dhcp_universe, 173,
"option-174", "", &dhcp_universe, 174,
"option-175", "", &dhcp_universe, 175,
"option-176", "", &dhcp_universe, 176,
"option-177", "", &dhcp_universe, 177,
"option-178", "", &dhcp_universe, 178,
"option-179", "", &dhcp_universe, 179,
"option-180", "", &dhcp_universe, 180,
"option-181", "", &dhcp_universe, 181,
"option-182", "", &dhcp_universe, 182,
"option-183", "", &dhcp_universe, 183,
"option-184", "", &dhcp_universe, 184,
"option-185", "", &dhcp_universe, 185,
"option-186", "", &dhcp_universe, 186,
"option-187", "", &dhcp_universe, 187,
"option-188", "", &dhcp_universe, 188,
"option-189", "", &dhcp_universe, 189,
"option-190", "", &dhcp_universe, 190,
"option-191", "", &dhcp_universe, 191,
"option-192", "", &dhcp_universe, 192,
"option-193", "", &dhcp_universe, 193,
"option-194", "", &dhcp_universe, 194,
"option-195", "", &dhcp_universe, 195,
"option-196", "", &dhcp_universe, 196,
"option-197", "", &dhcp_universe, 197,
"option-198", "", &dhcp_universe, 198,
"option-199", "", &dhcp_universe, 199,
"option-200", "", &dhcp_universe, 200,
"option-201", "", &dhcp_universe, 201,
"option-202", "", &dhcp_universe, 202,
"option-203", "", &dhcp_universe, 203,
"option-204", "", &dhcp_universe, 204,
"option-205", "", &dhcp_universe, 205,
"option-206", "", &dhcp_universe, 206,
"option-207", "", &dhcp_universe, 207,
"option-208", "", &dhcp_universe, 208,
"option-209", "", &dhcp_universe, 209,
"option-210", "", &dhcp_universe, 210,
"option-211", "", &dhcp_universe, 211,
"option-212", "", &dhcp_universe, 212,
"option-213", "", &dhcp_universe, 213,
"option-214", "", &dhcp_universe, 214,
"option-215", "", &dhcp_universe, 215,
"option-216", "", &dhcp_universe, 216,
"option-217", "", &dhcp_universe, 217,
"option-218", "", &dhcp_universe, 218,
"option-219", "", &dhcp_universe, 219,
"option-220", "", &dhcp_universe, 220,
"option-221", "", &dhcp_universe, 221,
"option-222", "", &dhcp_universe, 222,
"option-223", "", &dhcp_universe, 223,
"option-224", "", &dhcp_universe, 224,
"option-225", "", &dhcp_universe, 225,
"option-226", "", &dhcp_universe, 226,
"option-227", "", &dhcp_universe, 227,
"option-228", "", &dhcp_universe, 228,
"option-229", "", &dhcp_universe, 229,
"option-230", "", &dhcp_universe, 230,
"option-231", "", &dhcp_universe, 231,
"option-232", "", &dhcp_universe, 232,
"option-233", "", &dhcp_universe, 233,
"option-234", "", &dhcp_universe, 234,
"option-235", "", &dhcp_universe, 235,
"option-236", "", &dhcp_universe, 236,
"option-237", "", &dhcp_universe, 237,
"option-238", "", &dhcp_universe, 238,
"option-239", "", &dhcp_universe, 239,
"option-240", "", &dhcp_universe, 240,
"option-241", "", &dhcp_universe, 241,
"option-242", "", &dhcp_universe, 242,
"option-243", "", &dhcp_universe, 243,
"option-244", "", &dhcp_universe, 244,
"option-245", "", &dhcp_universe, 245,
"option-246", "", &dhcp_universe, 246,
"option-247", "", &dhcp_universe, 247,
"option-248", "", &dhcp_universe, 248,
"option-249", "", &dhcp_universe, 249,
"option-250", "", &dhcp_universe, 250,
"option-251", "", &dhcp_universe, 251,
"option-252", "", &dhcp_universe, 252,
"option-253", "", &dhcp_universe, 253,
"option-254", "", &dhcp_universe, 254,
"option-end", "e", &dhcp_universe, 255,
{ "pad", "", &dhcp_universe, 0 },
{ "subnet-mask", "I", &dhcp_universe, 1 },
{ "time-offset", "l", &dhcp_universe, 2 },
{ "routers", "IA", &dhcp_universe, 3 },
{ "time-servers", "IA", &dhcp_universe, 4 },
{ "name-servers", "IA", &dhcp_universe, 5 },
{ "domain-name-servers", "IA", &dhcp_universe, 6 },
{ "log-servers", "IA", &dhcp_universe, 7 },
{ "cookie-servers", "IA", &dhcp_universe, 8 },
{ "lpr-servers", "IA", &dhcp_universe, 9 },
{ "impress-servers", "IA", &dhcp_universe, 10 },
{ "resource-location-servers", "IA", &dhcp_universe, 11 },
{ "host-name", "t", &dhcp_universe, 12 },
{ "boot-size", "S", &dhcp_universe, 13 },
{ "merit-dump", "t", &dhcp_universe, 14 },
{ "domain-name", "t", &dhcp_universe, 15 },
{ "swap-server", "I", &dhcp_universe, 16 },
{ "root-path", "t", &dhcp_universe, 17 },
{ "extensions-path", "t", &dhcp_universe, 18 },
{ "ip-forwarding", "f", &dhcp_universe, 19 },
{ "non-local-source-routing", "f", &dhcp_universe, 20 },
{ "policy-filter", "IIA", &dhcp_universe, 21 },
{ "max-dgram-reassembly", "S", &dhcp_universe, 22 },
{ "default-ip-ttl", "B", &dhcp_universe, 23 },
{ "path-mtu-aging-timeout", "L", &dhcp_universe, 24 },
{ "path-mtu-plateau-table", "SA", &dhcp_universe, 25 },
{ "interface-mtu", "S", &dhcp_universe, 26 },
{ "all-subnets-local", "f", &dhcp_universe, 27 },
{ "broadcast-address", "I", &dhcp_universe, 28 },
{ "perform-mask-discovery", "f", &dhcp_universe, 29 },
{ "mask-supplier", "f", &dhcp_universe, 30 },
{ "router-discovery", "f", &dhcp_universe, 31 },
{ "router-solicitation-address", "I", &dhcp_universe, 32 },
{ "static-routes", "IIA", &dhcp_universe, 33 },
{ "trailer-encapsulation", "f", &dhcp_universe, 34 },
{ "arp-cache-timeout", "L", &dhcp_universe, 35 },
{ "ieee802.3-encapsulation", "f", &dhcp_universe, 36 },
{ "default-tcp-ttl", "B", &dhcp_universe, 37 },
{ "tcp-keepalive-interval", "L", &dhcp_universe, 38 },
{ "tcp-keepalive-garbage", "f", &dhcp_universe, 39 },
{ "nis-domain", "t", &dhcp_universe, 40 },
{ "nis-servers", "IA", &dhcp_universe, 41 },
{ "ntp-servers", "IA", &dhcp_universe, 42 },
{ "vendor-encapsulated-options", "t", &dhcp_universe, 43 },
{ "netbios-name-servers", "IA", &dhcp_universe, 44 },
{ "netbios-dd-server", "IA", &dhcp_universe, 45 },
{ "netbios-node-type", "B", &dhcp_universe, 46 },
{ "netbios-scope", "t", &dhcp_universe, 47 },
{ "font-servers", "IA", &dhcp_universe, 48 },
{ "x-display-manager", "IA", &dhcp_universe, 49 },
{ "dhcp-requested-address", "I", &dhcp_universe, 50 },
{ "dhcp-lease-time", "L", &dhcp_universe, 51 },
{ "dhcp-option-overload", "B", &dhcp_universe, 52 },
{ "dhcp-message-type", "B", &dhcp_universe, 53 },
{ "dhcp-server-identifier", "I", &dhcp_universe, 54 },
{ "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 },
{ "dhcp-message", "t", &dhcp_universe, 56 },
{ "dhcp-max-message-size", "S", &dhcp_universe, 57 },
{ "dhcp-renewal-time", "L", &dhcp_universe, 58 },
{ "dhcp-rebinding-time", "L", &dhcp_universe, 59 },
{ "dhcp-class-identifier", "t", &dhcp_universe, 60 },
{ "dhcp-client-identifier", "t", &dhcp_universe, 61 },
{ "option-62", "", &dhcp_universe, 62 },
{ "option-63", "", &dhcp_universe, 63 },
{ "option-64", "", &dhcp_universe, 64 },
{ "option-65", "", &dhcp_universe, 65 },
{ "option-66", "", &dhcp_universe, 66 },
{ "option-67", "", &dhcp_universe, 67 },
{ "option-68", "", &dhcp_universe, 68 },
{ "option-69", "", &dhcp_universe, 69 },
{ "option-70", "", &dhcp_universe, 70 },
{ "option-71", "", &dhcp_universe, 71 },
{ "option-72", "", &dhcp_universe, 72 },
{ "option-73", "", &dhcp_universe, 73 },
{ "option-74", "", &dhcp_universe, 74 },
{ "option-75", "", &dhcp_universe, 75 },
{ "option-76", "", &dhcp_universe, 76 },
{ "option-77", "", &dhcp_universe, 77 },
{ "option-78", "", &dhcp_universe, 78 },
{ "option-79", "", &dhcp_universe, 79 },
{ "option-80", "", &dhcp_universe, 80 },
{ "option-81", "", &dhcp_universe, 81 },
{ "option-82", "", &dhcp_universe, 82 },
{ "option-83", "", &dhcp_universe, 83 },
{ "option-84", "", &dhcp_universe, 84 },
{ "option-85", "", &dhcp_universe, 85 },
{ "option-86", "", &dhcp_universe, 86 },
{ "option-87", "", &dhcp_universe, 87 },
{ "option-88", "", &dhcp_universe, 88 },
{ "option-89", "", &dhcp_universe, 89 },
{ "option-90", "", &dhcp_universe, 90 },
{ "option-91", "", &dhcp_universe, 91 },
{ "option-92", "", &dhcp_universe, 92 },
{ "option-93", "", &dhcp_universe, 93 },
{ "option-94", "", &dhcp_universe, 94 },
{ "option-95", "", &dhcp_universe, 95 },
{ "option-96", "", &dhcp_universe, 96 },
{ "option-97", "", &dhcp_universe, 97 },
{ "option-98", "", &dhcp_universe, 98 },
{ "option-99", "", &dhcp_universe, 99 },
{ "option-100", "", &dhcp_universe, 100 },
{ "option-101", "", &dhcp_universe, 101 },
{ "option-102", "", &dhcp_universe, 102 },
{ "option-103", "", &dhcp_universe, 103 },
{ "option-104", "", &dhcp_universe, 104 },
{ "option-105", "", &dhcp_universe, 105 },
{ "option-106", "", &dhcp_universe, 106 },
{ "option-107", "", &dhcp_universe, 107 },
{ "option-108", "", &dhcp_universe, 108 },
{ "option-109", "", &dhcp_universe, 109 },
{ "option-110", "", &dhcp_universe, 110 },
{ "option-111", "", &dhcp_universe, 111 },
{ "option-112", "", &dhcp_universe, 112 },
{ "option-113", "", &dhcp_universe, 113 },
{ "option-114", "", &dhcp_universe, 114 },
{ "option-115", "", &dhcp_universe, 115 },
{ "option-116", "", &dhcp_universe, 116 },
{ "option-117", "", &dhcp_universe, 117 },
{ "option-118", "", &dhcp_universe, 118 },
{ "option-119", "", &dhcp_universe, 119 },
{ "option-120", "", &dhcp_universe, 120 },
{ "option-121", "", &dhcp_universe, 121 },
{ "option-122", "", &dhcp_universe, 122 },
{ "option-123", "", &dhcp_universe, 123 },
{ "option-124", "", &dhcp_universe, 124 },
{ "option-125", "", &dhcp_universe, 125 },
{ "option-126", "", &dhcp_universe, 126 },
{ "option-127", "", &dhcp_universe, 127 },
{ "option-128", "", &dhcp_universe, 128 },
{ "option-129", "", &dhcp_universe, 129 },
{ "option-130", "", &dhcp_universe, 130 },
{ "option-131", "", &dhcp_universe, 131 },
{ "option-132", "", &dhcp_universe, 132 },
{ "option-133", "", &dhcp_universe, 133 },
{ "option-134", "", &dhcp_universe, 134 },
{ "option-135", "", &dhcp_universe, 135 },
{ "option-136", "", &dhcp_universe, 136 },
{ "option-137", "", &dhcp_universe, 137 },
{ "option-138", "", &dhcp_universe, 138 },
{ "option-139", "", &dhcp_universe, 139 },
{ "option-140", "", &dhcp_universe, 140 },
{ "option-141", "", &dhcp_universe, 141 },
{ "option-142", "", &dhcp_universe, 142 },
{ "option-143", "", &dhcp_universe, 143 },
{ "option-144", "", &dhcp_universe, 144 },
{ "option-145", "", &dhcp_universe, 145 },
{ "option-146", "", &dhcp_universe, 146 },
{ "option-147", "", &dhcp_universe, 147 },
{ "option-148", "", &dhcp_universe, 148 },
{ "option-149", "", &dhcp_universe, 149 },
{ "option-150", "", &dhcp_universe, 150 },
{ "option-151", "", &dhcp_universe, 151 },
{ "option-152", "", &dhcp_universe, 152 },
{ "option-153", "", &dhcp_universe, 153 },
{ "option-154", "", &dhcp_universe, 154 },
{ "option-155", "", &dhcp_universe, 155 },
{ "option-156", "", &dhcp_universe, 156 },
{ "option-157", "", &dhcp_universe, 157 },
{ "option-158", "", &dhcp_universe, 158 },
{ "option-159", "", &dhcp_universe, 159 },
{ "option-160", "", &dhcp_universe, 160 },
{ "option-161", "", &dhcp_universe, 161 },
{ "option-162", "", &dhcp_universe, 162 },
{ "option-163", "", &dhcp_universe, 163 },
{ "option-164", "", &dhcp_universe, 164 },
{ "option-165", "", &dhcp_universe, 165 },
{ "option-166", "", &dhcp_universe, 166 },
{ "option-167", "", &dhcp_universe, 167 },
{ "option-168", "", &dhcp_universe, 168 },
{ "option-169", "", &dhcp_universe, 169 },
{ "option-170", "", &dhcp_universe, 170 },
{ "option-171", "", &dhcp_universe, 171 },
{ "option-172", "", &dhcp_universe, 172 },
{ "option-173", "", &dhcp_universe, 173 },
{ "option-174", "", &dhcp_universe, 174 },
{ "option-175", "", &dhcp_universe, 175 },
{ "option-176", "", &dhcp_universe, 176 },
{ "option-177", "", &dhcp_universe, 177 },
{ "option-178", "", &dhcp_universe, 178 },
{ "option-179", "", &dhcp_universe, 179 },
{ "option-180", "", &dhcp_universe, 180 },
{ "option-181", "", &dhcp_universe, 181 },
{ "option-182", "", &dhcp_universe, 182 },
{ "option-183", "", &dhcp_universe, 183 },
{ "option-184", "", &dhcp_universe, 184 },
{ "option-185", "", &dhcp_universe, 185 },
{ "option-186", "", &dhcp_universe, 186 },
{ "option-187", "", &dhcp_universe, 187 },
{ "option-188", "", &dhcp_universe, 188 },
{ "option-189", "", &dhcp_universe, 189 },
{ "option-190", "", &dhcp_universe, 190 },
{ "option-191", "", &dhcp_universe, 191 },
{ "option-192", "", &dhcp_universe, 192 },
{ "option-193", "", &dhcp_universe, 193 },
{ "option-194", "", &dhcp_universe, 194 },
{ "option-195", "", &dhcp_universe, 195 },
{ "option-196", "", &dhcp_universe, 196 },
{ "option-197", "", &dhcp_universe, 197 },
{ "option-198", "", &dhcp_universe, 198 },
{ "option-199", "", &dhcp_universe, 199 },
{ "option-200", "", &dhcp_universe, 200 },
{ "option-201", "", &dhcp_universe, 201 },
{ "option-202", "", &dhcp_universe, 202 },
{ "option-203", "", &dhcp_universe, 203 },
{ "option-204", "", &dhcp_universe, 204 },
{ "option-205", "", &dhcp_universe, 205 },
{ "option-206", "", &dhcp_universe, 206 },
{ "option-207", "", &dhcp_universe, 207 },
{ "option-208", "", &dhcp_universe, 208 },
{ "option-209", "", &dhcp_universe, 209 },
{ "option-210", "", &dhcp_universe, 210 },
{ "option-211", "", &dhcp_universe, 211 },
{ "option-212", "", &dhcp_universe, 212 },
{ "option-213", "", &dhcp_universe, 213 },
{ "option-214", "", &dhcp_universe, 214 },
{ "option-215", "", &dhcp_universe, 215 },
{ "option-216", "", &dhcp_universe, 216 },
{ "option-217", "", &dhcp_universe, 217 },
{ "option-218", "", &dhcp_universe, 218 },
{ "option-219", "", &dhcp_universe, 219 },
{ "option-220", "", &dhcp_universe, 220 },
{ "option-221", "", &dhcp_universe, 221 },
{ "option-222", "", &dhcp_universe, 222 },
{ "option-223", "", &dhcp_universe, 223 },
{ "option-224", "", &dhcp_universe, 224 },
{ "option-225", "", &dhcp_universe, 225 },
{ "option-226", "", &dhcp_universe, 226 },
{ "option-227", "", &dhcp_universe, 227 },
{ "option-228", "", &dhcp_universe, 228 },
{ "option-229", "", &dhcp_universe, 229 },
{ "option-230", "", &dhcp_universe, 230 },
{ "option-231", "", &dhcp_universe, 231 },
{ "option-232", "", &dhcp_universe, 232 },
{ "option-233", "", &dhcp_universe, 233 },
{ "option-234", "", &dhcp_universe, 234 },
{ "option-235", "", &dhcp_universe, 235 },
{ "option-236", "", &dhcp_universe, 236 },
{ "option-237", "", &dhcp_universe, 237 },
{ "option-238", "", &dhcp_universe, 238 },
{ "option-239", "", &dhcp_universe, 239 },
{ "option-240", "", &dhcp_universe, 240 },
{ "option-241", "", &dhcp_universe, 241 },
{ "option-242", "", &dhcp_universe, 242 },
{ "option-243", "", &dhcp_universe, 243 },
{ "option-244", "", &dhcp_universe, 244 },
{ "option-245", "", &dhcp_universe, 245 },
{ "option-246", "", &dhcp_universe, 246 },
{ "option-247", "", &dhcp_universe, 247 },
{ "option-248", "", &dhcp_universe, 248 },
{ "option-249", "", &dhcp_universe, 249 },
{ "option-250", "", &dhcp_universe, 250 },
{ "option-251", "", &dhcp_universe, 251 },
{ "option-252", "", &dhcp_universe, 252 },
{ "option-253", "", &dhcp_universe, 253 },
{ "option-254", "", &dhcp_universe, 254 },
{ "option-end", "e", &dhcp_universe, 255 },
};
/* Default dhcp option priority list (this is ad hoc and should not be

View File

@@ -138,7 +138,7 @@ struct tree *tree_concat (left, right)
return left;
/* If both trees are constant, combine them. */
if (left -> op = TREE_CONST && right -> op == TREE_CONST) {
if (left -> op == TREE_CONST && right -> op == TREE_CONST) {
unsigned char *buf = dmalloc (left -> data.const_val.len
+ right -> data.const_val.len,
"tree_concat");

View File

@@ -87,6 +87,9 @@ static int get_token (cfile)
int c;
int i;
int ttok;
#ifdef DEBUG_TOKENS
static char tb [2];
#endif
do {
c = get_char (cfile);
@@ -109,7 +112,13 @@ static int get_token (cfile)
ttok = read_num_or_atom (c, cfile);
break;
} else {
#ifdef DEBUG_TOKENS
tb [0] = c;
tb [1] = 0;
tval = tb;
#else
tval = 0;
#endif
ttok = c;
break;
}
@@ -131,6 +140,9 @@ int next_token (rval, cfile)
}
if (rval)
*rval = tval;
#ifdef DEBUG_TOKENS
fprintf (stderr, "%s:%d ", tval, rv);
#endif
return rv;
}
@@ -142,6 +154,9 @@ int peek_token (rval, cfile)
token = get_token (cfile);
if (rval)
*rval = tval;
#ifdef DEBUG_TOKENS
fprintf (stderr, "(%s:%d) ", tval, token);
#endif
return token;
}
@@ -255,11 +270,15 @@ static int intern (atom, dfv)
int dfv;
{
switch (atom [0]) {
case 'h':
if (!strcasecmp (atom + 1, "ost"))
return HOST;
if (!strcasecmp (atom + 1, "ardware"))
return HARDWARE;
case 'c':
if (!strcasecmp (atom + 1, "lass"))
return CLASS;
break;
case 'e':
if (!strcasecmp (atom + 1, "thernet"))
return ETHERNET;
if (!strcasecmp (atom + 1, "nds"))
return ENDS;
break;
case 'f':
if (!strcasecmp (atom + 1, "ilename"))
@@ -267,14 +286,36 @@ static int intern (atom, dfv)
if (!strcasecmp (atom + 1, "ixed-address"))
return FIXED_ADDR;
break;
case 'e':
if (!strcasecmp (atom + 1, "thernet"))
return ETHERNET;
case 'h':
if (!strcasecmp (atom + 1, "ost"))
return HOST;
if (!strcasecmp (atom + 1, "ardware"))
return HARDWARE;
break;
case 'l':
if (!strcasecmp (atom + 1, "ease"))
return LEASE;
break;
case 'o':
if (!strcasecmp (atom + 1, "ption"))
return OPTION;
break;
case 'r':
if (!strcasecmp (atom + 1, "ange"))
return RANGE;
break;
case 's':
if (!strcasecmp (atom + 1, "tarts"))
return STARTS;
break;
case 't':
if (!strcasecmp (atom + 1, "timestamp"))
return TIMESTAMP;
break;
case 'u':
if (!strcasecmp (atom + 1, "id"))
return UID;
break;
}
return dfv;
}

View File

@@ -126,7 +126,7 @@ void skip_to_semi (cfile)
/* host_statement :== HOST hostname declarations SEMI
host_declarations :== <nil> | host_declaration
| host_declarations host_declaration */
| host_declarations host_declaration SEMI */
struct host_decl *parse_host_statement (cfile, bc)
FILE *cfile;
@@ -171,7 +171,7 @@ char *parse_host_name (cfile, bc)
/* Read a token, which should be an identifier. */
token = next_token (&val, cfile);
if (!is_identifier (token)) {
parse_warn ("expecting an identified in hostname");
parse_warn ("expecting an identifier in hostname");
skip_to_semi (cfile);
longjmp (*bc, 1);
}
@@ -560,7 +560,7 @@ void parse_option_decl (cfile, bc, decl)
decl -> options [option -> code] = tree_cache (tree);
}
/* timestamp :== TIMESTAMP date
/* timestamp :== TIMESTAMP date SEMI
Timestamps are actually not used in dhcpd.conf, which is a static file,
but rather in the database file and the journal file. */
@@ -569,10 +569,21 @@ TIME parse_timestamp (cfile, bc)
FILE *cfile;
jmp_buf *bc;
{
return parse_date (cfile, bc);
TIME rv;
char *val;
int token;
rv = parse_date (cfile, bc);
token = next_token (&val, cfile);
if (token != SEMI) {
parse_warn ("semicolon expected");
skip_to_semi (cfile);
longjmp (*bc, 1);
}
return rv;
}
/* lease_decl :== LEASE ip_address lease_modifiers
/* lease_decl :== LEASE ip_address lease_modifiers SEMI
lease_modifiers :== <nil>
| lease_modifier
| lease_modifier lease_modifiers
@@ -601,7 +612,8 @@ struct lease *parse_lease_statement (cfile, bc)
/* Get the address for which the lease has been issued. */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&lease.ip_addr, addr, len);
memcpy (lease.ip_addr.iabuf, addr, len);
lease.ip_addr.len = len;
do {
token = next_token (&val, cfile);
@@ -659,7 +671,7 @@ struct lease *parse_lease_statement (cfile, bc)
find_host_by_name (val);
if (!lease.host)
parse_warn ("lease host ``%s'' is %s",
lease.host,
val,
"no longer known.");
break;
@@ -688,34 +700,47 @@ struct lease *parse_lease_statement (cfile, bc)
}
if (seenmask & seenbit) {
parse_warn ("Too many %s declarations in lease %s\n",
tbuf, inet_ntoa (lease.ip_addr));
tbuf, piaddr (lease.ip_addr));
} else
seenmask |= seenbit;
} while (1);
return &lease;
}
/* address_range :== RANGE ip_address ip_address ip_address */
/* address_range :== RANGE ip_address ip_address ip_address SEMI */
void parse_address_range (cfile, bc)
FILE *cfile;
jmp_buf *bc;
{
struct in_addr low, high, mask;
struct iaddr low, high, mask;
unsigned char addr [4];
int len = sizeof addr;
int token;
char *val;
/* Get the bottom address in the range... */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&low, addr, len);
memcpy (low.iabuf, addr, len);
low.len = len;
/* Get the top address in the range... */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&high, addr, len);
memcpy (high.iabuf, addr, len);
high.len = len;
/* Get the netmask of the subnet containing the range... */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&mask, addr, len);
memcpy (mask.iabuf, addr, len);
mask.len = len;
/* Snarf the semi... */
token = next_token (&val, cfile);
if (token != SEMI) {
parse_warn ("semicolon expected");
skip_to_semi (cfile);
longjmp (*bc, 1);
}
/* Create the new address range... */
new_address_range (low, high, mask);
@@ -744,7 +769,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_wday = atoi (token);
tm.tm_wday = atoi (val);
/* Year... */
token = next_token (&val, cfile);
@@ -754,7 +779,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_year = atoi (token);
tm.tm_year = atoi (val);
if (tm.tm_year > 1900)
tm.tm_year -= 1900;
@@ -775,7 +800,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_mon = atoi (token);
tm.tm_mon = atoi (val);
/* Slash seperating month from day... */
token = next_token (&val, cfile);
@@ -794,7 +819,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_mday = atoi (token);
tm.tm_mday = atoi (val);
/* Hour... */
token = next_token (&val, cfile);
@@ -804,7 +829,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_hour = atoi (token);
tm.tm_hour = atoi (val);
/* Colon seperating hour from minute... */
token = next_token (&val, cfile);
@@ -823,7 +848,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_min = atoi (token);
tm.tm_min = atoi (val);
/* Colon seperating minute from second... */
token = next_token (&val, cfile);
@@ -842,7 +867,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_sec = atoi (token);
tm.tm_sec = atoi (val);
tm.tm_zone = "GMT";
tm.tm_isdst = 0;

15
dhcpd.c
View File

@@ -165,6 +165,9 @@ int main (argc, argv, envp)
/* Receive packets and dispatch them... */
dispatch ();
/* Not reached */
return 0;
}
/* Print usage message. */
@@ -178,11 +181,11 @@ void cleanup ()
{
}
void do_packet (packbuf, len, from, fromlen, sock)
void do_packet (packbuf, len, from_port, from, sock)
unsigned char *packbuf;
int len;
struct sockaddr_in *from;
int fromlen;
unsigned long from_port;
struct iaddr from;
int sock;
{
struct packet *tp;
@@ -198,8 +201,8 @@ void do_packet (packbuf, len, from, fromlen, sock)
memset (tp, 0, sizeof *tp);
tp -> raw = tdp;
tp -> packet_length = len;
tp -> client = *from;
tp -> client_len = fromlen;
tp -> client_port = from_port;
tp -> client_addr = from;
tp -> client_sock = sock;
parse_options (tp);
if (tp -> options_valid &&
@@ -209,7 +212,7 @@ void do_packet (packbuf, len, from, fromlen, sock)
bootp (tp);
}
dump_packet (tp)
void dump_packet (tp)
struct packet *tp;
{
struct dhcp_packet *tdp = tp -> raw;

View File

@@ -1,3 +1,5 @@
range 204.254.239.11 204.254.239.254 255.255.255.0;
host minuet
hardware ethernet 08:00:2b:35:0c:18
filename "/tftpboot/netbsd.minuet"
@@ -15,3 +17,14 @@ host fantasia
option name-servers toccata.fugue.com, passacaglia.fugue.com
option domain-name "fugue.com";
host avogadro
hardware ethernet 08:00:2b:4c:39:12
option routers prelude.fugue.com
option name-servers toccata.fugue.com
option domain-name "fugue.com";
lease 204.254.239.11
starts 2 96/2/6 10:14:02
ends 2 96/2/6 11:15:02
uid 08:00:2b:4c:39:12
host avogadro;

54
dhcpd.h
View File

@@ -47,11 +47,19 @@
#include <netdb.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#include <malloc.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ctype.h>
#include "dhcp.h"
#include "cdefs.h"
#include "osdep.h"
#include "tree.h"
#include "hash.h"
#include "inet.h"
/* A dhcp packet and the pointers to its option values. */
struct packet {
@@ -59,8 +67,8 @@ struct packet {
int packet_length;
int packet_type;
int options_valid;
struct sockaddr_in client;
int client_len;
int client_port;
struct iaddr client_addr;
int client_sock;
struct {
int len;
@@ -90,7 +98,7 @@ struct host_decl {
struct lease {
struct lease *next;
struct lease *prev;
struct in_addr ip_addr;
struct iaddr ip_addr;
TIME starts, ends, timestamp;
unsigned char *uid;
int uid_len;
@@ -101,8 +109,8 @@ struct lease {
};
struct subnet {
struct in_addr net;
struct in_addr netmask;
struct iaddr net;
struct iaddr netmask;
struct lease *leases;
struct lease *insertion_point;
};
@@ -130,10 +138,6 @@ typedef unsigned char option_mask [16];
#endif
#endif
/* Subnet macros... */
#define SUBNET(addr, mask) ((addr).s_addr & (netmask).s_addr)
#define IP_ADDR(net, host) ((net).s_addr | i)
#define HOST_ADDR(addr, mask) ((addr).s_addr & ~(netmask).s_addr)
#define MAX_TIME 0x7fffffff
#define MIN_TIME 0
@@ -143,8 +147,10 @@ typedef unsigned char option_mask [16];
void parse_options PROTO ((struct packet *));
void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
void cons_options PROTO ((struct packet *, struct dhcp_packet *,
void cons_options PROTO ((struct packet *, struct packet *,
struct host_decl *, int));
int store_option PROTO ((struct packet *, unsigned char,
unsigned char *, int, int *));
char *pretty_print_option PROTO ((unsigned char, unsigned char *, int));
/* errwarn.c */
@@ -161,7 +167,9 @@ extern int server_addrcount;
extern u_int16_t server_port;
int main PROTO ((int, char **, char **));
void cleanup PROTO ((void));
void do_packet PROTO ((unsigned char *, int, struct sockaddr_in *, int, int));
void do_packet PROTO ((unsigned char *, int,
unsigned long, struct iaddr, int));
void dump_packet PROTO ((struct packet *));
u_int32_t pick_interface PROTO ((struct packet *));
@@ -179,6 +187,7 @@ void parse_host_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
void parse_hardware_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
struct hardware parse_hardware_addr PROTO ((FILE *, jmp_buf *));
void parse_filename_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
struct tree *parse_ip_addr_or_hostname PROTO ((FILE *, jmp_buf *, int));
void parse_fixed_addr_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
void parse_option_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
TIME parse_timestamp PROTO ((FILE *, jmp_buf *));
@@ -210,13 +219,14 @@ void bootp PROTO ((struct packet *));
void enter_host PROTO ((struct host_decl *));
struct host_decl *find_host_by_name PROTO ((char *name));
struct host_decl *find_host_by_addr PROTO ((int, unsigned char *, int));
extern struct subnet *find_subnet (struct in_addr);
void new_address_range PROTO ((struct iaddr, struct iaddr,
struct iaddr));
extern struct subnet *find_subnet (struct iaddr);
void enter_subnet (struct subnet *);
void enter_lease PROTO ((struct lease *));
void supersede_lease PROTO ((struct lease *, struct lease *));
struct lease *find_lease_by_uid PROTO ((unsigned char *, int));
struct lease *find_lease_by_ip_addr PROTO ((struct in_addr));
struct lease *find_next_expiring_lease PROTO ((void));
struct lease *find_lease_by_ip_addr PROTO ((struct iaddr));
/* alloc.c */
VOIDPTR dmalloc PROTO ((int, char *));
@@ -261,3 +271,19 @@ extern struct hash_table universe_hash;
extern struct universe dhcp_universe;
void initialize_universes PROTO ((void));
/* convert.c */
unsigned long getULong PROTO ((unsigned char *));
long getLong PROTO ((unsigned char *));
unsigned short getUShort PROTO ((unsigned char *));
short getShort PROTO ((unsigned char *));
void putULong PROTO ((unsigned char *, unsigned long));
void putLong PROTO ((unsigned char *, long));
void putUShort PROTO ((unsigned char *, unsigned short));
void putShort PROTO ((unsigned char *, short));
/* inet.c */
struct iaddr subnet_number (struct iaddr, struct iaddr);
struct iaddr ip_addr (struct iaddr, struct iaddr, unsigned long);
unsigned long host_addr (struct iaddr, struct iaddr);
int addr_eq (struct iaddr, struct iaddr);
char *piaddr (struct iaddr);

View File

@@ -66,6 +66,6 @@
#define LAST_TOKEN RANGE
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
(x) <= FIRST_TOKEN && \
(x) <= LAST_TOKEN && \
(x) != STRING && \
(x) != NUMBER)

4
hash.c
View File

@@ -46,6 +46,8 @@ static char copyright[] =
#include "dhcpd.h"
static INLINE int do_hash PROTO ((char *, int, int));
struct hash_table *new_hash ()
{
struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE, "new_hash");
@@ -56,7 +58,7 @@ struct hash_table *new_hash ()
return rv;
}
static INLINE do_hash (name, len, size)
static INLINE int do_hash (name, len, size)
char *name;
int len;
int size;

View File

@@ -47,11 +47,19 @@
#include <netdb.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#include <malloc.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ctype.h>
#include "dhcp.h"
#include "cdefs.h"
#include "osdep.h"
#include "tree.h"
#include "hash.h"
#include "inet.h"
/* A dhcp packet and the pointers to its option values. */
struct packet {
@@ -59,8 +67,8 @@ struct packet {
int packet_length;
int packet_type;
int options_valid;
struct sockaddr_in client;
int client_len;
int client_port;
struct iaddr client_addr;
int client_sock;
struct {
int len;
@@ -90,7 +98,7 @@ struct host_decl {
struct lease {
struct lease *next;
struct lease *prev;
struct in_addr ip_addr;
struct iaddr ip_addr;
TIME starts, ends, timestamp;
unsigned char *uid;
int uid_len;
@@ -101,8 +109,8 @@ struct lease {
};
struct subnet {
struct in_addr net;
struct in_addr netmask;
struct iaddr net;
struct iaddr netmask;
struct lease *leases;
struct lease *insertion_point;
};
@@ -130,10 +138,6 @@ typedef unsigned char option_mask [16];
#endif
#endif
/* Subnet macros... */
#define SUBNET(addr, mask) ((addr).s_addr & (netmask).s_addr)
#define IP_ADDR(net, host) ((net).s_addr | i)
#define HOST_ADDR(addr, mask) ((addr).s_addr & ~(netmask).s_addr)
#define MAX_TIME 0x7fffffff
#define MIN_TIME 0
@@ -143,8 +147,10 @@ typedef unsigned char option_mask [16];
void parse_options PROTO ((struct packet *));
void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
void cons_options PROTO ((struct packet *, struct dhcp_packet *,
void cons_options PROTO ((struct packet *, struct packet *,
struct host_decl *, int));
int store_option PROTO ((struct packet *, unsigned char,
unsigned char *, int, int *));
char *pretty_print_option PROTO ((unsigned char, unsigned char *, int));
/* errwarn.c */
@@ -161,7 +167,9 @@ extern int server_addrcount;
extern u_int16_t server_port;
int main PROTO ((int, char **, char **));
void cleanup PROTO ((void));
void do_packet PROTO ((unsigned char *, int, struct sockaddr_in *, int, int));
void do_packet PROTO ((unsigned char *, int,
unsigned long, struct iaddr, int));
void dump_packet PROTO ((struct packet *));
u_int32_t pick_interface PROTO ((struct packet *));
@@ -179,6 +187,7 @@ void parse_host_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
void parse_hardware_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
struct hardware parse_hardware_addr PROTO ((FILE *, jmp_buf *));
void parse_filename_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
struct tree *parse_ip_addr_or_hostname PROTO ((FILE *, jmp_buf *, int));
void parse_fixed_addr_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
void parse_option_decl PROTO ((FILE *, jmp_buf *, struct host_decl *));
TIME parse_timestamp PROTO ((FILE *, jmp_buf *));
@@ -210,13 +219,14 @@ void bootp PROTO ((struct packet *));
void enter_host PROTO ((struct host_decl *));
struct host_decl *find_host_by_name PROTO ((char *name));
struct host_decl *find_host_by_addr PROTO ((int, unsigned char *, int));
extern struct subnet *find_subnet (struct in_addr);
void new_address_range PROTO ((struct iaddr, struct iaddr,
struct iaddr));
extern struct subnet *find_subnet (struct iaddr);
void enter_subnet (struct subnet *);
void enter_lease PROTO ((struct lease *));
void supersede_lease PROTO ((struct lease *, struct lease *));
struct lease *find_lease_by_uid PROTO ((unsigned char *, int));
struct lease *find_lease_by_ip_addr PROTO ((struct in_addr));
struct lease *find_next_expiring_lease PROTO ((void));
struct lease *find_lease_by_ip_addr PROTO ((struct iaddr));
/* alloc.c */
VOIDPTR dmalloc PROTO ((int, char *));
@@ -261,3 +271,19 @@ extern struct hash_table universe_hash;
extern struct universe dhcp_universe;
void initialize_universes PROTO ((void));
/* convert.c */
unsigned long getULong PROTO ((unsigned char *));
long getLong PROTO ((unsigned char *));
unsigned short getUShort PROTO ((unsigned char *));
short getShort PROTO ((unsigned char *));
void putULong PROTO ((unsigned char *, unsigned long));
void putLong PROTO ((unsigned char *, long));
void putUShort PROTO ((unsigned char *, unsigned short));
void putShort PROTO ((unsigned char *, short));
/* inet.c */
struct iaddr subnet_number (struct iaddr, struct iaddr);
struct iaddr ip_addr (struct iaddr, struct iaddr, unsigned long);
unsigned long host_addr (struct iaddr, struct iaddr);
int addr_eq (struct iaddr, struct iaddr);
char *piaddr (struct iaddr);

View File

@@ -66,6 +66,6 @@
#define LAST_TOKEN RANGE
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
(x) <= FIRST_TOKEN && \
(x) <= LAST_TOKEN && \
(x) != STRING && \
(x) != NUMBER)

View File

@@ -41,6 +41,6 @@
struct iaddr {
int len;
char iabuf [16];
unsigned char iabuf [16];
};

154
inet.c Normal file
View File

@@ -0,0 +1,154 @@
/* inet.c
Subroutines to manipulate internet addresses in a safely portable
way... */
/*
* Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of The Internet Software Consortium nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
* Enterprises. To learn more about the Internet Software Consortium,
* see ``http://www.vix.com/isc''. To learn more about Vixie
* Enterprises, see ``http://www.vix.com''.
*/
#include "dhcpd.h"
/* Return just the network number of an internet address... */
struct iaddr subnet_number (addr, mask)
struct iaddr addr;
struct iaddr mask;
{
int i;
struct iaddr rv;
rv.len = 0;
/* Both addresses must have the same length... */
if (addr.len != mask.len)
return rv;
rv.len = addr.len;
for (i = 0; i < rv.len; i++)
rv.iabuf [i] = addr.iabuf [i] & mask.iabuf [i];
return rv;
}
/* Combine a network number and a integer to produce an internet address.
This won't work for subnets with more than 32 bits of host address, but
maybe this isn't a problem. */
struct iaddr ip_addr (subnet, mask, host_address)
struct iaddr subnet;
struct iaddr mask;
unsigned long host_address;
{
int i, j, k;
unsigned long swaddr;
struct iaddr rv;
unsigned char habuf [sizeof swaddr];
swaddr = htonl (host_address);
memcpy (habuf, &swaddr, sizeof swaddr);
/* Combine the subnet address and the host address. If
the host address is bigger than can fit in the subnet,
return a zero-length iaddr structure. */
rv = subnet;
j = rv.len - sizeof habuf;
for (i = sizeof habuf - 1; i >= 0; i--) {
if (mask.iabuf [i + j]) {
if (habuf [i] > ~mask.iabuf [i + j]) {
rv.len = 0;
return rv;
}
for (k = i - 1; k >= 0; k--) {
if (habuf [k]) {
rv.len = 0;
return rv;
}
}
rv.iabuf [i + j] &= habuf [i];
break;
}
rv.iabuf [i + j] = habuf [i];
}
return rv;
}
unsigned long host_addr (addr, mask)
struct iaddr addr;
struct iaddr mask;
{
int i;
unsigned long swaddr;
struct iaddr rv;
rv.len = 0;
/* Mask out the network bits... */
rv.len = addr.len;
for (i = 0; i < rv.len; i++)
rv.iabuf [i] = addr.iabuf [i] & ~mask.iabuf [i];
/* Copy out up to 32 bits... */
memcpy (&swaddr, &rv.iabuf [rv.len - sizeof swaddr], sizeof swaddr);
/* Swap it and return it. */
return ntohl (swaddr);
}
int addr_eq (addr1, addr2)
struct iaddr addr1, addr2;
{
if (addr1.len != addr2.len)
return 0;
return memcmp (addr1.iabuf, addr2.iabuf, addr1.len) == 0;
}
char *piaddr (addr)
struct iaddr addr;
{
static char pbuf [4 * 16];
char *s = pbuf;
int i;
if (addr.len == 0) {
strcpy (s, "<null address>");
}
for (i = 0; i < addr.len; i++) {
sprintf (s, "%s%d", i ? "." : "", addr.iabuf [i]);
s += strlen (s);
}
return pbuf;
}

2
inet.h
View File

@@ -41,6 +41,6 @@
struct iaddr {
int len;
char iabuf [16];
unsigned char iabuf [16];
};

View File

@@ -92,11 +92,11 @@ struct host_decl *find_host_by_addr (htype, haddr, hlen)
}
void new_address_range (low, high, netmask)
struct in_addr low, high, netmask;
struct iaddr low, high, netmask;
{
struct lease *address_range, *lp, *plp;
struct subnet *subnet;
struct in_addr net;
struct iaddr net;
int i, max;
char lowbuf [16], highbuf [16], netbuf [16];
@@ -111,11 +111,11 @@ void new_address_range (low, high, netmask)
lease_hw_addr_hash = new_hash ();
/* Make sure that high and low addresses are in same subnet. */
net.s_addr = SUBNET (low, netmask);
if (net.s_addr != SUBNET (high, netmask)) {
strcpy (lowbuf, inet_ntoa (low));
strcpy (highbuf, inet_ntoa (high));
strcpy (netbuf, inet_ntoa (netmask));
net = subnet_number (low, netmask);
if (!addr_eq (net, subnet_number (high, netmask))) {
strcpy (lowbuf, piaddr (low));
strcpy (highbuf, piaddr (high));
strcpy (netbuf, piaddr (netmask));
error ("Address range %s to %s, netmask %s spans %s!",
lowbuf, highbuf, netbuf, "multiple subnets");
}
@@ -133,27 +133,28 @@ void new_address_range (low, high, netmask)
}
/* Get the high and low host addresses... */
max = HOST_ADDR (high, netmask);
i = HOST_ADDR (low, netmask);
max = host_addr (high, netmask);
i = host_addr (low, netmask);
/* Allow range to be specified high-to-low as well as low-to-high. */
if (i > max) {
max = i;
i = HOST_ADDR (high, netmask);
i = host_addr (high, netmask);
}
/* Get a lease structure for each address in the range. */
address_range = new_leases (max - i + 1, "new_address_range");
if (!address_range) {
strcpy (lowbuf, inet_ntoa (low));
strcpy (highbuf, inet_ntoa (high));
strcpy (lowbuf, piaddr (low));
strcpy (highbuf, piaddr (high));
error ("No memory for address range %s-%s.", lowbuf, highbuf);
}
memset (address_range, 0, (sizeof *address_range) * (max - i + 1));
/* Fill out the lease structures with some minimal information. */
for (; i <= max; i++) {
address_range [i].ip_addr.s_addr = IP_ADDR (subnet -> net, i);
address_range [i].ip_addr =
ip_addr (subnet -> net, subnet -> netmask, i);
address_range [i].starts =
address_range [i].timestamp = MIN_TIME;
address_range [i].ends = MIN_TIME;
@@ -163,7 +164,8 @@ void new_address_range (low, high, netmask)
address_range [i].next = subnet -> leases;
address_range [i].prev = (struct lease *)0;
subnet -> leases = &address_range [i];
address_range [i].next -> prev = subnet -> leases;
if (address_range [i].next)
address_range [i].next -> prev = subnet -> leases;
add_hash (lease_ip_addr_hash,
(char *)&address_range [i].ip_addr,
sizeof address_range [i].ip_addr,
@@ -173,16 +175,16 @@ void new_address_range (low, high, netmask)
/* Find out if any dangling leases are in range... */
plp = (struct lease *)0;
for (lp = dangling_leases; lp; lp = lp -> next) {
struct in_addr lnet;
struct iaddr lnet;
int lhost;
lnet.s_addr = SUBNET (lp -> ip_addr, subnet -> netmask);
lhost = HOST_ADDR (lp -> ip_addr, subnet -> netmask);
lnet = subnet_number (lp -> ip_addr, subnet -> netmask);
lhost = host_addr (lp -> ip_addr, subnet -> netmask);
/* If it's in range, fill in the real lease structure with
the dangling lease's values, and remove the lease from
the list of dangling leases. */
if (lnet.s_addr == subnet -> net.s_addr &&
if (addr_eq (lnet, subnet -> net) &&
lhost >= i && lhost <= max) {
if (plp) {
plp -> next = lp -> next;
@@ -198,12 +200,12 @@ void new_address_range (low, high, netmask)
}
struct subnet *find_subnet (subnet)
struct in_addr subnet;
struct iaddr subnet;
{
struct subnet *rv;
return (struct subnet *)hash_lookup (subnet_hash,
(char *)&subnet, sizeof subnet);
(char *)subnet.iabuf, subnet.len);
}
/* Enter a new subnet into the subnet hash. */
@@ -211,8 +213,8 @@ struct subnet *find_subnet (subnet)
void enter_subnet (subnet)
struct subnet *subnet;
{
add_hash (subnet_hash, (char *)&subnet -> net,
sizeof subnet -> net, (unsigned char *)subnet);
add_hash (subnet_hash, (char *)subnet -> net.iabuf,
subnet -> net.len, (unsigned char *)subnet);
}
/* Enter a lease into the system. This is called by the parser each
@@ -232,7 +234,7 @@ void enter_lease (lease)
comp = new_lease ("enter_lease");
if (!comp) {
error ("No memory for lease %s\n",
inet_ntoa (lease -> ip_addr));
piaddr (lease -> ip_addr));
}
*comp = *lease;
lease -> next = dangling_leases;
@@ -273,7 +275,7 @@ void supersede_lease (comp, lease)
lease -> hardware_addr.haddr,
comp -> hardware_addr.hlen))))) {
warn ("Lease conflict at %s",
inet_ntoa (comp -> ip_addr));
piaddr (comp -> ip_addr));
} else {
/* If there's a Unique ID, dissociate it from the hash
table if necessary, and always free it. */
@@ -289,13 +291,13 @@ void supersede_lease (comp, lease)
free (comp -> uid);
}
if (comp -> hardware_addr.htype &&
(comp -> hardware_addr.hlen !=
lease -> hardware_addr.hlen) ||
(comp -> hardware_addr.htype !=
lease -> hardware_addr.htype) ||
memcmp (comp -> hardware_addr.haddr,
lease -> hardware_addr.haddr,
comp -> hardware_addr.hlen)) {
((comp -> hardware_addr.hlen !=
lease -> hardware_addr.hlen) ||
(comp -> hardware_addr.htype !=
lease -> hardware_addr.htype) ||
memcmp (comp -> hardware_addr.haddr,
lease -> hardware_addr.haddr,
comp -> hardware_addr.hlen))) {
delete_hash_entry (lease_hw_addr_hash,
comp -> hardware_addr.haddr,
comp -> hardware_addr.hlen);
@@ -393,3 +395,24 @@ void supersede_lease (comp, lease)
comp -> contain -> insertion_point = comp;
}
}
/* Locate the lease associated with a given IP address... */
struct lease *find_lease_by_ip_addr (addr)
struct iaddr addr;
{
struct lease *lease = (struct lease *)hash_lookup (lease_ip_addr_hash,
addr.iabuf,
addr.len);
return lease;
}
struct lease *find_lease_by_uid (uid, len)
unsigned char *uid;
int len;
{
struct lease *lease = (struct lease *)hash_lookup (lease_uid_hash,
uid, len);
return lease;
}

View File

@@ -152,7 +152,7 @@ void parse_option_buffer (packet, buffer, length)
void cons_options (inpacket, outpacket, hp, overload)
struct packet *inpacket;
struct dhcp_packet *outpacket;
struct packet *outpacket;
struct host_decl *hp;
int overload; /* Overload flags that may be set. */
{
@@ -163,13 +163,13 @@ void cons_options (inpacket, outpacket, hp, overload)
unsigned char *priority_list;
int priority_len;
unsigned char *buffer = inpacket -> raw -> options;
int buflen, bufix;
int buflen, bufix = 0;
int reserved = 3; /* Reserved space for overload. */
unsigned char *overload_ptr = (unsigned char *)0;
int stored_length [256];
int missed = 0;
int missed_code;
int missed_length;
int missed_code = 0;
int missed_length = 0;
int result;
int i;

View File

@@ -44,6 +44,8 @@ static char copyright[] =
"@(#) Copyright (c) 1995 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
char *print_hw_addr (htype, hlen, data)
int htype;
int hlen;

View File

@@ -130,7 +130,7 @@ void bootp (packet)
/* If we got the magic cookie, send it back. */
if (packet -> options_valid)
memcpy (reply -> options, packet -> raw -> options, 4);
to.sin_port = packet -> client.sin_port;
to.sin_port = htons (packet -> client_port);
to.sin_family = AF_INET;
to.sin_len = sizeof to;
memset (to.sin_zero, 0, sizeof to.sin_zero);

View File

@@ -126,7 +126,7 @@ void skip_to_semi (cfile)
/* host_statement :== HOST hostname declarations SEMI
host_declarations :== <nil> | host_declaration
| host_declarations host_declaration */
| host_declarations host_declaration SEMI */
struct host_decl *parse_host_statement (cfile, bc)
FILE *cfile;
@@ -171,7 +171,7 @@ char *parse_host_name (cfile, bc)
/* Read a token, which should be an identifier. */
token = next_token (&val, cfile);
if (!is_identifier (token)) {
parse_warn ("expecting an identified in hostname");
parse_warn ("expecting an identifier in hostname");
skip_to_semi (cfile);
longjmp (*bc, 1);
}
@@ -560,7 +560,7 @@ void parse_option_decl (cfile, bc, decl)
decl -> options [option -> code] = tree_cache (tree);
}
/* timestamp :== TIMESTAMP date
/* timestamp :== TIMESTAMP date SEMI
Timestamps are actually not used in dhcpd.conf, which is a static file,
but rather in the database file and the journal file. */
@@ -569,10 +569,21 @@ TIME parse_timestamp (cfile, bc)
FILE *cfile;
jmp_buf *bc;
{
return parse_date (cfile, bc);
TIME rv;
char *val;
int token;
rv = parse_date (cfile, bc);
token = next_token (&val, cfile);
if (token != SEMI) {
parse_warn ("semicolon expected");
skip_to_semi (cfile);
longjmp (*bc, 1);
}
return rv;
}
/* lease_decl :== LEASE ip_address lease_modifiers
/* lease_decl :== LEASE ip_address lease_modifiers SEMI
lease_modifiers :== <nil>
| lease_modifier
| lease_modifier lease_modifiers
@@ -601,7 +612,8 @@ struct lease *parse_lease_statement (cfile, bc)
/* Get the address for which the lease has been issued. */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&lease.ip_addr, addr, len);
memcpy (lease.ip_addr.iabuf, addr, len);
lease.ip_addr.len = len;
do {
token = next_token (&val, cfile);
@@ -659,7 +671,7 @@ struct lease *parse_lease_statement (cfile, bc)
find_host_by_name (val);
if (!lease.host)
parse_warn ("lease host ``%s'' is %s",
lease.host,
val,
"no longer known.");
break;
@@ -688,34 +700,47 @@ struct lease *parse_lease_statement (cfile, bc)
}
if (seenmask & seenbit) {
parse_warn ("Too many %s declarations in lease %s\n",
tbuf, inet_ntoa (lease.ip_addr));
tbuf, piaddr (lease.ip_addr));
} else
seenmask |= seenbit;
} while (1);
return &lease;
}
/* address_range :== RANGE ip_address ip_address ip_address */
/* address_range :== RANGE ip_address ip_address ip_address SEMI */
void parse_address_range (cfile, bc)
FILE *cfile;
jmp_buf *bc;
{
struct in_addr low, high, mask;
struct iaddr low, high, mask;
unsigned char addr [4];
int len = sizeof addr;
int token;
char *val;
/* Get the bottom address in the range... */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&low, addr, len);
memcpy (low.iabuf, addr, len);
low.len = len;
/* Get the top address in the range... */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&high, addr, len);
memcpy (high.iabuf, addr, len);
high.len = len;
/* Get the netmask of the subnet containing the range... */
parse_numeric_aggregate (cfile, bc, addr, &len, DOT, 10, 8);
memcpy (&mask, addr, len);
memcpy (mask.iabuf, addr, len);
mask.len = len;
/* Snarf the semi... */
token = next_token (&val, cfile);
if (token != SEMI) {
parse_warn ("semicolon expected");
skip_to_semi (cfile);
longjmp (*bc, 1);
}
/* Create the new address range... */
new_address_range (low, high, mask);
@@ -744,7 +769,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_wday = atoi (token);
tm.tm_wday = atoi (val);
/* Year... */
token = next_token (&val, cfile);
@@ -754,7 +779,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_year = atoi (token);
tm.tm_year = atoi (val);
if (tm.tm_year > 1900)
tm.tm_year -= 1900;
@@ -775,7 +800,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_mon = atoi (token);
tm.tm_mon = atoi (val);
/* Slash seperating month from day... */
token = next_token (&val, cfile);
@@ -794,7 +819,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_mday = atoi (token);
tm.tm_mday = atoi (val);
/* Hour... */
token = next_token (&val, cfile);
@@ -804,7 +829,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_hour = atoi (token);
tm.tm_hour = atoi (val);
/* Colon seperating hour from minute... */
token = next_token (&val, cfile);
@@ -823,7 +848,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_min = atoi (token);
tm.tm_min = atoi (val);
/* Colon seperating minute from second... */
token = next_token (&val, cfile);
@@ -842,7 +867,7 @@ TIME parse_date (cfile, bc)
skip_to_semi (cfile);
longjmp (*bc, 1);
}
tm.tm_sec = atoi (token);
tm.tm_sec = atoi (val);
tm.tm_zone = "GMT";
tm.tm_isdst = 0;

View File

@@ -165,6 +165,9 @@ int main (argc, argv, envp)
/* Receive packets and dispatch them... */
dispatch ();
/* Not reached */
return 0;
}
/* Print usage message. */
@@ -178,11 +181,11 @@ void cleanup ()
{
}
void do_packet (packbuf, len, from, fromlen, sock)
void do_packet (packbuf, len, from_port, from, sock)
unsigned char *packbuf;
int len;
struct sockaddr_in *from;
int fromlen;
unsigned long from_port;
struct iaddr from;
int sock;
{
struct packet *tp;
@@ -198,8 +201,8 @@ void do_packet (packbuf, len, from, fromlen, sock)
memset (tp, 0, sizeof *tp);
tp -> raw = tdp;
tp -> packet_length = len;
tp -> client = *from;
tp -> client_len = fromlen;
tp -> client_port = from_port;
tp -> client_addr = from;
tp -> client_sock = sock;
parse_options (tp);
if (tp -> options_valid &&
@@ -209,7 +212,7 @@ void do_packet (packbuf, len, from, fromlen, sock)
bootp (tp);
}
dump_packet (tp)
void dump_packet (tp)
struct packet *tp;
{
struct dhcp_packet *tdp = tp -> raw;

View File

@@ -1,3 +1,5 @@
range 204.254.239.11 204.254.239.254 255.255.255.0;
host minuet
hardware ethernet 08:00:2b:35:0c:18
filename "/tftpboot/netbsd.minuet"
@@ -15,3 +17,14 @@ host fantasia
option name-servers toccata.fugue.com, passacaglia.fugue.com
option domain-name "fugue.com";
host avogadro
hardware ethernet 08:00:2b:4c:39:12
option routers prelude.fugue.com
option name-servers toccata.fugue.com
option domain-name "fugue.com";
lease 204.254.239.11
starts 2 96/2/6 10:14:02
ends 2 96/2/6 11:15:02
uid 08:00:2b:4c:39:12
host avogadro;

View File

@@ -159,6 +159,7 @@ unsigned char packbuf [65536]; /* Should cover the gnarliest MTU... */
void dispatch ()
{
struct sockaddr_in from;
struct iaddr ifrom;
int fromlen = sizeof from;
fd_set r, w, x;
struct socklist *l;
@@ -201,7 +202,10 @@ void dispatch ()
note ("request from %s, port %d",
inet_ntoa (from.sin_addr),
htons (from.sin_port));
do_packet (packbuf, result, &from, fromlen, l -> sock);
ifrom.len = 4;
memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
do_packet (packbuf, result, from.sin_port,
ifrom, l -> sock);
}
} while (1);
}

512
tables.c
View File

@@ -65,262 +65,262 @@ static char copyright[] =
struct universe dhcp_universe;
struct option dhcp_options [256] = {
"pad", "", &dhcp_universe, 0,
"subnet-mask", "I", &dhcp_universe, 1,
"time-offset", "l", &dhcp_universe, 2,
"routers", "IA", &dhcp_universe, 3,
"time-servers", "IA", &dhcp_universe, 4,
"name-servers", "IA", &dhcp_universe, 5,
"domain-name-servers", "IA", &dhcp_universe, 6,
"log-servers", "IA", &dhcp_universe, 7,
"cookie-servers", "IA", &dhcp_universe, 8,
"lpr-servers", "IA", &dhcp_universe, 9,
"impress-servers", "IA", &dhcp_universe, 10,
"resource-location-servers", "IA", &dhcp_universe, 11,
"host-name", "t", &dhcp_universe, 12,
"boot-size", "S", &dhcp_universe, 13,
"merit-dump", "t", &dhcp_universe, 14,
"domain-name", "t", &dhcp_universe, 15,
"swap-server", "I", &dhcp_universe, 16,
"root-path", "t", &dhcp_universe, 17,
"extensions-path", "t", &dhcp_universe, 18,
"ip-forwarding", "f", &dhcp_universe, 19,
"non-local-source-routing", "f", &dhcp_universe, 20,
"policy-filter", "IIA", &dhcp_universe, 21,
"max-dgram-reassembly", "S", &dhcp_universe, 22,
"default-ip-ttl", "B", &dhcp_universe, 23,
"path-mtu-aging-timeout", "L", &dhcp_universe, 24,
"path-mtu-plateau-table", "SA", &dhcp_universe, 25,
"interface-mtu", "S", &dhcp_universe, 26,
"all-subnets-local", "f", &dhcp_universe, 27,
"broadcast-address", "I", &dhcp_universe, 28,
"perform-mask-discovery", "f", &dhcp_universe, 29,
"mask-supplier", "f", &dhcp_universe, 30,
"router-discovery", "f", &dhcp_universe, 31,
"router-solicitation-address", "I", &dhcp_universe, 32,
"static-routes", "IIA", &dhcp_universe, 33,
"trailer-encapsulation", "f", &dhcp_universe, 34,
"arp-cache-timeout", "L", &dhcp_universe, 35,
"ieee802.3-encapsulation", "f", &dhcp_universe, 36,
"default-tcp-ttl", "B", &dhcp_universe, 37,
"tcp-keepalive-interval", "L", &dhcp_universe, 38,
"tcp-keepalive-garbage", "f", &dhcp_universe, 39,
"nis-domain", "t", &dhcp_universe, 40,
"nis-servers", "IA", &dhcp_universe, 41,
"ntp-servers", "IA", &dhcp_universe, 42,
"vendor-encapsulated-options", "t", &dhcp_universe, 43,
"netbios-name-servers", "IA", &dhcp_universe, 44,
"netbios-dd-server", "IA", &dhcp_universe, 45,
"netbios-node-type", "B", &dhcp_universe, 46,
"netbios-scope", "t", &dhcp_universe, 47,
"font-servers", "IA", &dhcp_universe, 48,
"x-display-manager", "IA", &dhcp_universe, 49,
"dhcp-requested-address", "I", &dhcp_universe, 50,
"dhcp-lease-time", "L", &dhcp_universe, 51,
"dhcp-option-overload", "B", &dhcp_universe, 52,
"dhcp-message-type", "B", &dhcp_universe, 53,
"dhcp-server-identifier", "I", &dhcp_universe, 54,
"dhcp-parameter-request-list", "BA", &dhcp_universe, 55,
"dhcp-message", "t", &dhcp_universe, 56,
"dhcp-max-message-size", "S", &dhcp_universe, 57,
"dhcp-renewal-time", "L", &dhcp_universe, 58,
"dhcp-rebinding-time", "L", &dhcp_universe, 59,
"dhcp-class-identifier", "t", &dhcp_universe, 60,
"dhcp-client-identifier", "t", &dhcp_universe, 61,
"option-62", "", &dhcp_universe, 62,
"option-63", "", &dhcp_universe, 63,
"option-64", "", &dhcp_universe, 64,
"option-65", "", &dhcp_universe, 65,
"option-66", "", &dhcp_universe, 66,
"option-67", "", &dhcp_universe, 67,
"option-68", "", &dhcp_universe, 68,
"option-69", "", &dhcp_universe, 69,
"option-70", "", &dhcp_universe, 70,
"option-71", "", &dhcp_universe, 71,
"option-72", "", &dhcp_universe, 72,
"option-73", "", &dhcp_universe, 73,
"option-74", "", &dhcp_universe, 74,
"option-75", "", &dhcp_universe, 75,
"option-76", "", &dhcp_universe, 76,
"option-77", "", &dhcp_universe, 77,
"option-78", "", &dhcp_universe, 78,
"option-79", "", &dhcp_universe, 79,
"option-80", "", &dhcp_universe, 80,
"option-81", "", &dhcp_universe, 81,
"option-82", "", &dhcp_universe, 82,
"option-83", "", &dhcp_universe, 83,
"option-84", "", &dhcp_universe, 84,
"option-85", "", &dhcp_universe, 85,
"option-86", "", &dhcp_universe, 86,
"option-87", "", &dhcp_universe, 87,
"option-88", "", &dhcp_universe, 88,
"option-89", "", &dhcp_universe, 89,
"option-90", "", &dhcp_universe, 90,
"option-91", "", &dhcp_universe, 91,
"option-92", "", &dhcp_universe, 92,
"option-93", "", &dhcp_universe, 93,
"option-94", "", &dhcp_universe, 94,
"option-95", "", &dhcp_universe, 95,
"option-96", "", &dhcp_universe, 96,
"option-97", "", &dhcp_universe, 97,
"option-98", "", &dhcp_universe, 98,
"option-99", "", &dhcp_universe, 99,
"option-100", "", &dhcp_universe, 100,
"option-101", "", &dhcp_universe, 101,
"option-102", "", &dhcp_universe, 102,
"option-103", "", &dhcp_universe, 103,
"option-104", "", &dhcp_universe, 104,
"option-105", "", &dhcp_universe, 105,
"option-106", "", &dhcp_universe, 106,
"option-107", "", &dhcp_universe, 107,
"option-108", "", &dhcp_universe, 108,
"option-109", "", &dhcp_universe, 109,
"option-110", "", &dhcp_universe, 110,
"option-111", "", &dhcp_universe, 111,
"option-112", "", &dhcp_universe, 112,
"option-113", "", &dhcp_universe, 113,
"option-114", "", &dhcp_universe, 114,
"option-115", "", &dhcp_universe, 115,
"option-116", "", &dhcp_universe, 116,
"option-117", "", &dhcp_universe, 117,
"option-118", "", &dhcp_universe, 118,
"option-119", "", &dhcp_universe, 119,
"option-120", "", &dhcp_universe, 120,
"option-121", "", &dhcp_universe, 121,
"option-122", "", &dhcp_universe, 122,
"option-123", "", &dhcp_universe, 123,
"option-124", "", &dhcp_universe, 124,
"option-125", "", &dhcp_universe, 125,
"option-126", "", &dhcp_universe, 126,
"option-127", "", &dhcp_universe, 127,
"option-128", "", &dhcp_universe, 128,
"option-129", "", &dhcp_universe, 129,
"option-130", "", &dhcp_universe, 130,
"option-131", "", &dhcp_universe, 131,
"option-132", "", &dhcp_universe, 132,
"option-133", "", &dhcp_universe, 133,
"option-134", "", &dhcp_universe, 134,
"option-135", "", &dhcp_universe, 135,
"option-136", "", &dhcp_universe, 136,
"option-137", "", &dhcp_universe, 137,
"option-138", "", &dhcp_universe, 138,
"option-139", "", &dhcp_universe, 139,
"option-140", "", &dhcp_universe, 140,
"option-141", "", &dhcp_universe, 141,
"option-142", "", &dhcp_universe, 142,
"option-143", "", &dhcp_universe, 143,
"option-144", "", &dhcp_universe, 144,
"option-145", "", &dhcp_universe, 145,
"option-146", "", &dhcp_universe, 146,
"option-147", "", &dhcp_universe, 147,
"option-148", "", &dhcp_universe, 148,
"option-149", "", &dhcp_universe, 149,
"option-150", "", &dhcp_universe, 150,
"option-151", "", &dhcp_universe, 151,
"option-152", "", &dhcp_universe, 152,
"option-153", "", &dhcp_universe, 153,
"option-154", "", &dhcp_universe, 154,
"option-155", "", &dhcp_universe, 155,
"option-156", "", &dhcp_universe, 156,
"option-157", "", &dhcp_universe, 157,
"option-158", "", &dhcp_universe, 158,
"option-159", "", &dhcp_universe, 159,
"option-160", "", &dhcp_universe, 160,
"option-161", "", &dhcp_universe, 161,
"option-162", "", &dhcp_universe, 162,
"option-163", "", &dhcp_universe, 163,
"option-164", "", &dhcp_universe, 164,
"option-165", "", &dhcp_universe, 165,
"option-166", "", &dhcp_universe, 166,
"option-167", "", &dhcp_universe, 167,
"option-168", "", &dhcp_universe, 168,
"option-169", "", &dhcp_universe, 169,
"option-170", "", &dhcp_universe, 170,
"option-171", "", &dhcp_universe, 171,
"option-172", "", &dhcp_universe, 172,
"option-173", "", &dhcp_universe, 173,
"option-174", "", &dhcp_universe, 174,
"option-175", "", &dhcp_universe, 175,
"option-176", "", &dhcp_universe, 176,
"option-177", "", &dhcp_universe, 177,
"option-178", "", &dhcp_universe, 178,
"option-179", "", &dhcp_universe, 179,
"option-180", "", &dhcp_universe, 180,
"option-181", "", &dhcp_universe, 181,
"option-182", "", &dhcp_universe, 182,
"option-183", "", &dhcp_universe, 183,
"option-184", "", &dhcp_universe, 184,
"option-185", "", &dhcp_universe, 185,
"option-186", "", &dhcp_universe, 186,
"option-187", "", &dhcp_universe, 187,
"option-188", "", &dhcp_universe, 188,
"option-189", "", &dhcp_universe, 189,
"option-190", "", &dhcp_universe, 190,
"option-191", "", &dhcp_universe, 191,
"option-192", "", &dhcp_universe, 192,
"option-193", "", &dhcp_universe, 193,
"option-194", "", &dhcp_universe, 194,
"option-195", "", &dhcp_universe, 195,
"option-196", "", &dhcp_universe, 196,
"option-197", "", &dhcp_universe, 197,
"option-198", "", &dhcp_universe, 198,
"option-199", "", &dhcp_universe, 199,
"option-200", "", &dhcp_universe, 200,
"option-201", "", &dhcp_universe, 201,
"option-202", "", &dhcp_universe, 202,
"option-203", "", &dhcp_universe, 203,
"option-204", "", &dhcp_universe, 204,
"option-205", "", &dhcp_universe, 205,
"option-206", "", &dhcp_universe, 206,
"option-207", "", &dhcp_universe, 207,
"option-208", "", &dhcp_universe, 208,
"option-209", "", &dhcp_universe, 209,
"option-210", "", &dhcp_universe, 210,
"option-211", "", &dhcp_universe, 211,
"option-212", "", &dhcp_universe, 212,
"option-213", "", &dhcp_universe, 213,
"option-214", "", &dhcp_universe, 214,
"option-215", "", &dhcp_universe, 215,
"option-216", "", &dhcp_universe, 216,
"option-217", "", &dhcp_universe, 217,
"option-218", "", &dhcp_universe, 218,
"option-219", "", &dhcp_universe, 219,
"option-220", "", &dhcp_universe, 220,
"option-221", "", &dhcp_universe, 221,
"option-222", "", &dhcp_universe, 222,
"option-223", "", &dhcp_universe, 223,
"option-224", "", &dhcp_universe, 224,
"option-225", "", &dhcp_universe, 225,
"option-226", "", &dhcp_universe, 226,
"option-227", "", &dhcp_universe, 227,
"option-228", "", &dhcp_universe, 228,
"option-229", "", &dhcp_universe, 229,
"option-230", "", &dhcp_universe, 230,
"option-231", "", &dhcp_universe, 231,
"option-232", "", &dhcp_universe, 232,
"option-233", "", &dhcp_universe, 233,
"option-234", "", &dhcp_universe, 234,
"option-235", "", &dhcp_universe, 235,
"option-236", "", &dhcp_universe, 236,
"option-237", "", &dhcp_universe, 237,
"option-238", "", &dhcp_universe, 238,
"option-239", "", &dhcp_universe, 239,
"option-240", "", &dhcp_universe, 240,
"option-241", "", &dhcp_universe, 241,
"option-242", "", &dhcp_universe, 242,
"option-243", "", &dhcp_universe, 243,
"option-244", "", &dhcp_universe, 244,
"option-245", "", &dhcp_universe, 245,
"option-246", "", &dhcp_universe, 246,
"option-247", "", &dhcp_universe, 247,
"option-248", "", &dhcp_universe, 248,
"option-249", "", &dhcp_universe, 249,
"option-250", "", &dhcp_universe, 250,
"option-251", "", &dhcp_universe, 251,
"option-252", "", &dhcp_universe, 252,
"option-253", "", &dhcp_universe, 253,
"option-254", "", &dhcp_universe, 254,
"option-end", "e", &dhcp_universe, 255,
{ "pad", "", &dhcp_universe, 0 },
{ "subnet-mask", "I", &dhcp_universe, 1 },
{ "time-offset", "l", &dhcp_universe, 2 },
{ "routers", "IA", &dhcp_universe, 3 },
{ "time-servers", "IA", &dhcp_universe, 4 },
{ "name-servers", "IA", &dhcp_universe, 5 },
{ "domain-name-servers", "IA", &dhcp_universe, 6 },
{ "log-servers", "IA", &dhcp_universe, 7 },
{ "cookie-servers", "IA", &dhcp_universe, 8 },
{ "lpr-servers", "IA", &dhcp_universe, 9 },
{ "impress-servers", "IA", &dhcp_universe, 10 },
{ "resource-location-servers", "IA", &dhcp_universe, 11 },
{ "host-name", "t", &dhcp_universe, 12 },
{ "boot-size", "S", &dhcp_universe, 13 },
{ "merit-dump", "t", &dhcp_universe, 14 },
{ "domain-name", "t", &dhcp_universe, 15 },
{ "swap-server", "I", &dhcp_universe, 16 },
{ "root-path", "t", &dhcp_universe, 17 },
{ "extensions-path", "t", &dhcp_universe, 18 },
{ "ip-forwarding", "f", &dhcp_universe, 19 },
{ "non-local-source-routing", "f", &dhcp_universe, 20 },
{ "policy-filter", "IIA", &dhcp_universe, 21 },
{ "max-dgram-reassembly", "S", &dhcp_universe, 22 },
{ "default-ip-ttl", "B", &dhcp_universe, 23 },
{ "path-mtu-aging-timeout", "L", &dhcp_universe, 24 },
{ "path-mtu-plateau-table", "SA", &dhcp_universe, 25 },
{ "interface-mtu", "S", &dhcp_universe, 26 },
{ "all-subnets-local", "f", &dhcp_universe, 27 },
{ "broadcast-address", "I", &dhcp_universe, 28 },
{ "perform-mask-discovery", "f", &dhcp_universe, 29 },
{ "mask-supplier", "f", &dhcp_universe, 30 },
{ "router-discovery", "f", &dhcp_universe, 31 },
{ "router-solicitation-address", "I", &dhcp_universe, 32 },
{ "static-routes", "IIA", &dhcp_universe, 33 },
{ "trailer-encapsulation", "f", &dhcp_universe, 34 },
{ "arp-cache-timeout", "L", &dhcp_universe, 35 },
{ "ieee802.3-encapsulation", "f", &dhcp_universe, 36 },
{ "default-tcp-ttl", "B", &dhcp_universe, 37 },
{ "tcp-keepalive-interval", "L", &dhcp_universe, 38 },
{ "tcp-keepalive-garbage", "f", &dhcp_universe, 39 },
{ "nis-domain", "t", &dhcp_universe, 40 },
{ "nis-servers", "IA", &dhcp_universe, 41 },
{ "ntp-servers", "IA", &dhcp_universe, 42 },
{ "vendor-encapsulated-options", "t", &dhcp_universe, 43 },
{ "netbios-name-servers", "IA", &dhcp_universe, 44 },
{ "netbios-dd-server", "IA", &dhcp_universe, 45 },
{ "netbios-node-type", "B", &dhcp_universe, 46 },
{ "netbios-scope", "t", &dhcp_universe, 47 },
{ "font-servers", "IA", &dhcp_universe, 48 },
{ "x-display-manager", "IA", &dhcp_universe, 49 },
{ "dhcp-requested-address", "I", &dhcp_universe, 50 },
{ "dhcp-lease-time", "L", &dhcp_universe, 51 },
{ "dhcp-option-overload", "B", &dhcp_universe, 52 },
{ "dhcp-message-type", "B", &dhcp_universe, 53 },
{ "dhcp-server-identifier", "I", &dhcp_universe, 54 },
{ "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 },
{ "dhcp-message", "t", &dhcp_universe, 56 },
{ "dhcp-max-message-size", "S", &dhcp_universe, 57 },
{ "dhcp-renewal-time", "L", &dhcp_universe, 58 },
{ "dhcp-rebinding-time", "L", &dhcp_universe, 59 },
{ "dhcp-class-identifier", "t", &dhcp_universe, 60 },
{ "dhcp-client-identifier", "t", &dhcp_universe, 61 },
{ "option-62", "", &dhcp_universe, 62 },
{ "option-63", "", &dhcp_universe, 63 },
{ "option-64", "", &dhcp_universe, 64 },
{ "option-65", "", &dhcp_universe, 65 },
{ "option-66", "", &dhcp_universe, 66 },
{ "option-67", "", &dhcp_universe, 67 },
{ "option-68", "", &dhcp_universe, 68 },
{ "option-69", "", &dhcp_universe, 69 },
{ "option-70", "", &dhcp_universe, 70 },
{ "option-71", "", &dhcp_universe, 71 },
{ "option-72", "", &dhcp_universe, 72 },
{ "option-73", "", &dhcp_universe, 73 },
{ "option-74", "", &dhcp_universe, 74 },
{ "option-75", "", &dhcp_universe, 75 },
{ "option-76", "", &dhcp_universe, 76 },
{ "option-77", "", &dhcp_universe, 77 },
{ "option-78", "", &dhcp_universe, 78 },
{ "option-79", "", &dhcp_universe, 79 },
{ "option-80", "", &dhcp_universe, 80 },
{ "option-81", "", &dhcp_universe, 81 },
{ "option-82", "", &dhcp_universe, 82 },
{ "option-83", "", &dhcp_universe, 83 },
{ "option-84", "", &dhcp_universe, 84 },
{ "option-85", "", &dhcp_universe, 85 },
{ "option-86", "", &dhcp_universe, 86 },
{ "option-87", "", &dhcp_universe, 87 },
{ "option-88", "", &dhcp_universe, 88 },
{ "option-89", "", &dhcp_universe, 89 },
{ "option-90", "", &dhcp_universe, 90 },
{ "option-91", "", &dhcp_universe, 91 },
{ "option-92", "", &dhcp_universe, 92 },
{ "option-93", "", &dhcp_universe, 93 },
{ "option-94", "", &dhcp_universe, 94 },
{ "option-95", "", &dhcp_universe, 95 },
{ "option-96", "", &dhcp_universe, 96 },
{ "option-97", "", &dhcp_universe, 97 },
{ "option-98", "", &dhcp_universe, 98 },
{ "option-99", "", &dhcp_universe, 99 },
{ "option-100", "", &dhcp_universe, 100 },
{ "option-101", "", &dhcp_universe, 101 },
{ "option-102", "", &dhcp_universe, 102 },
{ "option-103", "", &dhcp_universe, 103 },
{ "option-104", "", &dhcp_universe, 104 },
{ "option-105", "", &dhcp_universe, 105 },
{ "option-106", "", &dhcp_universe, 106 },
{ "option-107", "", &dhcp_universe, 107 },
{ "option-108", "", &dhcp_universe, 108 },
{ "option-109", "", &dhcp_universe, 109 },
{ "option-110", "", &dhcp_universe, 110 },
{ "option-111", "", &dhcp_universe, 111 },
{ "option-112", "", &dhcp_universe, 112 },
{ "option-113", "", &dhcp_universe, 113 },
{ "option-114", "", &dhcp_universe, 114 },
{ "option-115", "", &dhcp_universe, 115 },
{ "option-116", "", &dhcp_universe, 116 },
{ "option-117", "", &dhcp_universe, 117 },
{ "option-118", "", &dhcp_universe, 118 },
{ "option-119", "", &dhcp_universe, 119 },
{ "option-120", "", &dhcp_universe, 120 },
{ "option-121", "", &dhcp_universe, 121 },
{ "option-122", "", &dhcp_universe, 122 },
{ "option-123", "", &dhcp_universe, 123 },
{ "option-124", "", &dhcp_universe, 124 },
{ "option-125", "", &dhcp_universe, 125 },
{ "option-126", "", &dhcp_universe, 126 },
{ "option-127", "", &dhcp_universe, 127 },
{ "option-128", "", &dhcp_universe, 128 },
{ "option-129", "", &dhcp_universe, 129 },
{ "option-130", "", &dhcp_universe, 130 },
{ "option-131", "", &dhcp_universe, 131 },
{ "option-132", "", &dhcp_universe, 132 },
{ "option-133", "", &dhcp_universe, 133 },
{ "option-134", "", &dhcp_universe, 134 },
{ "option-135", "", &dhcp_universe, 135 },
{ "option-136", "", &dhcp_universe, 136 },
{ "option-137", "", &dhcp_universe, 137 },
{ "option-138", "", &dhcp_universe, 138 },
{ "option-139", "", &dhcp_universe, 139 },
{ "option-140", "", &dhcp_universe, 140 },
{ "option-141", "", &dhcp_universe, 141 },
{ "option-142", "", &dhcp_universe, 142 },
{ "option-143", "", &dhcp_universe, 143 },
{ "option-144", "", &dhcp_universe, 144 },
{ "option-145", "", &dhcp_universe, 145 },
{ "option-146", "", &dhcp_universe, 146 },
{ "option-147", "", &dhcp_universe, 147 },
{ "option-148", "", &dhcp_universe, 148 },
{ "option-149", "", &dhcp_universe, 149 },
{ "option-150", "", &dhcp_universe, 150 },
{ "option-151", "", &dhcp_universe, 151 },
{ "option-152", "", &dhcp_universe, 152 },
{ "option-153", "", &dhcp_universe, 153 },
{ "option-154", "", &dhcp_universe, 154 },
{ "option-155", "", &dhcp_universe, 155 },
{ "option-156", "", &dhcp_universe, 156 },
{ "option-157", "", &dhcp_universe, 157 },
{ "option-158", "", &dhcp_universe, 158 },
{ "option-159", "", &dhcp_universe, 159 },
{ "option-160", "", &dhcp_universe, 160 },
{ "option-161", "", &dhcp_universe, 161 },
{ "option-162", "", &dhcp_universe, 162 },
{ "option-163", "", &dhcp_universe, 163 },
{ "option-164", "", &dhcp_universe, 164 },
{ "option-165", "", &dhcp_universe, 165 },
{ "option-166", "", &dhcp_universe, 166 },
{ "option-167", "", &dhcp_universe, 167 },
{ "option-168", "", &dhcp_universe, 168 },
{ "option-169", "", &dhcp_universe, 169 },
{ "option-170", "", &dhcp_universe, 170 },
{ "option-171", "", &dhcp_universe, 171 },
{ "option-172", "", &dhcp_universe, 172 },
{ "option-173", "", &dhcp_universe, 173 },
{ "option-174", "", &dhcp_universe, 174 },
{ "option-175", "", &dhcp_universe, 175 },
{ "option-176", "", &dhcp_universe, 176 },
{ "option-177", "", &dhcp_universe, 177 },
{ "option-178", "", &dhcp_universe, 178 },
{ "option-179", "", &dhcp_universe, 179 },
{ "option-180", "", &dhcp_universe, 180 },
{ "option-181", "", &dhcp_universe, 181 },
{ "option-182", "", &dhcp_universe, 182 },
{ "option-183", "", &dhcp_universe, 183 },
{ "option-184", "", &dhcp_universe, 184 },
{ "option-185", "", &dhcp_universe, 185 },
{ "option-186", "", &dhcp_universe, 186 },
{ "option-187", "", &dhcp_universe, 187 },
{ "option-188", "", &dhcp_universe, 188 },
{ "option-189", "", &dhcp_universe, 189 },
{ "option-190", "", &dhcp_universe, 190 },
{ "option-191", "", &dhcp_universe, 191 },
{ "option-192", "", &dhcp_universe, 192 },
{ "option-193", "", &dhcp_universe, 193 },
{ "option-194", "", &dhcp_universe, 194 },
{ "option-195", "", &dhcp_universe, 195 },
{ "option-196", "", &dhcp_universe, 196 },
{ "option-197", "", &dhcp_universe, 197 },
{ "option-198", "", &dhcp_universe, 198 },
{ "option-199", "", &dhcp_universe, 199 },
{ "option-200", "", &dhcp_universe, 200 },
{ "option-201", "", &dhcp_universe, 201 },
{ "option-202", "", &dhcp_universe, 202 },
{ "option-203", "", &dhcp_universe, 203 },
{ "option-204", "", &dhcp_universe, 204 },
{ "option-205", "", &dhcp_universe, 205 },
{ "option-206", "", &dhcp_universe, 206 },
{ "option-207", "", &dhcp_universe, 207 },
{ "option-208", "", &dhcp_universe, 208 },
{ "option-209", "", &dhcp_universe, 209 },
{ "option-210", "", &dhcp_universe, 210 },
{ "option-211", "", &dhcp_universe, 211 },
{ "option-212", "", &dhcp_universe, 212 },
{ "option-213", "", &dhcp_universe, 213 },
{ "option-214", "", &dhcp_universe, 214 },
{ "option-215", "", &dhcp_universe, 215 },
{ "option-216", "", &dhcp_universe, 216 },
{ "option-217", "", &dhcp_universe, 217 },
{ "option-218", "", &dhcp_universe, 218 },
{ "option-219", "", &dhcp_universe, 219 },
{ "option-220", "", &dhcp_universe, 220 },
{ "option-221", "", &dhcp_universe, 221 },
{ "option-222", "", &dhcp_universe, 222 },
{ "option-223", "", &dhcp_universe, 223 },
{ "option-224", "", &dhcp_universe, 224 },
{ "option-225", "", &dhcp_universe, 225 },
{ "option-226", "", &dhcp_universe, 226 },
{ "option-227", "", &dhcp_universe, 227 },
{ "option-228", "", &dhcp_universe, 228 },
{ "option-229", "", &dhcp_universe, 229 },
{ "option-230", "", &dhcp_universe, 230 },
{ "option-231", "", &dhcp_universe, 231 },
{ "option-232", "", &dhcp_universe, 232 },
{ "option-233", "", &dhcp_universe, 233 },
{ "option-234", "", &dhcp_universe, 234 },
{ "option-235", "", &dhcp_universe, 235 },
{ "option-236", "", &dhcp_universe, 236 },
{ "option-237", "", &dhcp_universe, 237 },
{ "option-238", "", &dhcp_universe, 238 },
{ "option-239", "", &dhcp_universe, 239 },
{ "option-240", "", &dhcp_universe, 240 },
{ "option-241", "", &dhcp_universe, 241 },
{ "option-242", "", &dhcp_universe, 242 },
{ "option-243", "", &dhcp_universe, 243 },
{ "option-244", "", &dhcp_universe, 244 },
{ "option-245", "", &dhcp_universe, 245 },
{ "option-246", "", &dhcp_universe, 246 },
{ "option-247", "", &dhcp_universe, 247 },
{ "option-248", "", &dhcp_universe, 248 },
{ "option-249", "", &dhcp_universe, 249 },
{ "option-250", "", &dhcp_universe, 250 },
{ "option-251", "", &dhcp_universe, 251 },
{ "option-252", "", &dhcp_universe, 252 },
{ "option-253", "", &dhcp_universe, 253 },
{ "option-254", "", &dhcp_universe, 254 },
{ "option-end", "e", &dhcp_universe, 255 },
};
/* Default dhcp option priority list (this is ad hoc and should not be

2
tree.c
View File

@@ -138,7 +138,7 @@ struct tree *tree_concat (left, right)
return left;
/* If both trees are constant, combine them. */
if (left -> op = TREE_CONST && right -> op == TREE_CONST) {
if (left -> op == TREE_CONST && right -> op == TREE_CONST) {
unsigned char *buf = dmalloc (left -> data.const_val.len
+ right -> data.const_val.len,
"tree_concat");