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,
"pool declared within pool.");
668 parse_warn (cfile,
"pool 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);
915 parse_warn (cfile,
"failover peer reference not %s",
916 "in shared-network declaration");
919 parse_warn (cfile,
"reference to unknown%s%s",
920 " failover peer ", name);
923 dhcp_failover_state_reference
927 dhcp_failover_state_dereference (&peer,
MDL);
929 }
else if (token ==
STATE) {
931 parse_warn (cfile,
"state declaration for unknown%s%s",
932 " failover peer ", name);
936 dhcp_failover_state_dereference (&peer,
MDL);
938 }
else if (token !=
LBRACE) {
945 parse_warn (cfile,
"redeclaration of failover peer %s", name);
947 dhcp_failover_state_dereference (&peer,
MDL);
951 status = dhcp_failover_state_allocate (&peer,
MDL);
952 if (status != ISC_R_SUCCESS)
953 log_fatal (
"Can't allocate failover peer %s: %s",
954 name, isc_result_totext (status));
962 token =
next_token (&val, (
unsigned *)0, cfile);
968 peer -> i_am = primary;
972 peer -> i_am = secondary;
975 "secondary may not define %s",
976 "load balance settings.");
980 cp = &peer -> partner;
987 dhcp_failover_state_dereference (&peer,
MDL);
997 token =
next_token (&val, (
unsigned *)0, cfile);
1002 cp -> port = atoi (val);
1006 tp = &peer->max_lease_misbalance;
1010 tp = &peer->max_lease_ownership;
1014 tp = &peer->max_balance;
1018 tp = &peer->min_balance;
1022 tp = &peer->auto_partner_down;
1026 tp = &cp -> max_response_delay;
1028 token =
next_token (&val, (
unsigned *)0, cfile);
1032 dhcp_failover_state_dereference (&peer,
MDL);
1039 tp = &cp -> max_flying_updates;
1048 if (peer -> i_am == secondary)
1050 "secondary may not define %s",
1051 "load balance settings.");
1055 dhcp_failover_state_dereference (&peer,
MDL);
1058 if (hba_len != 32) {
1060 "HBA must be exactly 32 bytes.");
1069 memcpy (peer -> hba, hba, 32);
1073 token =
next_token (&val, (
unsigned *)0, cfile);
1074 if (peer -> i_am == secondary)
1076 "secondary may not define %s",
1077 "load balance settings.");
1081 dhcp_failover_state_dereference (&peer,
MDL);
1088 memset (hba, 0,
sizeof hba);
1089 for (i = 0; i < split; i++) {
1091 hba [i / 8] |= (1 << (i & 7));
1098 token =
next_token (&val, (
unsigned *)0, cfile);
1105 token =
next_token (&val, (
unsigned *)0, cfile);
1110 token =
next_token (&val, (
unsigned *)0, cfile);
1115 token =
next_token (&val, (
unsigned *)0, cfile);
1120 peer -> load_balance_max_secs = atoi (val);
1125 "invalid statement in peer declaration");
1127 dhcp_failover_state_dereference (&peer,
MDL);
1132 dhcp_failover_state_dereference (&peer,
MDL);
1135 }
while (token !=
RBRACE);
1140 if (!peer -> partner.address)
1141 parse_warn (cfile,
"peer address may not be omitted");
1144 peer->me.port = DEFAULT_FAILOVER_PORT;
1145 if (!peer->partner.port)
1146 peer->partner.port = DEFAULT_FAILOVER_PORT;
1148 if (peer -> i_am == primary) {
1151 "primary failover server must have hba or split.");
1152 }
else if (!peer -> mclt) {
1154 "primary failover server must have mclt.");
1158 if (!peer->max_lease_misbalance)
1159 peer->max_lease_misbalance = DEFAULT_MAX_LEASE_MISBALANCE;
1160 if (!peer->max_lease_ownership)
1161 peer->max_lease_ownership = DEFAULT_MAX_LEASE_OWNERSHIP;
1162 if (!peer->max_balance)
1163 peer->max_balance = DEFAULT_MAX_BALANCE_TIME;
1164 if (!peer->min_balance)
1165 peer->min_balance = DEFAULT_MIN_BALANCE_TIME;
1166 if (!peer->me.max_flying_updates)
1167 peer->me.max_flying_updates = DEFAULT_MAX_FLYING_UPDATES;
1168 if (!peer->me.max_response_delay)
1169 peer->me.max_response_delay = DEFAULT_MAX_RESPONSE_DELAY;
1175 if (peer -> i_am == primary) {
1188 if (status != ISC_R_SUCCESS)
1190 peer -> name, isc_result_totext (status));
1191 dhcp_failover_state_dereference (&peer,
MDL);
1195 dhcp_failover_state_t *peer)
1200 dhcp_failover_state_t *state;
1201 dhcp_failover_config_t *cp;
1204 token =
next_token (&val, (
unsigned *)0, cfile);
1205 if (token !=
PEER) {
1211 token =
next_token (&val, (
unsigned *)0, cfile);
1215 log_fatal (
"failover peer name %s: no memory",
1219 parse_warn (cfile,
"expecting failover peer name.");
1225 state = (dhcp_failover_state_t *)0;
1228 parse_warn (cfile,
"unknown failover peer: %s", name);
1233 token =
next_token (&val, (
unsigned *)0, cfile);
1234 if (token !=
STATE) {
1241 state = (dhcp_failover_state_t *)0;
1242 dhcp_failover_state_reference (&state, peer,
MDL);
1244 token =
next_token (&val, (
unsigned *)0, cfile);
1249 dhcp_failover_state_dereference (&state,
MDL);
1253 token =
next_token (&val, (
unsigned *)0, cfile);
1260 token =
next_token (&val, (
unsigned *)0, cfile);
1261 if (token !=
STATE) {
1266 &cp -> state, &cp -> stos);
1270 cp = &state -> partner;
1274 if (state -> i_am == primary) {
1276 "mclt not valid for primary");
1279 token =
next_token (&val, (
unsigned *)0, cfile);
1284 state -> mclt = atoi (val);
1289 parse_warn (cfile,
"expecting state setting.");
1292 dhcp_failover_state_dereference (&state,
MDL);
1295 }
while (token !=
RBRACE);
1296 dhcp_failover_state_dereference (&state,
MDL);
1300 struct
parse *cfile;
1309 token =
next_token (&val, (
unsigned *)0, cfile);
1364 parse_warn (cfile,
"unknown failover state");
1369 token =
next_token (&val, (
unsigned *)0, cfile);
1370 if (token ==
SEMI) {
1424 void get_permit(cfile, permit_head, is_allow, valid_from, valid_until)
1425 struct
parse *cfile;
1426 struct
permit **permit_head;
1428 TIME *valid_from, *valid_until;
1433 int need_clients = 1;
1498 permit->
class = NULL;
1506 if (*valid_from || *valid_until) {
1507 parse_warn(cfile,
"duplicate \"after\" clause.");
1523 parse_warn (cfile,
"expecting permit type.");
1533 if ((need_clients != 0) &&
1541 while (*permit_head)
1542 permit_head = &((*permit_head)->next);
1543 *permit_head = permit;
1556 struct permit *plp, *prp;
1563 for (plp = lhs; plp; plp = plp ->
next) {
1565 for (prp = rhs; prp; prp = prp ->
next) {
1566 if (prp -> type == plp -> type &&
1568 prp ->
class == plp ->
class)) {
1599 struct
parse *cfile;
1600 struct group *group;
1607 int declaration = 0;
1608 isc_result_t status;
1609 struct lease *lpchain = NULL, *lp;
1612 status = pool_allocate(&pool,
MDL);
1613 if (status != ISC_R_SUCCESS)
1615 isc_result_totext (status));
1625 parse_warn(cfile,
"Dynamic pools are only valid inside "
1626 "subnet or shared-network statements.");
1635 #if defined (FAILOVER_PROTOCOL)
1638 dhcp_failover_state_reference
1644 pool_dereference(&pool,
MDL);
1657 "expecting \"failover peer\".");
1661 #if defined (FAILOVER_PROTOCOL)
1663 dhcp_failover_state_dereference
1668 #if defined (FAILOVER_PROTOCOL)
1672 if (token !=
PEER) {
1684 dhcp_failover_state_dereference
1688 if (status != ISC_R_SUCCESS)
1690 "failover peer %s: %s", val,
1691 isc_result_totext (status));
1741 #if defined (FAILOVER_PROTOCOL)
1757 for (lp = lpchain; lp; lp = lp->
next) {
1758 pool_dereference(&lp->pool,
MDL);
1759 pool_reference(&lp->pool, pp,
MDL);
1768 for (; *p; p = &((*p)->next))
1770 pool_reference(p, pool,
MDL);
1776 parse_warn(cfile,
"Pool declaration with no address range.");
1777 log_error(
"Pool declarations must always contain at least");
1785 lease_reference(&lp, lpchain,
MDL);
1786 lease_dereference(&lpchain,
MDL);
1788 lease_reference(&lpchain, lp->
next,
MDL);
1789 lease_dereference(&lp->next,
MDL);
1790 lease_dereference(&lp,
MDL);
1793 pool_dereference(&pool,
MDL);
1800 struct
parse *cfile;
1805 token =
next_token (&val, (
unsigned *)0, cfile);
1818 struct
parse *cfile;
1819 struct group *group;
1825 int declaration = 0;
1828 isc_result_t status;
1835 parse_warn (cfile,
"expecting a name for host declaration.");
1841 status = host_allocate (&host,
MDL);
1842 if (status != ISC_R_SUCCESS)
1843 log_fatal (
"can't allocate host decl struct %s: %s",
1844 name, isc_result_totext (status));
1845 host -> name =
name;
1847 log_fatal (
"can't clone group for host %s", name);
1849 host_dereference (&host,
MDL);
1857 token =
peek_token (&val, (
unsigned *)0, cfile);
1864 parse_warn (cfile,
"unexpected end of file");
1886 if (token ==
GROUP) {
1889 token =
next_token (&val, (
unsigned *)0, cfile);
1892 "expecting string or identifier.");
1898 val, strlen (val),
MDL)) {
1899 parse_warn (cfile,
"unknown group %s in host %s",
1902 if (host -> named_group)
1903 group_object_dereference
1904 (&host -> named_group,
MDL);
1905 group_object_reference (&host -> named_group,
1907 group_object_dereference (&go,
MDL);
1916 unsigned char *t = 0;
1924 "client identifier.",
1930 token =
peek_token (&val, (
unsigned *)0, cfile);
1934 host -> client_identifier.terminated = 1;
1939 (
unsigned char *)0, &len,
':', 16, 8);
1942 "expecting hex list.");
1945 s = (
const char *)t;
1948 (&host -> client_identifier.buffer,
1949 len + host -> client_identifier.terminated,
MDL))
1950 log_fatal (
"no memory for uid for host %s.",
1952 host -> client_identifier.data =
1953 host -> client_identifier.buffer -> data;
1954 host -> client_identifier.len = len;
1955 memcpy (host -> client_identifier.buffer -> data, s,
1956 len + host -> client_identifier.terminated);
1968 "only one host-identifier allowed "
1979 "host-identifier v6relopt "
1980 "must have a number");
1984 host->
relays = atoi(val);
1987 "host-identifier v6relopt "
1988 "must have a number >= 0");
1992 }
else if (token !=
OPTION) {
1994 "host-identifier must be an option"
2002 if ((status != ISC_R_SUCCESS) || (option == NULL)) {
2041 (
unsigned char *)host -> name,
2042 strlen (host -> name),
MDL)) {
2044 host_dereference (&hp,
MDL);
2048 if (host -> group -> statements ||
2049 (host -> group -> authoritative !=
2051 if (host -> group -> next)
2071 if (status != ISC_R_SUCCESS)
2072 parse_warn (cfile,
"host %s: %s", host -> name,
2073 isc_result_totext (status));
2075 host_dereference (&host,
MDL);
2083 struct
parse *cfile;
2084 struct group *group;
2089 struct class *
class = NULL, *pc = NULL;
2090 int declaration = 0;
2097 isc_result_t status = ISC_R_FAILURE;
2098 int matchedonce = 0;
2099 int submatchedonce = 0;
2117 class_reference(&
class, pc,
MDL);
2119 class_dereference(&pc,
MDL);
2134 data.
len = strlen (val);
2137 log_fatal (
"no memory for class name.");
2141 tname = type ?
"implicit-vendor-class" :
"implicit-user-class";
2151 log_fatal (
"No memory for class name %s.", tname);
2166 class_dereference (&pc,
MDL);
2172 memcpy ((
char *)data.
buffer -> data, val,
2175 memset (&data, 0,
sizeof data);
2178 class_dereference (&pc,
MDL);
2182 parse_warn (cfile,
"Expecting string or hex list.");
2184 class_dereference (&pc,
MDL);
2192 class_hash_lookup (&
class, pc -> hash,
2199 status = subclass_allocate (&
class,
MDL);
2201 status = class_allocate (&
class,
MDL);
2205 class_reference (&
class -> superclass, pc,
MDL);
2206 class -> lease_limit = pc -> lease_limit;
2207 if (
class -> lease_limit) {
2208 class -> billed_leases =
2209 dmalloc (
class -> lease_limit *
2211 if (!
class -> billed_leases)
2213 memset (
class -> billed_leases, 0,
2214 (
class -> lease_limit *
2215 sizeof (
struct lease *)));
2220 log_fatal (
"No memory for subclass hash.");
2221 class_hash_add (pc -> hash,
2222 (
const char *)
class -> hash_string.data,
2223 class -> hash_string.len,
2224 (
void *)
class,
MDL);
2229 log_fatal (
"no memory to clone class group.");
2238 log_fatal (
"no memory for class statement.");
2239 stmt -> op = supersede_option_statement;
2242 stmt -> data.option -> data = data;
2246 option_code_hash_lookup(
2251 class -> statements = stmt;
2264 if (
class -> superclass) {
2266 if (token ==
SEMI) {
2270 status = class_reference (cp,
class,
MDL);
2271 class_dereference (&
class,
MDL);
2273 class_dereference (&pc,
MDL);
2274 return cp ? (status == ISC_R_SUCCESS) : 1;
2283 class_dereference (&
class,
MDL);
2285 class_dereference (&pc,
MDL);
2296 parse_warn (cfile,
"unexpected end of file");
2298 }
else if (token ==
DYNAMIC) {
2310 }
else if (token ==
MATCH) {
2313 "invalid match in subclass.");
2324 "one 'match if' clause.");
2335 "expecting boolean expr.");
2339 #if defined (DEBUG_EXPRESSION_PARSE)
2345 }
else if (token ==
SPAWN) {
2349 "invalid spawn in subclass.");
2353 class -> spawning = 1;
2355 if (token !=
WITH) {
2357 "expecting with after spawn");
2362 if (submatchedonce) {
2364 "can't override existing %s.",
2376 "expecting data expr.");
2380 #if defined (DEBUG_EXPRESSION_PARSE)
2386 }
else if (token ==
LEASE) {
2389 if (token !=
LIMIT) {
2402 class -> lease_limit = atoi (val);
2405 class -> billed_leases =
2406 dmalloc (
class -> lease_limit *
2408 if (!
class -> billed_leases)
2409 log_fatal (
"no memory for billed leases.");
2410 memset (
class -> billed_leases, 0,
2411 (
class -> lease_limit *
2412 sizeof (
struct lease *)));
2424 struct class *theclass = NULL;
2427 if (status == ISC_R_SUCCESS) {
2429 class_dereference(&theclass,
MDL);
2432 class_hash_delete(pc->hash,
2444 class_reference (&c ->
nic,
class,
MDL);
2449 status = class_reference (cp,
class,
MDL);
2450 class_dereference (&
class,
MDL);
2452 class_dereference (&pc,
MDL);
2453 return cp ? (status == ISC_R_SUCCESS) : 1;
2460 struct
parse *cfile;
2461 struct group *group;
2467 int declaration = 0;
2468 isc_result_t status;
2471 status = shared_network_allocate (&share,
MDL);
2472 if (status != ISC_R_SUCCESS)
2473 log_fatal (
"Can't allocate shared subnet: %s",
2474 isc_result_totext (status));
2476 log_fatal (
"Can't clone group for shared net");
2482 token =
peek_token (&val, (
unsigned *)0, cfile);
2487 parse_warn (cfile,
"zero-length shared network name");
2488 val =
"<no-name-given>";
2492 log_fatal (
"no memory for shared network name");
2498 "expecting a name for shared-network");
2500 shared_network_dereference (&share,
MDL);
2504 share -> name =
name;
2507 shared_network_dereference (&share,
MDL);
2512 token =
peek_token (&val, (
unsigned *)0, cfile);
2517 "empty shared-network decl");
2520 shared_network_dereference (&share,
MDL);
2524 parse_warn (cfile,
"unexpected end of file");
2528 token =
next_token (&val, (
unsigned *)0, cfile);
2540 shared_network_dereference (&share,
MDL);
2545 common_subnet_parsing(
struct parse *cfile,
2549 struct subnet *t, *u;
2551 int declaration = 0;
2556 subnet_dereference(&subnet,
MDL);
2567 parse_warn (cfile,
"unexpected end of file");
2585 subnet_reference(&share->
subnets, subnet,
MDL);
2597 subnet_dereference(&share->
subnets,
2599 subnet_reference(&share->
subnets,
2602 subnet_dereference(&subnet,
MDL);
2609 subnet_dereference(&subnet,
MDL);
2617 struct
parse *cfile;
2622 struct subnet *subnet;
2624 unsigned char addr [4];
2625 unsigned len =
sizeof addr;
2626 isc_result_t status;
2628 subnet = (
struct subnet *)0;
2629 status = subnet_allocate (&subnet,
MDL);
2630 if (status != ISC_R_SUCCESS)
2631 log_fatal (
"Allocation of new subnet failed: %s",
2632 isc_result_totext (status));
2647 log_fatal(
"Allocation of group for new subnet failed.");
2650 subnet_reference (&subnet -> group -> subnet, subnet,
MDL);
2654 subnet_dereference (&subnet,
MDL);
2657 memcpy (iaddr.
iabuf, addr, len);
2659 subnet ->
net = iaddr;
2661 token =
next_token (&val, (
unsigned *)0, cfile);
2670 subnet_dereference (&subnet,
MDL);
2673 memcpy (iaddr.
iabuf, addr, len);
2683 "subnet %s netmask %s: bad subnet number/mask combination.",
2686 subnet_dereference (&subnet,
MDL);
2691 common_subnet_parsing(cfile, share, subnet);
2699 #if !defined(DHCPv6)
2703 struct subnet *subnet;
2704 isc_result_t status;
2709 const static int mask[] = { 0x00, 0x80, 0xC0, 0xE0,
2710 0xF0, 0xF8, 0xFC, 0xFE };
2714 parse_warn(cfile,
"subnet6 statement is only supported "
2721 status = subnet_allocate(&subnet,
MDL);
2722 if (status != ISC_R_SUCCESS) {
2723 log_fatal(
"Allocation of new subnet failed: %s",
2724 isc_result_totext(status));
2740 log_fatal(
"Allocation of group for new subnet failed.");
2746 subnet_dereference(&subnet,
MDL);
2751 if (token !=
SLASH) {
2768 parse_warn(cfile,
"Expecting a number between 0 and 128.");
2774 parse_warn(cfile,
"New subnet mask too short.");
2784 if (ofs < subnet->netmask.len) {
2787 while (--ofs >= 0) {
2793 if (memcmp(&iaddr, &subnet->
net, 16) != 0) {
2795 "subnet %s/%d: prefix not long enough for address.",
2797 subnet_dereference(&subnet,
MDL);
2802 if (!common_subnet_parsing(cfile, share, subnet)) {
2811 struct
parse *cfile;
2812 struct group *group;
2817 int declaration = 0;
2819 isc_result_t status;
2827 log_fatal(
"no memory for explicit group.");
2835 log_fatal(
"no memory for group decl name %s", val);
2857 }
else if (token ==
DYNAMIC) {
2861 }
else if (token ==
STATIC) {
2876 strlen(name),
MDL)) {
2882 status = group_object_allocate(&t,
MDL);
2883 if (status != ISC_R_SUCCESS)
2884 log_fatal(
"no memory for group decl %s: %s",
2885 val, isc_result_totext(status));
2894 group_object_dereference(&t,
MDL);
2904 struct parse *cfile,
2941 if (token ==
COMMA) {
2944 }
while (token ==
COMMA);
2978 unsigned char addr [4];
2979 unsigned len =
sizeof addr;
2987 int noequal, newbinding;
2990 isc_result_t status;
2994 unsigned buflen = 0;
2995 struct class *
class;
2997 lease = (
struct lease *)0;
2998 status = lease_allocate (&lease,
MDL);
2999 if (status != ISC_R_SUCCESS)
3004 lease_dereference (&lease,
MDL);
3011 lease_dereference (&lease,
MDL);
3016 token =
next_token (&val, (
unsigned *)0, cfile);
3020 parse_warn (cfile,
"unexpected end of file");
3023 strncpy (tbuf, val,
sizeof tbuf);
3024 tbuf [(
sizeof tbuf) - 1] = 0;
3076 token =
peek_token (&val, (
unsigned *)0, cfile);
3078 unsigned char *tuid;
3080 if (buflen < sizeof lease ->
uid_buf) {
3085 tuid = ((
unsigned char *)
3089 lease_dereference (&lease,
3096 memcpy (tuid, val, lease ->
uid_len);
3097 lease ->
uid = tuid;
3101 (cfile, (
unsigned char *)0,
3102 &buflen,
':', 16, 8));
3103 if (!lease ->
uid) {
3104 lease_dereference (&lease,
MDL);
3110 lease ->
uid = (
unsigned char *)0;
3118 if (!lease ->
uid) {
3125 token =
next_token (&val, (
unsigned *)0, cfile);
3129 lease_dereference (&lease,
MDL);
3164 token =
next_token (&val, (
unsigned *)0, cfile);
3170 goto do_binding_state;
3180 goto do_binding_state;
3186 token =
next_token (&val, (
unsigned *)0, cfile);
3187 if (token !=
STATE) {
3192 token =
next_token (&val, (
unsigned *)0, cfile);
3230 "%s: expecting a binding state.",
3236 if (seenbit == 256) {
3245 if (!(seenmask & 128))
3249 if (!(seenmask & 512))
3251 }
else if (seenbit == 128)
3253 else if (seenbit == 512)
3256 log_fatal(
"Impossible condition at %s:%d.",
3264 token =
peek_token (&val, (
unsigned *)0, cfile);
3269 lease_dereference (&lease,
MDL);
3279 "expecting a hostname.");
3281 lease_dereference (&lease,
MDL);
3289 class = (struct class *)0;
3290 token =
next_token (&val, (
unsigned *)0, cfile);
3291 if (token ==
CLASS) {
3293 (
unsigned *)0, cfile);
3301 if (lease -> billing_class)
3302 class_dereference (&lease -> billing_class,
3307 "unknown class %s", val);
3310 if (lease -> billing_class)
3311 class_dereference (&lease -> billing_class,
3321 class_reference (&lease -> billing_class,
3323 class_dereference (&
class,
MDL);
3332 lease_dereference (&lease,
MDL);
3337 on->
data.
on.statements) {
3344 on->
data.
on.statements) {
3362 "agent option expected.");
3369 log_error (
"no memory to stash agent option");
3373 *p; p = &((*p) -> cdr))
3377 &((*p) -> car)), oc,
MDL);
3385 token =
next_token (&val, (
unsigned *)0, cfile);
3388 "%s can't be a variable name",
3392 lease_dereference (&lease,
MDL);
3401 binding = (
struct binding *)0;
3404 if (!lease -> scope)
3406 (&lease -> scope,
MDL)))
3412 memset (binding, 0,
sizeof *binding);
3415 if (!binding -> name)
3418 strcpy (binding -> name, val);
3426 log_fatal(
"no memory for binding value.");
3429 token =
next_token (&val, (
unsigned *)0, cfile);
3430 if (token !=
EQUAL) {
3432 "expecting '=' in set statement.");
3437 if (!parse_binding_value(cfile, nv)) {
3439 lease_dereference(&lease,
MDL);
3460 if (!strcasecmp (val,
"ddns-fwd-name")) {
3464 }
else if (!strcasecmp (val,
"ddns-rev-name")) {
3469 parse_warn(cfile,
"Unexpected configuration "
3473 lease_dereference (&lease,
MDL);
3477 if (seenmask & seenbit) {
3479 "Too many %s parameters in lease %s\n",
3482 seenmask |= seenbit;
3487 if (!(seenmask & 256)) {
3491 #if defined (FAILOVER_PROTOCOL)
3498 #if defined (FAILOVER_PROTOCOL)
3511 if (!(seenmask & 65536))
3514 lease_reference (lp, lease,
MDL);
3515 lease_dereference (&lease,
MDL);
3534 if ((cfile == NULL) || (value == NULL))
3541 value->
type = binding_data;
3554 value->
type = binding_data;
3574 }
else if (token ==
PERCENT) {
3578 parse_warn(cfile,
"expecting decimal number.");
3583 value->
type = binding_numeric;
3585 }
else if (token ==
NAME) {
3587 value->
type = binding_boolean;
3588 if (!strcasecmp(val,
"true"))
3590 else if (!strcasecmp(val,
"false"))
3593 parse_warn(cfile,
"expecting true or false");
3599 parse_warn (cfile,
"expecting a constant value.");
3612 struct
parse *cfile;
3613 struct group *group;
3615 struct
pool *inpool;
3616 struct
lease **lpchain;
3618 struct iaddr low, high, net;
3619 unsigned char addr [4];
3620 unsigned len =
sizeof addr;
3624 struct subnet *subnet;
3627 isc_result_t status;
3638 memcpy (low.
iabuf, addr, len);
3642 token =
peek_token (&val, (
unsigned *)0, cfile);
3649 memcpy (high.
iabuf, addr, len);
3653 token =
next_token (&val, (
unsigned *)0, cfile);
3654 if (token !=
SEMI) {
3661 subnet = group -> subnet;
3665 for (subnet = share ->
subnets;
3666 subnet; subnet = subnet -> next_sibling) {
3668 if (
addr_eq (net, subnet -> net))
3672 parse_warn (cfile,
"address range not on network %s",
3674 log_error (
"Be sure to place pool statement after %s",
3675 "related subnet declarations.");
3681 struct pool *last = (
struct pool *)0;
3686 for (pool = share ->
pools; pool; pool = pool ->
next) {
3691 permit_dynamic_bootp_clients)) ||
3696 permit_all_clients))) {
3705 status = pool_allocate (&pool,
MDL);
3706 if (status != ISC_R_SUCCESS)
3707 log_fatal (
"no memory for ad-hoc pool: %s",
3708 isc_result_totext (status));
3711 log_fatal (
"no memory for ad-hoc permit.");
3717 pool -> permit_list = p;
3720 pool -> prohibit_list = p;
3724 pool_reference (&last ->
next, pool,
MDL);
3726 pool_reference (&share ->
pools, pool,
MDL);
3730 log_fatal (
"no memory for anon pool group.");
3732 pool = (
struct pool *)0;
3734 pool_reference (&pool, last,
MDL);
3736 pool_reference (&pool, share ->
pools,
MDL);
3739 pool = (
struct pool *)0;
3740 pool_reference (&pool, inpool,
MDL);
3743 #if defined (FAILOVER_PROTOCOL)
3747 parse_warn (cfile,
"dynamic-bootp flag is %s",
3748 "not permitted for address");
3749 log_error (
"range declarations where there is a failover");
3750 log_error (
"peer in scope. If you wish to declare an");
3751 log_error (
"address range from which dynamic bootp leases");
3752 log_error (
"can be allocated, please declare it within a");
3753 log_error (
"pool declaration that also contains the \"no");
3754 log_error (
"failover\" statement. The failover protocol");
3755 log_error (
"itself does not permit dynamic bootp - this");
3756 log_error (
"is not a limitation specific to the ISC DHCP");
3757 log_error (
"server. Please don't ask me to defend this");
3758 log_error (
"until you have read and really tried %s",
3760 log_error (
"the failover protocol specification.");
3770 pool_dereference (&pool,
MDL);
3775 add_ipv6_pool_to_subnet(
struct subnet *subnet, u_int16_t type,
3776 struct iaddr *lo_addr,
int bits,
int units,
3779 struct in6_addr tmp_in6_addr;
3786 if (lo_addr->
len !=
sizeof(tmp_in6_addr)) {
3787 log_fatal(
"Internal error: Attempt to add non-IPv6 address "
3788 "to IPv6 shared network.");
3790 memcpy(&tmp_in6_addr, lo_addr->
iabuf,
sizeof(tmp_in6_addr));
3793 bits, units,
MDL) != ISC_R_SUCCESS) {
3808 subnet_reference(&pool->
subnet, subnet,
MDL);
3822 while (pond->
ipv6_pools[num_pools] != NULL) {
3830 if (num_pools > 0) {
3832 sizeof(
struct ipv6_pool *) * num_pools);
3879 add_ipv6_pond_to_network(
struct group *group,
3882 struct ipv6_pond *pond = NULL, *last = NULL;
3884 isc_result_t status;
3901 if (status != ISC_R_SUCCESS)
3902 log_fatal (
"no memory for ad-hoc ipv6 pond: %s",
3903 isc_result_totext (status));
3906 log_fatal (
"no memory for ad-hoc ipv6 permit.");
3909 p->
type = permit_all_clients;
3922 log_fatal (
"no memory for anon pool group.");
3929 check_addr_in_subnet(
struct subnet *subnet,
struct iaddr *addr) {
3930 char lowbuf [INET6_ADDRSTRLEN], netbuf [INET6_ADDRSTRLEN];
3933 strncpy(lowbuf,
piaddr(*addr), INET6_ADDRSTRLEN);
3934 strncpy(netbuf,
piaddr(subnet->
net), INET6_ADDRSTRLEN);
3935 log_fatal(
"bad range6, address %s not in subnet6 %s/%d",
3947 struct group *group,
3949 struct iaddr lo, hi;
3959 parse_warn(cfile,
"range6 statement is only supported "
3966 if (group->
subnet == NULL)
3979 memset(&net, 0,
sizeof(net));
3982 check_addr_in_subnet(group->
subnet, &lo);
3988 if (token ==
SLASH) {
4001 if ((bits < 0) || (bits > 128)) {
4002 parse_warn(cfile,
"networks have 0 to 128 bits");
4019 parse_warn(cfile,
"temporary mask too short");
4053 check_addr_in_subnet(group->
subnet, &hi);
4059 if (
range2cidr(&nets, &lo, &hi) != ISC_R_SUCCESS) {
4060 log_fatal(
"Error converting range to CIDR networks");
4071 if (inpond != NULL) {
4074 add_ipv6_pond_to_network(group, &pond);
4078 for (p=nets; p != NULL; p=p->
next) {
4079 add_ipv6_pool_to_subnet(group->
subnet, type,
4091 if (token !=
SEMI) {
4102 struct group *group,
4104 struct iaddr lo, hi;
4113 parse_warn(cfile,
"prefix6 statement is only supported "
4120 if (group->
subnet == NULL)
4137 if (token !=
SLASH) {
4151 if ((bits <= 0) || (bits >= 128)) {
4152 parse_warn(cfile,
"networks have 0 to 128 bits (exclusive)");
4161 if (token !=
SEMI) {
4171 if (
range2cidr(&nets, &lo, &hi) != ISC_R_SUCCESS) {
4172 log_fatal(
"Error converting prefix to CIDR");
4181 if (inpond != NULL) {
4184 add_ipv6_pond_to_network(group, &pond);
4187 for (p = nets; p != NULL; p = p->
next) {
4220 while (*h != NULL) {
4240 if (token !=
SLASH) {
4256 if (token !=
SEMI) {
4269 parse_warn(cfile,
"networks have 0 to 128 bits");
4305 struct
parse *cfile;
4306 struct group *group;
4313 int declaration = 0;
4314 isc_result_t status;
4318 if (status != ISC_R_SUCCESS)
4320 isc_result_totext (status));
4327 parse_warn(cfile,
"Dynamic pool6s are only valid inside "
4328 "subnet statements.");
4400 for (; *p; p = &((*p)->next))
4407 parse_warn (cfile,
"Pool6 declaration with no %s.",
4408 "address range6 or prefix6");
4409 log_error (
"Pool6 declarations must always contain at least");
4410 log_error (
"one range6 or prefix6 statement.");
4428 struct
parse *cfile;
4433 unsigned char rf = flag;
4442 token =
next_token (&val, (
unsigned *)0, cfile);
4477 parse_warn (cfile,
"expecting allow/deny key");
4484 log_fatal(
"Unable to find server option %u (%s:%d).",
4494 #if !defined(DHCPv6)
4501 struct ia_xx *old_ia;
4511 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
4512 isc_boolean_t newbinding;
4520 parse_warn(cfile,
"IA_NA is only supported in DHCPv6 mode.");
4528 "expecting an iaid+ia_na string");
4534 "iaid+ia_na string too short");
4539 memcpy(&iaid, val, 4);
4541 if (
ia_allocate(&ia, iaid, val+4, len-4,
MDL) != ISC_R_SUCCESS) {
4548 parse_warn(cfile,
"corrupt lease file; expecting left brace");
4555 if (token ==
RBRACE)
break;
4557 if (token ==
CLTT) {
4564 "expecting IAADDR or right brace");
4571 "expecting IPv6 address");
4579 "expecting left brace");
4589 if (token ==
RBRACE)
break;
4595 if (token !=
STATE) {
4629 if (token !=
SEMI) {
4646 prefer = atoi (val);
4655 if (token ==
SEMI) {
4659 "corrupt lease file; "
4660 "expecting semicolon.");
4683 if (token ==
SEMI) {
4687 "corrupt lease file; "
4688 "expecting semicolon.");
4700 if ((token !=
NAME) &&
4732 if (bnd->
name == NULL) {
4736 strcpy(bnd->
name, val);
4738 newbinding = ISC_TRUE;
4740 newbinding = ISC_FALSE;
4749 if (token !=
EQUAL) {
4755 if (!parse_binding_value(cfile, nv)) {
4787 if (on_star[0] == NULL) {
4815 "expecting ia_na contents, "
4824 "missing state in iaaddr");
4827 if (end_time == -1) {
4829 "missing end time in iaaddr");
4834 if (iasubopt_allocate(&iaaddr,
MDL) != ISC_R_SUCCESS) {
4839 iaaddr->
state = state;
4841 iaaddr->
valid = valid;
4845 if (scope != NULL) {
4857 (i < 2) && on_star[i] != NULL ;
4859 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
4860 on_star[i]->
data.
on.statements) {
4865 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
4866 on_star[i]->
data.
on.statements) {
4877 &iaaddr->
addr) != ISC_R_SUCCESS) {
4878 inet_ntop(AF_INET6, &iaaddr->
addr,
4879 addr_buf,
sizeof(addr_buf));
4880 parse_warn(cfile,
"no pool found for address %s",
4887 iaaddr, ia) != ISC_R_SUCCESS) {
4888 inet_ntop(AF_INET6, &iaaddr->
addr,
4889 addr_buf,
sizeof(addr_buf));
4890 parse_warn(cfile,
"duplicate na lease for address %s",
4936 #if !defined(DHCPv6)
4943 struct ia_xx *old_ia;
4953 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
4954 isc_boolean_t newbinding;
4962 parse_warn(cfile,
"IA_TA is only supported in DHCPv6 mode.");
4970 "expecting an iaid+ia_ta string");
4976 "iaid+ia_ta string too short");
4981 memcpy(&iaid, val, 4);
4983 if (
ia_allocate(&ia, iaid, val+4, len-4,
MDL) != ISC_R_SUCCESS) {
4990 parse_warn(cfile,
"corrupt lease file; expecting left brace");
4997 if (token ==
RBRACE)
break;
4999 if (token ==
CLTT) {
5006 "expecting IAADDR or right brace");
5013 "expecting IPv6 address");
5021 "expecting left brace");
5031 if (token ==
RBRACE)
break;
5037 if (token !=
STATE) {
5071 if (token !=
SEMI) {
5088 prefer = atoi (val);
5097 if (token ==
SEMI) {
5101 "corrupt lease file; "
5102 "expecting semicolon.");
5125 if (token ==
SEMI) {
5129 "corrupt lease file; "
5130 "expecting semicolon.");
5142 if ((token !=
NAME) &&
5174 if (bnd->
name == NULL) {
5178 strcpy(bnd->
name, val);
5180 newbinding = ISC_TRUE;
5182 newbinding = ISC_FALSE;
5191 if (token !=
EQUAL) {
5197 if (!parse_binding_value(cfile, nv)) {
5229 if (on_star[0] == NULL) {
5257 "expecting ia_ta contents, "
5266 "missing state in iaaddr");
5269 if (end_time == -1) {
5271 "missing end time in iaaddr");
5276 if (iasubopt_allocate(&iaaddr,
MDL) != ISC_R_SUCCESS) {
5281 iaaddr->
state = state;
5283 iaaddr->
valid = valid;
5287 if (scope != NULL) {
5299 (i < 2) && on_star[i] != NULL ;
5301 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5302 on_star[i]->
data.
on.statements) {
5307 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5308 on_star[i]->
data.
on.statements) {
5319 &iaaddr->
addr) != ISC_R_SUCCESS) {
5320 inet_ntop(AF_INET6, &iaaddr->
addr,
5321 addr_buf,
sizeof(addr_buf));
5322 parse_warn(cfile,
"no pool found for address %s",
5329 iaaddr, ia) != ISC_R_SUCCESS) {
5330 inet_ntop(AF_INET6, &iaaddr->
addr,
5331 addr_buf,
sizeof(addr_buf));
5332 parse_warn(cfile,
"duplicate ta lease for address %s",
5378 #if !defined(DHCPv6)
5385 struct ia_xx *old_ia;
5396 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5397 isc_boolean_t newbinding;
5405 parse_warn(cfile,
"IA_PD is only supported in DHCPv6 mode.");
5413 "expecting an iaid+ia_pd string");
5419 "iaid+ia_pd string too short");
5424 memcpy(&iaid, val, 4);
5426 if (
ia_allocate(&ia, iaid, val+4, len-4,
MDL) != ISC_R_SUCCESS) {
5433 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5440 if (token ==
RBRACE)
break;
5442 if (token ==
CLTT) {
5448 parse_warn(cfile,
"corrupt lease file; expecting "
5449 "IAPREFIX or right brace");
5456 "expecting IPv6 prefix");
5464 "expecting left brace");
5474 if (token ==
RBRACE)
break;
5480 if (token !=
STATE) {
5514 if (token !=
SEMI) {
5531 prefer = atoi (val);
5540 if (token ==
SEMI) {
5544 "corrupt lease file; "
5545 "expecting semicolon.");
5568 if (token ==
SEMI) {
5572 "corrupt lease file; "
5573 "expecting semicolon.");
5585 if ((token !=
NAME) &&
5617 if (bnd->
name == NULL) {
5621 strcpy(bnd->
name, val);
5623 newbinding = ISC_TRUE;
5625 newbinding = ISC_FALSE;
5634 if (token !=
EQUAL) {
5640 if (!parse_binding_value(cfile, nv)) {
5672 if (on_star[0] == NULL) {
5700 "expecting ia_pd contents, "
5709 "missing state in iaprefix");
5712 if (end_time == -1) {
5714 "missing end time in iaprefix");
5719 if (iasubopt_allocate(&iapref,
MDL) != ISC_R_SUCCESS) {
5723 iapref->
plen = plen;
5724 iapref->
state = state;
5726 iapref->
valid = valid;
5730 if (scope != NULL) {
5742 (i < 2) && on_star[i] != NULL ;
5744 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5745 on_star[i]->
data.
on.statements) {
5750 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5751 on_star[i]->
data.
on.statements) {
5762 &iapref->
addr) != ISC_R_SUCCESS) {
5763 inet_ntop(AF_INET6, &iapref->
addr,
5764 addr_buf,
sizeof(addr_buf));
5765 parse_warn(cfile,
"no pool found for address %s",
5772 iapref, ia) != ISC_R_SUCCESS) {
5773 inet_ntop(AF_INET6, &iapref->
addr,
5774 addr_buf,
sizeof(addr_buf));
5775 parse_warn(cfile,
"duplicate pd lease for address %s",
5837 parse_warn(cfile,
"corrupt lease file; expecting a DUID");
5842 memset(&duid, 0,
sizeof(duid));
5845 log_fatal(
"Out of memory storing DUID");
5847 duid.data = (
unsigned char *)duid.buffer->data;
5848 memcpy(duid.buffer->data, val, len);
5855 if (token !=
SEMI) {
5856 parse_warn(cfile,
"corrupt lease file; expecting a semicolon");
5878 u_int32_t enterprise_number;
5905 parse_warn(cfile,
"enterprise number expected");
5909 enterprise_number = atoi(val);
5921 memset(&duid, 0,
sizeof(duid));
5922 duid.len = 2 + 4 +
len;
5924 log_fatal(
"Out of memory storing DUID");
5926 duid.data = (
unsigned char *)duid.buffer->data;
5928 putULong(duid.buffer->data + 2, enterprise_number);
5929 memcpy(duid.buffer->data + 6, val, len);
5942 else if (token ==
LL) {
5965 memset(&ll_addr, 0,
sizeof(ll_addr));
5973 memset(&duid, 0,
sizeof(duid));
5974 duid.len = 2 + 2 + ll_addr.len;
5976 log_fatal(
"Out of memory storing DUID");
5978 duid.data = (
unsigned char *)duid.buffer->data;
5980 putUShort(duid.buffer->data + 2, ll_type);
5981 memcpy(duid.buffer->data + 4,
5982 ll_addr.data, ll_addr.len);
5997 else if (token ==
LLT) {
6027 llt_time = atoi(val);
6029 memset(&ll_addr, 0,
sizeof(ll_addr));
6037 memset(&duid, 0,
sizeof(duid));
6038 duid.len = 2 + 2 + 4 + ll_addr.len;
6040 log_fatal(
"Out of memory storing DUID");
6042 duid.data = (
unsigned char *)duid.buffer->data;
6044 putUShort(duid.buffer->data + 2, ll_type);
6045 putULong(duid.buffer->data + 4, llt_time);
6046 memcpy(duid.buffer->data + 8,
6047 ll_addr.data, ll_addr.len);
6064 else if (token ==
NUMBER) {
6065 duid_type_num = atoi(val);
6077 memset(&duid, 0,
sizeof(duid));
6080 log_fatal(
"Out of memory storing DUID");
6082 duid.data = (
unsigned char *)duid.buffer->data;
6083 putUShort(duid.buffer->data, duid_type_num);
6084 memcpy(duid.buffer->data + 2, val, len);
6094 parse_warn(cfile,
"DUID type of LLT, EN, or LL expected");
6103 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