33 static unsigned char global_host_once = 1;
35 static int parse_binding_value(
struct parse *cfile,
62 #if defined(LDAP_CONFIGURATION)
63 if (res != ISC_R_SUCCESS)
66 return ldap_read_config ();
73 int group_type,
int leasep)
86 ttype = trace_readleases_type;
88 ttype = trace_readconf_type;
97 if (status != ISC_R_SUCCESS)
107 tflen = strlen (dbuf);
108 ulen = ulen - tflen - 1;
109 fbuf = dbuf + tflen + 1;
114 if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) {
116 log_error (
"Can't open lease database %s: %m --",
118 log_error (
" check for failed database %s!",
120 log_error (
"Please read the dhcpd.leases manual%s",
122 log_fatal (
"don't know what to do about this.");
124 log_fatal (
"Can't open %s: %m", filename);
128 cfile = (
struct parse *)0;
129 #if defined (TRACING)
130 flen = lseek (file, (off_t)0, SEEK_END);
133 log_fatal (
"Can't lseek on %s: %m", filename);
135 if (lseek (file, (off_t)0, SEEK_SET) < 0)
138 if (flen > 0x7FFFFFFFUL)
139 log_fatal (
"%s: file is too long to buffer.", filename);
144 tflen = strlen (filename);
147 log_fatal (
"No memory for %s (%d bytes)",
151 strcpy (dbuf, filename);
154 fbuf = dbuf + tflen + 1;
155 result = read (file, fbuf, ulen);
157 log_fatal (
"Can't read in %s: %m", filename);
159 log_fatal (
"%s: short read of %d bytes instead of %d.",
160 filename, ulen, result);
166 status =
new_parse(&cfile, -1, fbuf, ulen, filename, 0);
168 status =
new_parse(&cfile, file, NULL, 0, filename, 0);
170 if (status != ISC_R_SUCCESS || cfile == NULL)
178 #if defined (TRACING)
184 #if defined (TRACING)
191 static int postconf_initialized;
192 static int leaseconf_initialized;
197 tflen = strlen (data);
198 flen = len - tflen - 1;
199 fbuf = data + tflen + 1;
205 status =
new_parse(&cfile, -1, fbuf, flen, data, 0);
206 if (status == ISC_R_SUCCESS || cfile != NULL) {
207 if (ttype == trace_readleases_type)
216 if (!postconf_initialized && ttype == trace_readconf_type) {
218 postconf_initialized = 1;
221 if (!leaseconf_initialized && ttype == trace_readleases_type) {
222 #if defined (PARANOIA)
227 leaseconf_initialized = 1;
248 token =
peek_token (&val, (
unsigned *)0, cfile);
273 token =
next_token (&val, (
unsigned *)0, cfile);
276 if (token ==
LEASE) {
280 lease_dereference (&lease,
MDL);
283 "possibly corrupt lease file");
284 }
else if (token ==
IA_NA) {
286 }
else if (token ==
IA_TA) {
288 }
else if (token ==
IA_PD) {
290 }
else if (token ==
CLASS) {
296 }
else if (token ==
HOST) {
298 }
else if (token ==
GROUP) {
300 #if defined (FAILOVER_PROTOCOL)
303 (cfile, (dhcp_failover_state_t *)0);
310 log_error (
"Corrupt lease file - possible data loss!");
371 token =
peek_token (&val, (
unsigned *)0, cfile);
376 token =
next_token (&val, (
unsigned *)0, cfile);
378 parse_warn (cfile,
"filename string expected.");
382 if (status != ISC_R_SUCCESS)
391 if (global_host_once &&
393 global_host_once = 0;
394 log_error(
"WARNING: Host declarations are "
395 "global. They are not limited to "
396 "the scope you declared them in.");
402 "host declarations not allowed here.");
413 "group declarations not allowed here.");
424 parse_warn (cfile,
"shared-network parameters not %s.",
439 "subnet declarations not allowed here.");
465 status = shared_network_allocate (&share,
MDL);
466 if (status != ISC_R_SUCCESS)
467 log_fatal (
"Can't allocate shared subnet: %s",
468 isc_result_totext (status));
470 log_fatal (
"Can't allocate group for shared net");
501 share->
name = strdup(n);
503 if (share->
name == NULL)
504 log_fatal(
"Out of memory allocating default "
505 "shared network name (\"%s\").", n);
513 shared_network_dereference(&share,
MDL);
520 "class declarations not allowed here.");
531 "class declarations not allowed here.");
542 "class declarations not allowed here.");
553 "class declarations not allowed here.");
563 memset (&hardware, 0,
sizeof hardware);
564 if (host_decl && memcmp(&hardware, &(host_decl->
interface),
565 sizeof(hardware)) != 0) {
566 parse_warn(cfile,
"Host %s hardware address already "
567 "configured.", host_decl->
name);
573 host_decl ->
interface = hardware;
575 parse_warn (cfile,
"hardware address parameter %s",
576 "not allowed here.");
588 "Only one fixed address "
589 "declaration per host.");
595 "fixed-address parameter not "
605 parse_warn (cfile,
"pool declared within pool.");
608 parse_warn (cfile,
"pool declared outside of network");
619 "range declaration not allowed here.");
632 "range6 declaration not allowed here.");
643 "prefix6 declaration not allowed here.");
654 "fixed-prefix6 declaration not "
665 parse_warn (cfile,
"pool6 declared within pool.");
668 parse_warn (cfile,
"pool6 declared outside of network");
679 token =
next_token (&val, (
unsigned *)0, cfile);
682 group -> authoritative = 0;
692 group -> authoritative = 1;
695 parse_warn (cfile,
"authority makes no sense here.");
705 log_fatal(
"Server identifier not in hash (%s:%d).",
712 token =
peek_token (&val, (
unsigned *)0, cfile);
713 if (token ==
SPACE) {
716 "option space definitions %s",
717 "may not be scoped.");
727 if (status == ISC_R_SUCCESS) {
728 token =
peek_token (&val, (
unsigned *)0, cfile);
732 "option definitions%s",
733 " may not be scoped.");
745 option_name_hash_delete(
748 option_code_hash_delete(
772 (&et, cfile, 1, option,
776 goto insert_statement;
784 parse_warn (cfile,
"failover peers may only be %s",
785 "defined in shared-network");
786 log_error (
"declarations and the outer scope.");
790 token =
next_token (&val, (
unsigned *)0, cfile);
791 #if defined (FAILOVER_PROTOCOL)
813 "expecting a declaration");
816 "expecting a parameter %s",
869 #if defined (FAILOVER_PROTOCOL)
877 dhcp_failover_state_t *peer;
882 unsigned hba_len =
sizeof hba;
886 dhcp_failover_config_t *cp;
888 token =
next_token (&val, (
unsigned *)0, cfile);
895 token =
next_token (&val, (
unsigned *)0, cfile);
899 log_fatal (
"no memory for peer name %s", name);
902 parse_warn (cfile,
"expecting failover peer name.");
908 peer = (dhcp_failover_state_t *)0;
911 token =
next_token (&val, (
unsigned *)0, cfile);
914 parse_warn (cfile,
"failover peer reference not %s",
915 "in shared-network declaration");
918 parse_warn (cfile,
"reference to unknown%s%s",
919 " failover peer ", name);
923 dhcp_failover_state_reference
927 dhcp_failover_state_dereference (&peer,
MDL);
930 }
else if (token ==
STATE) {
932 parse_warn (cfile,
"state declaration for unknown%s%s",
933 " failover peer ", name);
938 dhcp_failover_state_dereference (&peer,
MDL);
941 }
else if (token !=
LBRACE) {
948 parse_warn (cfile,
"redeclaration of failover peer %s", name);
950 dhcp_failover_state_dereference (&peer,
MDL);
955 status = dhcp_failover_state_allocate (&peer,
MDL);
956 if (status != ISC_R_SUCCESS)
957 log_fatal (
"Can't allocate failover peer %s: %s",
958 name, isc_result_totext (status));
966 token =
next_token (&val, (
unsigned *)0, cfile);
972 peer -> i_am = primary;
976 peer -> i_am = secondary;
979 "secondary may not define %s",
980 "load balance settings.");
984 cp = &peer -> partner;
991 dhcp_failover_state_dereference (&peer,
MDL);
1001 token =
next_token (&val, (
unsigned *)0, cfile);
1006 cp -> port = atoi (val);
1010 tp = &peer->max_lease_misbalance;
1014 tp = &peer->max_lease_ownership;
1018 tp = &peer->max_balance;
1022 tp = &peer->min_balance;
1026 tp = &peer->auto_partner_down;
1030 tp = &cp -> max_response_delay;
1032 token =
next_token (&val, (
unsigned *)0, cfile);
1036 dhcp_failover_state_dereference (&peer,
MDL);
1043 tp = &cp -> max_flying_updates;
1052 if (peer -> i_am == secondary)
1054 "secondary may not define %s",
1055 "load balance settings.");
1059 dhcp_failover_state_dereference (&peer,
MDL);
1062 if (hba_len != 32) {
1064 "HBA must be exactly 32 bytes.");
1073 memcpy (peer -> hba, hba, 32);
1077 token =
next_token (&val, (
unsigned *)0, cfile);
1078 if (peer -> i_am == secondary)
1080 "secondary may not define %s",
1081 "load balance settings.");
1085 dhcp_failover_state_dereference (&peer,
MDL);
1091 "0 and 256, inclusive");
1093 memset (hba, 0,
sizeof hba);
1094 for (i = 0; i < split; i++) {
1096 hba [i / 8] |= (1 << (i & 7));
1103 token =
next_token (&val, (
unsigned *)0, cfile);
1110 token =
next_token (&val, (
unsigned *)0, cfile);
1115 token =
next_token (&val, (
unsigned *)0, cfile);
1120 token =
next_token (&val, (
unsigned *)0, cfile);
1125 peer -> load_balance_max_secs = atoi (val);
1130 "invalid statement in peer declaration");
1132 dhcp_failover_state_dereference (&peer,
MDL);
1137 dhcp_failover_state_dereference (&peer,
MDL);
1140 }
while (token !=
RBRACE);
1145 if (!peer -> partner.address)
1146 parse_warn (cfile,
"peer address may not be omitted");
1149 peer->me.port = DEFAULT_FAILOVER_PORT;
1150 if (!peer->partner.port)
1151 peer->partner.port = DEFAULT_FAILOVER_PORT;
1153 if (peer -> i_am == primary) {
1156 "primary failover server must have hba or split.");
1157 }
else if (!peer -> mclt) {
1159 "primary failover server must have mclt.");
1163 if (!peer->max_lease_misbalance)
1164 peer->max_lease_misbalance = DEFAULT_MAX_LEASE_MISBALANCE;
1165 if (!peer->max_lease_ownership)
1166 peer->max_lease_ownership = DEFAULT_MAX_LEASE_OWNERSHIP;
1167 if (!peer->max_balance)
1168 peer->max_balance = DEFAULT_MAX_BALANCE_TIME;
1169 if (!peer->min_balance)
1170 peer->min_balance = DEFAULT_MIN_BALANCE_TIME;
1171 if (!peer->me.max_flying_updates)
1172 peer->me.max_flying_updates = DEFAULT_MAX_FLYING_UPDATES;
1173 if (!peer->me.max_response_delay)
1174 peer->me.max_response_delay = DEFAULT_MAX_RESPONSE_DELAY;
1180 if (peer -> i_am == primary) {
1193 if (status != ISC_R_SUCCESS)
1195 peer -> name, isc_result_totext (status));
1196 dhcp_failover_state_dereference (&peer,
MDL);
1200 dhcp_failover_state_t *peer)
1205 dhcp_failover_state_t *state;
1206 dhcp_failover_config_t *cp;
1209 token =
next_token (&val, (
unsigned *)0, cfile);
1210 if (token !=
PEER) {
1216 token =
next_token (&val, (
unsigned *)0, cfile);
1220 log_fatal (
"failover peer name %s: no memory",
1224 parse_warn (cfile,
"expecting failover peer name.");
1230 state = (dhcp_failover_state_t *)0;
1233 parse_warn (cfile,
"unknown failover peer: %s", name);
1238 token =
next_token (&val, (
unsigned *)0, cfile);
1239 if (token !=
STATE) {
1246 state = (dhcp_failover_state_t *)0;
1247 dhcp_failover_state_reference (&state, peer,
MDL);
1249 token =
next_token (&val, (
unsigned *)0, cfile);
1254 dhcp_failover_state_dereference (&state,
MDL);
1258 token =
next_token (&val, (
unsigned *)0, cfile);
1265 token =
next_token (&val, (
unsigned *)0, cfile);
1266 if (token !=
STATE) {
1271 &cp -> state, &cp -> stos);
1275 cp = &state -> partner;
1279 if (state -> i_am == primary) {
1281 "mclt not valid for primary");
1284 token =
next_token (&val, (
unsigned *)0, cfile);
1289 state -> mclt = atoi (val);
1294 parse_warn (cfile,
"expecting state setting.");
1297 dhcp_failover_state_dereference (&state,
MDL);
1300 }
while (token !=
RBRACE);
1301 dhcp_failover_state_dereference (&state,
MDL);
1305 struct
parse *cfile;
1314 token =
next_token (&val, (
unsigned *)0, cfile);
1369 parse_warn (cfile,
"unknown failover state");
1374 token =
next_token (&val, (
unsigned *)0, cfile);
1375 if (token ==
SEMI) {
1429 void get_permit(cfile, permit_head, is_allow, valid_from, valid_until)
1430 struct
parse *cfile;
1431 struct
permit **permit_head;
1433 TIME *valid_from, *valid_until;
1438 int need_clients = 1;
1503 permit->
class = NULL;
1511 if (*valid_from || *valid_until) {
1512 parse_warn(cfile,
"duplicate \"after\" clause.");
1528 parse_warn (cfile,
"expecting permit type.");
1538 if ((need_clients != 0) &&
1546 while (*permit_head)
1547 permit_head = &((*permit_head)->next);
1548 *permit_head = permit;
1561 struct permit *plp, *prp;
1568 for (plp = lhs; plp; plp = plp ->
next) {
1570 for (prp = rhs; prp; prp = prp ->
next) {
1571 if (prp -> type == plp -> type &&
1573 prp ->
class == plp ->
class)) {
1604 struct
parse *cfile;
1605 struct group *group;
1612 int declaration = 0;
1613 isc_result_t status;
1614 struct lease *lpchain = NULL, *lp;
1617 status = pool_allocate(&pool,
MDL);
1618 if (status != ISC_R_SUCCESS)
1620 isc_result_totext (status));
1630 parse_warn(cfile,
"Dynamic pools are only valid inside "
1631 "subnet or shared-network statements.");
1640 #if defined (FAILOVER_PROTOCOL)
1643 dhcp_failover_state_reference
1649 pool_dereference(&pool,
MDL);
1662 "expecting \"failover peer\".");
1666 #if defined (FAILOVER_PROTOCOL)
1668 dhcp_failover_state_dereference
1673 #if defined (FAILOVER_PROTOCOL)
1677 if (token !=
PEER) {
1689 dhcp_failover_state_dereference
1693 if (status != ISC_R_SUCCESS)
1695 "failover peer %s: %s", val,
1696 isc_result_totext (status));
1746 #if defined (FAILOVER_PROTOCOL)
1762 for (lp = lpchain; lp; lp = lp->
next) {
1763 pool_dereference(&lp->pool,
MDL);
1764 pool_reference(&lp->pool, pp,
MDL);
1773 for (; *p; p = &((*p)->next))
1775 pool_reference(p, pool,
MDL);
1781 parse_warn(cfile,
"Pool declaration with no address range.");
1782 log_error(
"Pool declarations must always contain at least");
1790 lease_reference(&lp, lpchain,
MDL);
1791 lease_dereference(&lpchain,
MDL);
1793 lease_reference(&lpchain, lp->
next,
MDL);
1794 lease_dereference(&lp->next,
MDL);
1795 lease_dereference(&lp,
MDL);
1798 pool_dereference(&pool,
MDL);
1805 struct
parse *cfile;
1810 token =
next_token (&val, (
unsigned *)0, cfile);
1823 struct
parse *cfile;
1824 struct group *group;
1830 int declaration = 0;
1833 isc_result_t status;
1840 parse_warn (cfile,
"expecting a name for host declaration.");
1846 status = host_allocate (&host,
MDL);
1847 if (status != ISC_R_SUCCESS)
1848 log_fatal (
"can't allocate host decl struct %s: %s",
1849 name, isc_result_totext (status));
1850 host -> name =
name;
1852 log_fatal (
"can't clone group for host %s", name);
1854 host_dereference (&host,
MDL);
1862 token =
peek_token (&val, (
unsigned *)0, cfile);
1869 parse_warn (cfile,
"unexpected end of file");
1891 if (token ==
GROUP) {
1894 token =
next_token (&val, (
unsigned *)0, cfile);
1897 "expecting string or identifier.");
1903 val, strlen (val),
MDL)) {
1904 parse_warn (cfile,
"unknown group %s in host %s",
1907 if (host -> named_group)
1908 group_object_dereference
1909 (&host -> named_group,
MDL);
1910 group_object_reference (&host -> named_group,
1912 group_object_dereference (&go,
MDL);
1921 unsigned char *t = 0;
1929 "client identifier.",
1935 token =
peek_token (&val, (
unsigned *)0, cfile);
1939 host -> client_identifier.terminated = 1;
1944 (
unsigned char *)0, &len,
':', 16, 8);
1947 "expecting hex list.");
1950 s = (
const char *)t;
1953 (&host -> client_identifier.buffer,
1954 len + host -> client_identifier.terminated,
MDL))
1955 log_fatal (
"no memory for uid for host %s.",
1957 host -> client_identifier.data =
1958 host -> client_identifier.buffer -> data;
1959 host -> client_identifier.len = len;
1960 memcpy (host -> client_identifier.buffer -> data, s,
1961 len + host -> client_identifier.terminated);
1973 "only one host-identifier allowed "
1984 "host-identifier v6relopt "
1985 "must have a number");
1989 host->
relays = atoi(val);
1992 "host-identifier v6relopt "
1993 "must have a number >= 0");
1997 }
else if (token !=
OPTION) {
1999 "host-identifier must be an option"
2007 if ((status != ISC_R_SUCCESS) || (option == NULL)) {
2046 (
unsigned char *)host -> name,
2047 strlen (host -> name),
MDL)) {
2049 host_dereference (&hp,
MDL);
2053 if (host -> group -> statements ||
2054 (host -> group -> authoritative !=
2056 if (host -> group -> next)
2076 if (status != ISC_R_SUCCESS)
2077 parse_warn (cfile,
"host %s: %s", host -> name,
2078 isc_result_totext (status));
2080 host_dereference (&host,
MDL);
2088 struct
parse *cfile;
2089 struct group *group;
2094 struct class *
class = NULL, *pc = NULL;
2095 int declaration = 0;
2102 isc_result_t status = ISC_R_FAILURE;
2103 int matchedonce = 0;
2104 int submatchedonce = 0;
2122 class_reference(&
class, pc,
MDL);
2124 class_dereference(&pc,
MDL);
2139 data.
len = strlen (val);
2142 log_fatal (
"no memory for class name.");
2146 tname = type ?
"implicit-vendor-class" :
"implicit-user-class";
2156 log_fatal (
"No memory for class name %s.", tname);
2171 class_dereference (&pc,
MDL);
2177 memcpy ((
char *)data.
buffer -> data, val,
2180 memset (&data, 0,
sizeof data);
2183 class_dereference (&pc,
MDL);
2187 parse_warn (cfile,
"Expecting string or hex list.");
2189 class_dereference (&pc,
MDL);
2197 class_hash_lookup (&
class, pc -> hash,
2204 status = subclass_allocate (&
class,
MDL);
2206 status = class_allocate (&
class,
MDL);
2210 class_reference (&
class -> superclass, pc,
MDL);
2211 class -> lease_limit = pc -> lease_limit;
2212 if (
class -> lease_limit) {
2213 class -> billed_leases =
2214 dmalloc (
class -> lease_limit *
2216 if (!
class -> billed_leases)
2218 memset (
class -> billed_leases, 0,
2219 (
class -> lease_limit *
2220 sizeof (
struct lease *)));
2225 log_fatal (
"No memory for subclass hash.");
2226 class_hash_add (pc -> hash,
2227 (
const char *)
class -> hash_string.data,
2228 class -> hash_string.len,
2229 (
void *)
class,
MDL);
2234 log_fatal (
"no memory to clone class group.");
2243 log_fatal (
"no memory for class statement.");
2244 stmt -> op = supersede_option_statement;
2247 stmt -> data.option -> data = data;
2251 option_code_hash_lookup(
2256 class -> statements = stmt;
2269 if (
class -> superclass) {
2271 if (token ==
SEMI) {
2275 status = class_reference (cp,
class,
MDL);
2276 class_dereference (&
class,
MDL);
2278 class_dereference (&pc,
MDL);
2279 return cp ? (status == ISC_R_SUCCESS) : 1;
2288 class_dereference (&
class,
MDL);
2290 class_dereference (&pc,
MDL);
2301 parse_warn (cfile,
"unexpected end of file");
2303 }
else if (token ==
DYNAMIC) {
2315 }
else if (token ==
MATCH) {
2318 "invalid match in subclass.");
2329 "one 'match if' clause.");
2340 "expecting boolean expr.");
2344 #if defined (DEBUG_EXPRESSION_PARSE)
2350 }
else if (token ==
SPAWN) {
2354 "invalid spawn in subclass.");
2358 class -> spawning = 1;
2360 if (token !=
WITH) {
2362 "expecting with after spawn");
2367 if (submatchedonce) {
2369 "can't override existing %s.",
2381 "expecting data expr.");
2385 #if defined (DEBUG_EXPRESSION_PARSE)
2391 }
else if (token ==
LEASE) {
2394 if (token !=
LIMIT) {
2407 class -> lease_limit = atoi (val);
2410 class -> billed_leases =
2411 dmalloc (
class -> lease_limit *
2413 if (!
class -> billed_leases)
2414 log_fatal (
"no memory for billed leases.");
2415 memset (
class -> billed_leases, 0,
2416 (
class -> lease_limit *
2417 sizeof (
struct lease *)));
2429 struct class *theclass = NULL;
2432 if (status == ISC_R_SUCCESS) {
2434 class_dereference(&theclass,
MDL);
2437 class_hash_delete(pc->hash,
2449 class_reference (&c ->
nic,
class,
MDL);
2454 status = class_reference (cp,
class,
MDL);
2455 class_dereference (&
class,
MDL);
2457 class_dereference (&pc,
MDL);
2458 return cp ? (status == ISC_R_SUCCESS) : 1;
2465 struct
parse *cfile;
2466 struct group *group;
2472 int declaration = 0;
2473 isc_result_t status;
2476 status = shared_network_allocate (&share,
MDL);
2477 if (status != ISC_R_SUCCESS)
2478 log_fatal (
"Can't allocate shared subnet: %s",
2479 isc_result_totext (status));
2481 log_fatal (
"Can't clone group for shared net");
2487 token =
peek_token (&val, (
unsigned *)0, cfile);
2492 parse_warn (cfile,
"zero-length shared network name");
2493 val =
"<no-name-given>";
2497 log_fatal (
"no memory for shared network name");
2503 "expecting a name for shared-network");
2505 shared_network_dereference (&share,
MDL);
2509 share -> name =
name;
2512 shared_network_dereference (&share,
MDL);
2517 token =
peek_token (&val, (
unsigned *)0, cfile);
2522 "empty shared-network decl");
2525 shared_network_dereference (&share,
MDL);
2529 parse_warn (cfile,
"unexpected end of file");
2533 token =
next_token (&val, (
unsigned *)0, cfile);
2545 shared_network_dereference (&share,
MDL);
2550 common_subnet_parsing(
struct parse *cfile,
2554 struct subnet *t, *u;
2556 int declaration = 0;
2561 subnet_dereference(&subnet,
MDL);
2572 parse_warn (cfile,
"unexpected end of file");
2590 subnet_reference(&share->
subnets, subnet,
MDL);
2602 subnet_dereference(&share->
subnets,
2604 subnet_reference(&share->
subnets,
2607 subnet_dereference(&subnet,
MDL);
2614 subnet_dereference(&subnet,
MDL);
2622 struct
parse *cfile;
2627 struct subnet *subnet;
2629 unsigned char addr [4];
2630 unsigned len =
sizeof addr;
2631 isc_result_t status;
2633 subnet = (
struct subnet *)0;
2634 status = subnet_allocate (&subnet,
MDL);
2635 if (status != ISC_R_SUCCESS)
2636 log_fatal (
"Allocation of new subnet failed: %s",
2637 isc_result_totext (status));
2652 log_fatal(
"Allocation of group for new subnet failed.");
2655 subnet_reference (&subnet -> group -> subnet, subnet,
MDL);
2659 subnet_dereference (&subnet,
MDL);
2662 memcpy (iaddr.
iabuf, addr, len);
2664 subnet ->
net = iaddr;
2666 token =
next_token (&val, (
unsigned *)0, cfile);
2675 subnet_dereference (&subnet,
MDL);
2678 memcpy (iaddr.
iabuf, addr, len);
2688 "subnet %s netmask %s: bad subnet number/mask combination.",
2691 subnet_dereference (&subnet,
MDL);
2696 common_subnet_parsing(cfile, share, subnet);
2704 #if !defined(DHCPv6)
2708 struct subnet *subnet;
2709 isc_result_t status;
2714 const static int mask[] = { 0x00, 0x80, 0xC0, 0xE0,
2715 0xF0, 0xF8, 0xFC, 0xFE };
2719 parse_warn(cfile,
"subnet6 statement is only supported "
2726 status = subnet_allocate(&subnet,
MDL);
2727 if (status != ISC_R_SUCCESS) {
2728 log_fatal(
"Allocation of new subnet failed: %s",
2729 isc_result_totext(status));
2745 log_fatal(
"Allocation of group for new subnet failed.");
2751 subnet_dereference(&subnet,
MDL);
2756 if (token !=
SLASH) {
2773 parse_warn(cfile,
"Expecting a number between 0 and 128.");
2779 parse_warn(cfile,
"New subnet mask too short.");
2789 if (ofs < subnet->netmask.len) {
2792 while (--ofs >= 0) {
2798 if (memcmp(&iaddr, &subnet->
net, 16) != 0) {
2800 "subnet %s/%d: prefix not long enough for address.",
2802 subnet_dereference(&subnet,
MDL);
2807 if (!common_subnet_parsing(cfile, share, subnet)) {
2816 struct
parse *cfile;
2817 struct group *group;
2822 int declaration = 0;
2824 isc_result_t status;
2832 log_fatal(
"no memory for explicit group.");
2840 log_fatal(
"no memory for group decl name %s", val);
2862 }
else if (token ==
DYNAMIC) {
2866 }
else if (token ==
STATIC) {
2881 strlen(name),
MDL)) {
2887 status = group_object_allocate(&t,
MDL);
2888 if (status != ISC_R_SUCCESS)
2889 log_fatal(
"no memory for group decl %s: %s",
2890 val, isc_result_totext(status));
2899 group_object_dereference(&t,
MDL);
2909 struct parse *cfile,
2946 if (token ==
COMMA) {
2949 }
while (token ==
COMMA);
2983 unsigned char addr [4];
2984 unsigned len =
sizeof addr;
2992 int noequal, newbinding;
2995 isc_result_t status;
2999 unsigned buflen = 0;
3000 struct class *
class;
3002 lease = (
struct lease *)0;
3003 status = lease_allocate (&lease,
MDL);
3004 if (status != ISC_R_SUCCESS)
3009 lease_dereference (&lease,
MDL);
3016 lease_dereference (&lease,
MDL);
3021 token =
next_token (&val, (
unsigned *)0, cfile);
3025 parse_warn (cfile,
"unexpected end of file");
3028 strncpy (tbuf, val,
sizeof tbuf);
3029 tbuf [(
sizeof tbuf) - 1] = 0;
3081 token =
peek_token (&val, (
unsigned *)0, cfile);
3083 unsigned char *tuid;
3085 if (buflen < sizeof lease ->
uid_buf) {
3090 tuid = ((
unsigned char *)
3094 lease_dereference (&lease,
3101 memcpy (tuid, val, lease ->
uid_len);
3102 lease ->
uid = tuid;
3106 (cfile, (
unsigned char *)0,
3107 &buflen,
':', 16, 8));
3108 if (!lease ->
uid) {
3109 lease_dereference (&lease,
MDL);
3115 lease ->
uid = (
unsigned char *)0;
3123 if (!lease ->
uid) {
3130 token =
next_token (&val, (
unsigned *)0, cfile);
3134 lease_dereference (&lease,
MDL);
3169 token =
next_token (&val, (
unsigned *)0, cfile);
3175 goto do_binding_state;
3185 goto do_binding_state;
3191 token =
next_token (&val, (
unsigned *)0, cfile);
3192 if (token !=
STATE) {
3197 token =
next_token (&val, (
unsigned *)0, cfile);
3235 "%s: expecting a binding state.",
3241 if (seenbit == 256) {
3250 if (!(seenmask & 128))
3254 if (!(seenmask & 512))
3256 }
else if (seenbit == 128)
3258 else if (seenbit == 512)
3261 log_fatal(
"Impossible condition at %s:%d.",
3269 token =
peek_token (&val, (
unsigned *)0, cfile);
3274 lease_dereference (&lease,
MDL);
3284 "expecting a hostname.");
3286 lease_dereference (&lease,
MDL);
3294 class = (struct class *)0;
3295 token =
next_token (&val, (
unsigned *)0, cfile);
3296 if (token ==
CLASS) {
3298 (
unsigned *)0, cfile);
3306 if (lease -> billing_class)
3307 class_dereference (&lease -> billing_class,
3312 "unknown class %s", val);
3315 if (lease -> billing_class)
3316 class_dereference (&lease -> billing_class,
3326 class_reference (&lease -> billing_class,
3328 class_dereference (&
class,
MDL);
3337 lease_dereference (&lease,
MDL);
3342 on->
data.
on.statements) {
3349 on->
data.
on.statements) {
3367 "agent option expected.");
3374 log_error (
"no memory to stash agent option");
3378 *p; p = &((*p) -> cdr))
3382 &((*p) -> car)), oc,
MDL);
3390 token =
next_token (&val, (
unsigned *)0, cfile);
3393 "%s can't be a variable name",
3397 lease_dereference (&lease,
MDL);
3406 binding = (
struct binding *)0;
3409 if (!lease -> scope)
3411 (&lease -> scope,
MDL)))
3417 memset (binding, 0,
sizeof *binding);
3420 if (!binding -> name)
3423 strcpy (binding -> name, val);
3431 log_fatal(
"no memory for binding value.");
3434 token =
next_token (&val, (
unsigned *)0, cfile);
3435 if (token !=
EQUAL) {
3437 "expecting '=' in set statement.");
3442 if (!parse_binding_value(cfile, nv)) {
3444 lease_dereference(&lease,
MDL);
3465 if (!strcasecmp (val,
"ddns-fwd-name")) {
3469 }
else if (!strcasecmp (val,
"ddns-rev-name")) {
3474 parse_warn(cfile,
"Unexpected configuration "
3478 lease_dereference (&lease,
MDL);
3482 if (seenmask & seenbit) {
3484 "Too many %s parameters in lease %s\n",
3487 seenmask |= seenbit;
3492 if (!(seenmask & 256)) {
3496 #if defined (FAILOVER_PROTOCOL)
3503 #if defined (FAILOVER_PROTOCOL)
3516 if (!(seenmask & 65536))
3519 lease_reference (lp, lease,
MDL);
3520 lease_dereference (&lease,
MDL);
3539 if ((cfile == NULL) || (value == NULL))
3546 value->
type = binding_data;
3559 value->
type = binding_data;
3579 }
else if (token ==
PERCENT) {
3583 parse_warn(cfile,
"expecting decimal number.");
3588 value->
type = binding_numeric;
3590 }
else if (token ==
NAME) {
3592 value->
type = binding_boolean;
3593 if (!strcasecmp(val,
"true"))
3595 else if (!strcasecmp(val,
"false"))
3598 parse_warn(cfile,
"expecting true or false");
3604 parse_warn (cfile,
"expecting a constant value.");
3617 struct
parse *cfile;
3618 struct group *group;
3620 struct
pool *inpool;
3621 struct
lease **lpchain;
3623 struct iaddr low, high, net;
3624 unsigned char addr [4];
3625 unsigned len =
sizeof addr;
3629 struct subnet *subnet;
3632 isc_result_t status;
3643 memcpy (low.
iabuf, addr, len);
3647 token =
peek_token (&val, (
unsigned *)0, cfile);
3654 memcpy (high.
iabuf, addr, len);
3658 token =
next_token (&val, (
unsigned *)0, cfile);
3659 if (token !=
SEMI) {
3666 subnet = group -> subnet;
3670 for (subnet = share ->
subnets;
3671 subnet; subnet = subnet -> next_sibling) {
3673 if (
addr_eq (net, subnet -> net))
3677 parse_warn (cfile,
"address range not on network %s",
3679 log_error (
"Be sure to place pool statement after %s",
3680 "related subnet declarations.");
3686 struct pool *last = (
struct pool *)0;
3691 for (pool = share ->
pools; pool; pool = pool ->
next) {
3696 permit_dynamic_bootp_clients)) ||
3701 permit_all_clients))) {
3710 status = pool_allocate (&pool,
MDL);
3711 if (status != ISC_R_SUCCESS)
3712 log_fatal (
"no memory for ad-hoc pool: %s",
3713 isc_result_totext (status));
3716 log_fatal (
"no memory for ad-hoc permit.");
3722 pool -> permit_list = p;
3725 pool -> prohibit_list = p;
3729 pool_reference (&last ->
next, pool,
MDL);
3731 pool_reference (&share ->
pools, pool,
MDL);
3735 log_fatal (
"no memory for anon pool group.");
3737 pool = (
struct pool *)0;
3739 pool_reference (&pool, last,
MDL);
3741 pool_reference (&pool, share ->
pools,
MDL);
3744 pool = (
struct pool *)0;
3745 pool_reference (&pool, inpool,
MDL);
3748 #if defined (FAILOVER_PROTOCOL)
3752 parse_warn (cfile,
"dynamic-bootp flag is %s",
3753 "not permitted for address");
3754 log_error (
"range declarations where there is a failover");
3755 log_error (
"peer in scope. If you wish to declare an");
3756 log_error (
"address range from which dynamic bootp leases");
3757 log_error (
"can be allocated, please declare it within a");
3758 log_error (
"pool declaration that also contains the \"no");
3759 log_error (
"failover\" statement. The failover protocol");
3760 log_error (
"itself does not permit dynamic bootp - this");
3761 log_error (
"is not a limitation specific to the ISC DHCP");
3762 log_error (
"server. Please don't ask me to defend this");
3763 log_error (
"until you have read and really tried %s",
3765 log_error (
"the failover protocol specification.");
3775 pool_dereference (&pool,
MDL);
3780 add_ipv6_pool_to_subnet(
struct subnet *subnet, u_int16_t type,
3781 struct iaddr *lo_addr,
int bits,
int units,
3784 struct in6_addr tmp_in6_addr;
3791 if (lo_addr->
len !=
sizeof(tmp_in6_addr)) {
3792 log_fatal(
"Internal error: Attempt to add non-IPv6 address "
3793 "to IPv6 shared network.");
3795 memcpy(&tmp_in6_addr, lo_addr->
iabuf,
sizeof(tmp_in6_addr));
3798 bits, units,
MDL) != ISC_R_SUCCESS) {
3813 subnet_reference(&pool->
subnet, subnet,
MDL);
3827 while (pond->
ipv6_pools[num_pools] != NULL) {
3835 if (num_pools > 0) {
3837 sizeof(
struct ipv6_pool *) * num_pools);
3865 if ((units - bits) > (
sizeof(isc_uint64_t) * 8)) {
3870 isc_uint64_t space_left
3873 = (isc_uint64_t)(1) << (units -
bits);
3875 if (addon > space_left) {
3912 add_ipv6_pond_to_network(
struct group *group,
3915 struct ipv6_pond *pond = NULL, *last = NULL;
3917 isc_result_t status;
3934 if (status != ISC_R_SUCCESS)
3935 log_fatal (
"no memory for ad-hoc ipv6 pond: %s",
3936 isc_result_totext (status));
3939 log_fatal (
"no memory for ad-hoc ipv6 permit.");
3942 p->
type = permit_all_clients;
3955 log_fatal (
"no memory for anon pool group.");
3968 struct group *group,
3970 struct iaddr lo, hi;
3980 parse_warn(cfile,
"range6 statement is only supported "
3987 if (group->
subnet == NULL)
4000 parse_warn(cfile,
"range6 start address is outside the subnet");
4008 memset(&net, 0,
sizeof(net));
4015 if (token ==
SLASH) {
4028 if ((bits < 0) || (bits > 128)) {
4029 parse_warn(cfile,
"networks have 0 to 128 bits");
4035 "network mask smaller than subnet mask");
4050 parse_warn(cfile,
"temporary mask too short");
4088 "range6 end address is outside the subnet");
4097 if (
range2cidr(&nets, &lo, &hi) != ISC_R_SUCCESS) {
4098 log_fatal(
"Error converting range to CIDR networks");
4109 if (inpond != NULL) {
4112 add_ipv6_pond_to_network(group, &pond);
4116 for (p=nets; p != NULL; p=p->
next) {
4117 add_ipv6_pool_to_subnet(group->
subnet, type,
4129 if (token !=
SEMI) {
4140 struct group *group,
4142 struct iaddr lo, hi;
4151 parse_warn(cfile,
"prefix6 statement is only supported "
4158 if (group->
subnet == NULL)
4172 " is outside the subnet");
4185 " is outside the subnet");
4194 if (token !=
SLASH) {
4208 if ((bits <= 0) || (bits >= 128)) {
4209 parse_warn(cfile,
"networks have 0 to 128 bits (exclusive)");
4213 parse_warn(cfile,
"network mask smaller than subnet mask");
4224 if (token !=
SEMI) {
4234 if (
range2cidr(&nets, &lo, &hi) != ISC_R_SUCCESS) {
4235 log_fatal(
"Error converting prefix to CIDR");
4244 if (inpond != NULL) {
4247 add_ipv6_pond_to_network(group, &pond);
4250 for (p = nets; p != NULL; p = p->
next) {
4283 while (*h != NULL) {
4303 if (token !=
SLASH) {
4319 if (token !=
SEMI) {
4332 parse_warn(cfile,
"networks have 0 to 128 bits");
4368 struct
parse *cfile;
4369 struct group *group;
4376 int declaration = 0;
4377 isc_result_t status;
4381 if (status != ISC_R_SUCCESS)
4383 isc_result_totext (status));
4390 parse_warn(cfile,
"pool6s are only valid inside "
4391 "subnet statements.");
4464 for (; *p; p = &((*p)->next))
4471 parse_warn (cfile,
"Pool6 declaration with no %s.",
4472 "address range6 or prefix6");
4473 log_error (
"Pool6 declarations must always contain at least");
4474 log_error (
"one range6 or prefix6 statement.");
4492 struct
parse *cfile;
4497 unsigned char rf = flag;
4506 token =
next_token (&val, (
unsigned *)0, cfile);
4541 parse_warn (cfile,
"expecting allow/deny key");
4549 log_fatal(
"Unable to find server option %u (%s:%d).",
4559 #if !defined(DHCPv6)
4566 struct ia_xx *old_ia;
4576 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
4577 isc_boolean_t newbinding;
4585 parse_warn(cfile,
"IA_NA is only supported in DHCPv6 mode.");
4593 "expecting an iaid+ia_na string");
4599 "iaid+ia_na string too short");
4604 memcpy(&iaid, val, 4);
4606 if (
ia_allocate(&ia, iaid, val+4, len-4,
MDL) != ISC_R_SUCCESS) {
4613 parse_warn(cfile,
"corrupt lease file; expecting left brace");
4620 if (token ==
RBRACE)
break;
4622 if (token ==
CLTT) {
4629 "expecting IAADDR or right brace");
4636 "expecting IPv6 address");
4644 "expecting left brace");
4654 if (token ==
RBRACE)
break;
4660 if (token !=
STATE) {
4694 if (token !=
SEMI) {
4711 prefer = atoi (val);
4720 if (token ==
SEMI) {
4724 "corrupt lease file; "
4725 "expecting semicolon.");
4748 if (token ==
SEMI) {
4752 "corrupt lease file; "
4753 "expecting semicolon.");
4765 if ((token !=
NAME) &&
4797 if (bnd->
name == NULL) {
4801 strcpy(bnd->
name, val);
4803 newbinding = ISC_TRUE;
4805 newbinding = ISC_FALSE;
4814 if (token !=
EQUAL) {
4820 if (!parse_binding_value(cfile, nv)) {
4852 if (on_star[0] == NULL) {
4880 "expecting ia_na contents, "
4889 "missing state in iaaddr");
4892 if (end_time == -1) {
4894 "missing end time in iaaddr");
4899 if (iasubopt_allocate(&iaaddr,
MDL) != ISC_R_SUCCESS) {
4904 iaaddr->
state = state;
4906 iaaddr->
valid = valid;
4910 if (scope != NULL) {
4922 (i < 2) && on_star[i] != NULL ;
4924 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
4925 on_star[i]->
data.
on.statements) {
4930 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
4931 on_star[i]->
data.
on.statements) {
4942 &iaaddr->
addr) != ISC_R_SUCCESS) {
4943 inet_ntop(AF_INET6, &iaaddr->
addr,
4944 addr_buf,
sizeof(addr_buf));
4945 parse_warn(cfile,
"no pool found for address %s",
4952 iaaddr, ia) != ISC_R_SUCCESS) {
4953 inet_ntop(AF_INET6, &iaaddr->
addr,
4954 addr_buf,
sizeof(addr_buf));
4955 parse_warn(cfile,
"duplicate na lease for address %s",
5001 #if !defined(DHCPv6)
5008 struct ia_xx *old_ia;
5018 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5019 isc_boolean_t newbinding;
5027 parse_warn(cfile,
"IA_TA is only supported in DHCPv6 mode.");
5035 "expecting an iaid+ia_ta string");
5041 "iaid+ia_ta string too short");
5046 memcpy(&iaid, val, 4);
5048 if (
ia_allocate(&ia, iaid, val+4, len-4,
MDL) != ISC_R_SUCCESS) {
5055 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5062 if (token ==
RBRACE)
break;
5064 if (token ==
CLTT) {
5071 "expecting IAADDR or right brace");
5078 "expecting IPv6 address");
5086 "expecting left brace");
5096 if (token ==
RBRACE)
break;
5102 if (token !=
STATE) {
5136 if (token !=
SEMI) {
5153 prefer = atoi (val);
5162 if (token ==
SEMI) {
5166 "corrupt lease file; "
5167 "expecting semicolon.");
5190 if (token ==
SEMI) {
5194 "corrupt lease file; "
5195 "expecting semicolon.");
5207 if ((token !=
NAME) &&
5239 if (bnd->
name == NULL) {
5243 strcpy(bnd->
name, val);
5245 newbinding = ISC_TRUE;
5247 newbinding = ISC_FALSE;
5256 if (token !=
EQUAL) {
5262 if (!parse_binding_value(cfile, nv)) {
5294 if (on_star[0] == NULL) {
5322 "expecting ia_ta contents, "
5331 "missing state in iaaddr");
5334 if (end_time == -1) {
5336 "missing end time in iaaddr");
5341 if (iasubopt_allocate(&iaaddr,
MDL) != ISC_R_SUCCESS) {
5346 iaaddr->
state = state;
5348 iaaddr->
valid = valid;
5352 if (scope != NULL) {
5364 (i < 2) && on_star[i] != NULL ;
5366 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5367 on_star[i]->
data.
on.statements) {
5372 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5373 on_star[i]->
data.
on.statements) {
5384 &iaaddr->
addr) != ISC_R_SUCCESS) {
5385 inet_ntop(AF_INET6, &iaaddr->
addr,
5386 addr_buf,
sizeof(addr_buf));
5387 parse_warn(cfile,
"no pool found for address %s",
5394 iaaddr, ia) != ISC_R_SUCCESS) {
5395 inet_ntop(AF_INET6, &iaaddr->
addr,
5396 addr_buf,
sizeof(addr_buf));
5397 parse_warn(cfile,
"duplicate ta lease for address %s",
5443 #if !defined(DHCPv6)
5450 struct ia_xx *old_ia;
5461 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5462 isc_boolean_t newbinding;
5470 parse_warn(cfile,
"IA_PD is only supported in DHCPv6 mode.");
5478 "expecting an iaid+ia_pd string");
5484 "iaid+ia_pd string too short");
5489 memcpy(&iaid, val, 4);
5491 if (
ia_allocate(&ia, iaid, val+4, len-4,
MDL) != ISC_R_SUCCESS) {
5498 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5505 if (token ==
RBRACE)
break;
5507 if (token ==
CLTT) {
5513 parse_warn(cfile,
"corrupt lease file; expecting "
5514 "IAPREFIX or right brace");
5521 "expecting IPv6 prefix");
5529 "expecting left brace");
5539 if (token ==
RBRACE)
break;
5545 if (token !=
STATE) {
5579 if (token !=
SEMI) {
5596 prefer = atoi (val);
5605 if (token ==
SEMI) {
5609 "corrupt lease file; "
5610 "expecting semicolon.");
5633 if (token ==
SEMI) {
5637 "corrupt lease file; "
5638 "expecting semicolon.");
5650 if ((token !=
NAME) &&
5682 if (bnd->
name == NULL) {
5686 strcpy(bnd->
name, val);
5688 newbinding = ISC_TRUE;
5690 newbinding = ISC_FALSE;
5699 if (token !=
EQUAL) {
5705 if (!parse_binding_value(cfile, nv)) {
5737 if (on_star[0] == NULL) {
5765 "expecting ia_pd contents, "
5774 "missing state in iaprefix");
5777 if (end_time == -1) {
5779 "missing end time in iaprefix");
5784 if (iasubopt_allocate(&iapref,
MDL) != ISC_R_SUCCESS) {
5788 iapref->
plen = plen;
5789 iapref->
state = state;
5791 iapref->
valid = valid;
5795 if (scope != NULL) {
5807 (i < 2) && on_star[i] != NULL ;
5809 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5810 on_star[i]->
data.
on.statements) {
5815 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5816 on_star[i]->
data.
on.statements) {
5827 &iapref->
addr) != ISC_R_SUCCESS) {
5828 inet_ntop(AF_INET6, &iapref->
addr,
5829 addr_buf,
sizeof(addr_buf));
5830 parse_warn(cfile,
"no pool found for address %s",
5837 iapref, ia) != ISC_R_SUCCESS) {
5838 inet_ntop(AF_INET6, &iapref->
addr,
5839 addr_buf,
sizeof(addr_buf));
5840 parse_warn(cfile,
"duplicate pd lease for address %s",
5902 parse_warn(cfile,
"corrupt lease file; expecting a DUID");
5907 memset(&duid, 0,
sizeof(duid));
5910 log_fatal(
"Out of memory storing DUID");
5912 duid.data = (
unsigned char *)duid.buffer->data;
5913 memcpy(duid.buffer->data, val, len);
5920 if (token !=
SEMI) {
5921 parse_warn(cfile,
"corrupt lease file; expecting a semicolon");
5943 u_int32_t enterprise_number;
5970 parse_warn(cfile,
"enterprise number expected");
5974 enterprise_number = atoi(val);
5986 memset(&duid, 0,
sizeof(duid));
5987 duid.len = 2 + 4 +
len;
5989 log_fatal(
"Out of memory storing DUID");
5991 duid.data = (
unsigned char *)duid.buffer->data;
5993 putULong(duid.buffer->data + 2, enterprise_number);
5994 memcpy(duid.buffer->data + 6, val, len);
6007 else if (token ==
LL) {
6030 memset(&ll_addr, 0,
sizeof(ll_addr));
6038 memset(&duid, 0,
sizeof(duid));
6039 duid.len = 2 + 2 + ll_addr.len;
6041 log_fatal(
"Out of memory storing DUID");
6043 duid.data = (
unsigned char *)duid.buffer->data;
6045 putUShort(duid.buffer->data + 2, ll_type);
6046 memcpy(duid.buffer->data + 4,
6047 ll_addr.data, ll_addr.len);
6062 else if (token ==
LLT) {
6092 llt_time = atoi(val);
6094 memset(&ll_addr, 0,
sizeof(ll_addr));
6102 memset(&duid, 0,
sizeof(duid));
6103 duid.len = 2 + 2 + 4 + ll_addr.len;
6105 log_fatal(
"Out of memory storing DUID");
6107 duid.data = (
unsigned char *)duid.buffer->data;
6109 putUShort(duid.buffer->data + 2, ll_type);
6110 putULong(duid.buffer->data + 4, llt_time);
6111 memcpy(duid.buffer->data + 8,
6112 ll_addr.data, ll_addr.len);
6129 else if (token ==
NUMBER) {
6130 duid_type_num = atoi(val);
6142 memset(&duid, 0,
sizeof(duid));
6145 log_fatal(
"Out of memory storing DUID");
6147 duid.data = (
unsigned char *)duid.buffer->data;
6148 putUShort(duid.buffer->data, duid_type_num);
6149 memcpy(duid.buffer->data + 2, val, len);
6159 parse_warn(cfile,
"DUID type of LLT, EN, or LL expected");
6168 if (token !=
SEMI) {
struct iaddrcidrnet cidrnet
#define GROUP_OBJECT_DYNAMIC
void parse_option_space_decl(struct parse *cfile)
int executable_statement_reference(struct executable_statement **ptr, struct executable_statement *bp, const char *file, int line)
int executable_statement_allocate(struct executable_statement **ptr, const char *file, int line)
int parse_lease_declaration(struct lease **lp, struct parse *cfile)
void parse_server_duid_conf(struct parse *cfile)
isc_result_t parse_option_name(struct parse *cfile, int allocate, int *known, struct option **opt)
void parse_trace_setup(void)
void trace_conf_input(trace_type_t *, unsigned, char *)
int parse_option_code_definition(struct parse *cfile, struct option *option)
isc_result_t read_conf_file(const char *filename, struct group *group, int group_type, int leasep)
struct universe * universe
int binding_value_dereference(struct binding_value **v, const char *file, int line)
isc_result_t delete_group(struct group_object *group, int writep)
isc_result_t add_lease6(struct ipv6_pool *pool, struct iasubopt *lease, time_t valid_lifetime_end_time)
int executable_statement_dereference(struct executable_statement **ptr, const char *file, int line)
const char * piaddr(const struct iaddr addr)
#define CLASS_TYPE_VENDOR
void parse_fixed_prefix6(struct parse *cfile, struct host_decl *host_decl)
struct permit * new_permit(const char *, int)
isc_result_t end_parse(struct parse **cfile)
int parse_statement(struct parse *cfile, struct group *group, int type, struct host_decl *host_decl, int declaration)
int permit_list_match(struct permit *lhs, struct permit *rhs)
void * dmalloc(unsigned, const char *, int)
char * piaddrmask(struct iaddr *addr, struct iaddr *mask)
isc_result_t ia_dereference(struct ia_xx **ia, const char *file, int line)
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
void parse_pool6_statement(struct parse *, struct group *, int)
struct universe server_universe
struct iaddr ip_addr(struct iaddr subnet, struct iaddr mask, u_int32_t host_address)
int parse_data_expression(struct expression **expr, struct parse *cfile, int *lose)
struct ipv6_pond * ipv6_pond
int binding_value_reference(struct binding_value **ptr, struct binding_value *src, const char *file, int line)
#define HOST_DECL_DYNAMIC
#define CLASS_DECL_DELETED
enum executable_statement::statement_op op
void db_startup(int, uid_t, gid_t)
struct executable_statement * on_release
int option_reference(struct option **dest, struct option *src, const char *file, int line)
void print_expression(char *name, struct expression *expr) const
struct universe dhcp_universe
int group_reference(struct group **ptr, struct group *bp, const char *file, int line)
void data_string_forget(struct data_string *data, const char *file, int line)
struct shared_network * shared_network
isc_result_t ipv6_pond_reference(struct ipv6_pond **pond, struct ipv6_pond *src, const char *file, int line)
reference an IPv6 pond structure.
int option_cache_reference(struct option_cache **ptr, struct option_cache *src, const char *file, int line)
struct option_cache * fixed_addr
struct group * root_group
enum binding_value::@15 type
struct data_string hash_string
const char * path_dhcpd_db
int log_error(const char *,...) __attribute__((__format__(__printf__
struct collection * collections
trace_type_t * trace_type_register(const char *, void *, void(*)(trace_type_t *, unsigned, char *), void(*)(trace_type_t *), const char *, int)
int binding_scope_dereference(struct binding_scope **ptr, const char *file, int line)
void free_permit(struct permit *, const char *, int)
struct binding_scope * scope
dhcp_failover_state_t * failover_peer
int parse_semi(struct parse *cfile)
struct ipv6_pond * ipv6_pond
struct executable_statement * next
dhcp_failover_state_t * failover_peer
int parse_fixed_addr_param(struct option_cache **oc, struct parse *cfile, enum dhcp_token type)
enum dhcp_token peek_token(const char **rval, unsigned *rlen, struct parse *cfile)
isc_result_t lease_file_subparse(struct parse *cfile)
struct data_string client_identifier
struct permit * prohibit_list
int parse_string(struct parse *cfile, char **sptr, unsigned *lptr)
void parse_failover_state_declaration(struct parse *, dhcp_failover_state_t *)
void expression_dereference(struct expression **eptr, const char *file, int line)
#define DHO_DHCP_SERVER_IDENTIFIER
void log_fatal(const char *,...) __attribute__((__format__(__printf__
void get_permit(struct parse *cfile, struct permit **permit_head, int is_allow, TIME *valid_from, TIME *valid_until)
Parse allow and deny statements.
void parse_ia_ta_declaration(struct parse *cfile)
int binding_value_allocate(struct binding_value **cptr, const char *file, int line)
struct executable_statement * statements
int parse_cshl(struct data_string *data, struct parse *cfile)
void parse_group_declaration(struct parse *cfile, struct group *group)
int option_cache_allocate(struct option_cache **cptr, const char *file, int line)
union expression::expr_union data
#define CLASS_DECL_DYNAMIC
struct hardware hardware_addr
struct iaddr subnet_number(struct iaddr addr, struct iaddr mask)
void postdb_startup(void)
isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *start_addr, int bits, int units, const char *file, int line)
Create a new IPv6 lease pool structure.
enum dhcp_token next_token(const char **rval, unsigned *rlen, struct parse *cfile)
int subnet_inner_than(const struct subnet *, const struct subnet *, int)
time_t hard_lifetime_end_time
struct permit * prohibit_list
host_hash_t * host_name_hash
void parse_ia_na_declaration(struct parse *cfile)
#define CLASS_TYPE_SUBCLASS
isc_result_t delete_host(struct host_decl *, int)
void enter_shared_network(struct shared_network *)
isc_result_t cleanup_lease6(ia_hash_t *ia_table, struct ipv6_pool *pool, struct iasubopt *lease, struct ia_xx *ia)
Cleans up leases when reading from a lease file.
binding_state_t binding_state
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
struct option_cache * option
void postconf_initialization(int)
int binding_scope_allocate(struct binding_scope **ptr, const char *file, int line)
void putULong(unsigned char *, u_int32_t)
int group_dereference(struct group **ptr, const char *file, int line)
#define skip_token(a, b, c)
void enter_lease(struct lease *)
int parse_boolean_expression(struct expression **expr, struct parse *cfile, int *lose)
struct iaddrcidrnetlist * next
option_name_hash_t * name_hash
unsigned char * parse_numeric_aggregate(struct parse *cfile, unsigned char *buf, unsigned *max, int separator, int base, unsigned size)
struct data_string iaid_duid
isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result)
int parse_lbrace(struct parse *cfile)
void parse_subnet6_declaration(struct parse *cfile, struct shared_network *share)
int make_concat(struct expression **expr, struct expression *left, struct expression *right)
TIME parse_date(struct parse *cfile)
struct expression * submatch
void dfree(void *, const char *, int)
void set_server_duid(struct data_string *new_duid)
isc_result_t add_ipv6_pool(struct ipv6_pool *pool)
int parse_ip6_addr(struct parse *cfile, struct iaddr *addr)
struct data_string host_id
int parse_ip_addr_or_hostname(struct expression **expr, struct parse *cfile, int uniform)
void set_server_duid_type(int type)
int parse_option_decl(struct option_cache **oc, struct parse *cfile)
isc_result_t conf_file_subparse(struct parse *cfile, struct group *group, int group_type)
struct ipv6_pool ** ipv6_pools
void skip_to_semi(struct parse *cfile)
int option_cache(struct option_cache **oc, struct data_string *dp, struct expression *expr, struct option *option, const char *file, int line)
void skip_to_rbrace(struct parse *cfile, int brace_count)
void new_address_range(struct parse *, struct iaddr, struct iaddr, struct subnet *, struct pool *, struct lease **)
isc_result_t find_failover_peer(dhcp_failover_state_t **, const char *, const char *, int)
int parse_on_statement(struct executable_statement **result, struct parse *cfile, int *lose)
struct shared_network * shared_network
isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool, const char *file, int line)
de-reference an IPv6 pool structure.
isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *addr)
int addr_eq(struct iaddr addr1, struct iaddr addr2)
struct executable_statement::@7::@9 on
char * parse_host_name(struct parse *cfile)
int parse_option_statement(struct executable_statement **result, struct parse *cfile, int lookups, struct option *option, enum statement_op op)
isc_result_t delete_class(struct class *, int)
isc_result_t enter_failover_peer(dhcp_failover_state_t *)
union executable_statement::@7 data
void parse_shared_net_declaration(struct parse *cfile, struct group *group)
int parse_option_data(struct expression **expr, struct parse *cfile, int lookups, struct option *option)
union binding_value::value value
struct shared_network * shared_network
struct lease ** billed_leases
const char * path_dhcpd_conf
struct data_string const_data
u_int32_t host_addr(struct iaddr addr, struct iaddr mask)
void parse_address_range(struct parse *cfile, struct group *group, int type, struct pool *inpool, struct lease **lpchain)
int parse_ip6_addr_expr(struct expression **expr, struct parse *cfile)
struct iaddrcidrnetlist * fixed_prefix
struct group_object * named_group
struct binding * bindings
isc_result_t ipv6_pond_allocate(struct ipv6_pond **pond, const char *file, int line)
Create a new IPv6 pond structure.
isc_boolean_t is_cidr_mask_valid(const struct iaddr *addr, int bits)
int binding_scope_reference(struct binding_scope **ptr, struct binding_scope *bp, const char *file, int line)
binding_state_t rewind_binding_state
void parse_failover_state(struct parse *, enum failover_state *, TIME *)
void parse_host_declaration(struct parse *cfile, struct group *group)
int make_const_data(struct expression **expr, const unsigned char *data, unsigned len, int terminated, int allocate, const char *file, int line)
void parse_subnet_declaration(struct parse *cfile, struct shared_network *share)
void parse_failover_peer(struct parse *, struct group *, int)
void parse_address_range6(struct parse *cfile, struct group *group, struct ipv6_pond *)
#define SV_BOOT_UNKNOWN_CLIENTS
TIME parse_date_core(struct parse *cfile)
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt, const char *file, int line)
struct binding_value * value
isc_result_t supersede_group(struct group_object *group, int writep)
isc_result_t find_class(struct class **c, const char *s, const char *file, int line)
void parse_prefix6(struct parse *cfile, struct group *group, struct ipv6_pond *)
struct option * host_id_option
isc_result_t ia_allocate(struct ia_xx **ia, u_int32_t iaid, const char *duid, unsigned int duid_len, const char *file, int line)
int option_chain_head_allocate(struct option_chain_head **ptr, const char *file, int line)
int parse_ip6_prefix(struct parse *cfile, struct iaddr *addr, u_int8_t *plen)
isc_result_t trace_get_file(trace_type_t *, const char *, unsigned *, char **)
struct subnet * next_sibling
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
struct interface_info * interface
isc_result_t trace_write_packet(trace_type_t *, unsigned, const char *, const char *, int)
isc_result_t ipv6_pond_dereference(struct ipv6_pond **pond, const char *file, int line)
de-reference an IPv6 pond structure.
void enter_subnet(struct subnet *)
isc_result_t enter_host(struct host_decl *, int, int)
void parse_ia_pd_declaration(struct parse *cfile)
group_hash_t * group_name_hash
struct executable_statement * statements
#define DHO_VENDOR_CLASS_IDENTIFIER
struct universe agent_universe
struct ipv6_pool ** pools
char * piaddrcidr(const struct iaddr *addr, unsigned int bits)
option_code_hash_t * code_hash
void parse_server_duid(struct parse *cfile)
pair cons(caddr_t car, pair cdr)
struct executable_statement * on_expiry
struct binding * find_binding(struct binding_scope *scope, const char *name)
struct shared_network * shared_network
int parse_class_declaration(struct class **cp, struct parse *cfile, struct group *group, int type)
void new_shared_network_interface(struct parse *, struct shared_network *, const char *)
struct permit * permit_list
void putUShort(unsigned char *, u_int32_t)
isc_result_t range2cidr(struct iaddrcidrnetlist **result, const struct iaddr *lo, const struct iaddr *hi)
struct shared_network * shared_network
void trace_conf_stop(trace_type_t *ttype)
int parse_allow_deny(struct option_cache **oc, struct parse *cfile, int flag)
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, const char *file, int line)
const unsigned char * data
struct binding_scope * scope
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
isc_result_t ipv6_pool_reference(struct ipv6_pool **pool, struct ipv6_pool *src, const char *file, int line)
reference an IPv6 pool structure.
struct hardware interface
struct permit * permit_list
int parse_executable_statement(struct executable_statement **result, struct parse *cfile, int *lose, enum expression_context case_context)
void parse_hardware_param(struct parse *cfile, struct hardware *hardware)
int clone_group(struct group **gp, struct group *group, const char *file, int line)
int parse_warn(struct parse *cfile, const char *fmt,...)
binding_state_t next_binding_state
struct interface_info * interface
isc_result_t new_parse(struct parse **cfile, int file, char *inbuf, unsigned buflen, const char *name, int eolp)
void parse_pool_statement(struct parse *cfile, struct group *group, int type)
Parse a pool statement.
#define GROUP_OBJECT_STATIC
int option_dereference(struct option **dest, const char *file, int line)
#define SV_CLIENT_UPDATES