33 static unsigned char global_host_once = 1;
35 static int parse_binding_value(
struct parse *
cfile,
38 static void parse_authoring_byte_order (
struct parse *
cfile);
39 static void parse_lease_id_format (
struct parse *
cfile);
42 u_int32_t *iaid,
const char*
file,
int line);
69 #if defined(LDAP_CONFIGURATION)
73 return ldap_read_config ();
80 int group_type,
int leasep)
93 ttype = trace_readleases_type;
95 ttype = trace_readconf_type;
114 tflen = strlen (dbuf);
115 ulen = ulen - tflen - 1;
116 fbuf = dbuf + tflen + 1;
121 if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) {
123 log_error (
"Can't open lease database %s: %m --",
125 log_error (
" check for failed database %s!",
127 log_error (
"Please read the dhcpd.leases manual%s",
129 log_fatal (
"don't know what to do about this.");
131 log_fatal (
"Can't open %s: %m", filename);
135 cfile = (
struct parse *)0;
136 #if defined (TRACING)
139 status =
new_parse(&cfile, file, NULL, 0, filename, 0);
142 flen = lseek (file, (off_t)0, SEEK_END);
145 log_fatal (
"Can't lseek on %s: %m", filename);
147 if (lseek (file, (off_t)0, SEEK_SET) < 0)
150 if (flen > 0x7FFFFFFFUL)
151 log_fatal (
"%s: file is too long to buffer.", filename);
156 tflen = strlen (filename);
159 log_fatal (
"No memory for %s (%d bytes)",
166 fbuf = dbuf + tflen + 1;
167 result = read (file, fbuf, ulen);
169 log_fatal (
"Can't read in %s: %m", filename);
171 log_fatal (
"%s: short read of %d bytes instead of %d.",
172 filename, ulen, result);
178 status =
new_parse(&cfile, -1, fbuf, ulen, filename, 0);
181 status =
new_parse(&cfile, file, NULL, 0, filename, 0);
195 #if defined (TRACING)
202 static int postconf_initialized;
203 static int leaseconf_initialized;
208 tflen = strlen (data);
209 flen = len - tflen - 1;
210 fbuf = data + tflen + 1;
216 status =
new_parse(&cfile, -1, fbuf, flen, data, 0);
218 if (ttype == trace_readleases_type)
227 if (!postconf_initialized && ttype == trace_readconf_type) {
229 postconf_initialized = 1;
232 if (!leaseconf_initialized && ttype == trace_readleases_type) {
234 leaseconf_initialized = 1;
255 token =
peek_token (&val, (
unsigned *)0, cfile);
280 token =
next_token (&val, (
unsigned *)0, cfile);
283 if (token ==
LEASE) {
287 lease_dereference (&lease,
MDL);
290 "possibly corrupt lease file");
291 }
else if (token ==
IA_NA) {
293 }
else if (token ==
IA_TA) {
295 }
else if (token ==
IA_PD) {
297 }
else if (token ==
CLASS) {
303 }
else if (token ==
HOST) {
305 }
else if (token ==
GROUP) {
307 #if defined (FAILOVER_PROTOCOL)
310 (cfile, (dhcp_failover_state_t *)0);
317 parse_authoring_byte_order(cfile);
319 log_error (
"Corrupt lease file - possible data loss!");
380 token =
peek_token (&val, (
unsigned *)0, cfile);
385 token =
next_token (&val, (
unsigned *)0, cfile);
387 parse_warn (cfile,
"filename string expected.");
400 if (global_host_once &&
402 global_host_once = 0;
403 log_error(
"WARNING: Host declarations are "
404 "global. They are not limited to "
405 "the scope you declared them in.");
411 "host declarations not allowed here.");
422 "group declarations not allowed here.");
433 parse_warn (cfile,
"shared-network parameters not %s.",
448 "subnet declarations not allowed here.");
474 status = shared_network_allocate (&share,
MDL);
476 log_fatal (
"Can't allocate shared subnet: %s",
477 isc_result_totext (status));
479 log_fatal (
"Can't allocate group for shared net");
510 share->
name = strdup(n);
512 if (share->
name == NULL)
513 log_fatal(
"Out of memory allocating default "
514 "shared network name (\"%s\").", n);
522 shared_network_dereference(&share,
MDL);
529 "class declarations not allowed here.");
540 "class declarations not allowed here.");
551 "class declarations not allowed here.");
562 "class declarations not allowed here.");
572 memset (&hardware, 0,
sizeof hardware);
573 if (host_decl && memcmp(&hardware, &(host_decl->
interface),
574 sizeof(hardware)) != 0) {
575 parse_warn(cfile,
"Host %s hardware address already "
576 "configured.", host_decl->
name);
582 host_decl ->
interface = hardware;
584 parse_warn (cfile,
"hardware address parameter %s",
585 "not allowed here.");
597 "Only one fixed address "
598 "declaration per host.");
604 "fixed-address parameter not "
614 parse_warn (cfile,
"pool declared within pool.");
617 parse_warn (cfile,
"pool declared outside of network");
628 "range declaration not allowed here.");
641 "range6 declaration not allowed here.");
652 "prefix6 declaration not allowed here.");
663 "fixed-prefix6 declaration not "
674 parse_warn (cfile,
"pool6 declared within pool.");
677 parse_warn (cfile,
"pool6 declared outside of network");
688 token =
next_token (&val, (
unsigned *)0, cfile);
691 group -> authoritative = 0;
701 group -> authoritative = 1;
704 parse_warn (cfile,
"authority makes no sense here.");
714 log_fatal(
"Server identifier not in hash (%s:%d).",
721 token =
peek_token (&val, (
unsigned *)0, cfile);
722 if (token ==
SPACE) {
725 "option space definitions %s",
726 "may not be scoped.");
737 token =
peek_token (&val, (
unsigned *)0, cfile);
741 "option definitions%s",
742 " may not be scoped.");
754 option_name_hash_delete(
757 option_code_hash_delete(
781 (&et, cfile, 1, option,
785 goto insert_statement;
793 parse_warn (cfile,
"failover peers may only be %s",
794 "defined in shared-network");
795 log_error (
"declarations and the outer scope.");
799 token =
next_token (&val, (
unsigned *)0, cfile);
800 #if defined (FAILOVER_PROTOCOL)
815 token =
next_token (&val, (
unsigned *)0, cfile);
816 parse_lease_id_format(cfile);
832 "expecting a declaration");
835 "expecting a parameter %s",
888 #if defined (FAILOVER_PROTOCOL)
896 dhcp_failover_state_t *peer;
901 unsigned hba_len =
sizeof hba;
905 dhcp_failover_config_t *cp;
907 token =
next_token (&val, (
unsigned *)0, cfile);
914 token =
next_token (&val, (
unsigned *)0, cfile);
918 log_fatal (
"no memory for peer name %s", name);
921 parse_warn (cfile,
"expecting failover peer name.");
927 peer = (dhcp_failover_state_t *)0;
930 token =
next_token (&val, (
unsigned *)0, cfile);
933 parse_warn (cfile,
"failover peer reference not %s",
934 "in shared-network declaration");
937 parse_warn (cfile,
"reference to unknown%s%s",
938 " failover peer ", name);
942 dhcp_failover_state_reference
946 dhcp_failover_state_dereference (&peer,
MDL);
949 }
else if (token ==
STATE) {
951 parse_warn (cfile,
"state declaration for unknown%s%s",
952 " failover peer ", name);
957 dhcp_failover_state_dereference (&peer,
MDL);
960 }
else if (token !=
LBRACE) {
967 parse_warn (cfile,
"redeclaration of failover peer %s", name);
969 dhcp_failover_state_dereference (&peer,
MDL);
974 status = dhcp_failover_state_allocate (&peer,
MDL);
976 log_fatal (
"Can't allocate failover peer %s: %s",
977 name, isc_result_totext (status));
985 token =
next_token (&val, (
unsigned *)0, cfile);
991 peer -> i_am = primary;
995 peer -> i_am = secondary;
998 "secondary may not define %s",
999 "load balance settings.");
1003 cp = &peer -> partner;
1010 dhcp_failover_state_dereference (&peer,
MDL);
1020 token =
next_token (&val, (
unsigned *)0, cfile);
1025 cp -> port = atoi (val);
1029 tp = &peer->max_lease_misbalance;
1033 tp = &peer->max_lease_ownership;
1037 tp = &peer->max_balance;
1041 tp = &peer->min_balance;
1045 tp = &peer->auto_partner_down;
1049 tp = &cp -> max_response_delay;
1051 token =
next_token (&val, (
unsigned *)0, cfile);
1055 dhcp_failover_state_dereference (&peer,
MDL);
1062 tp = &cp -> max_flying_updates;
1071 if (peer -> i_am == secondary)
1073 "secondary may not define %s",
1074 "load balance settings.");
1078 dhcp_failover_state_dereference (&peer,
MDL);
1081 if (hba_len != 32) {
1083 "HBA must be exactly 32 bytes.");
1092 memcpy (peer -> hba, hba, 32);
1096 token =
next_token (&val, (
unsigned *)0, cfile);
1097 if (peer -> i_am == secondary)
1099 "secondary may not define %s",
1100 "load balance settings.");
1104 dhcp_failover_state_dereference (&peer,
MDL);
1110 "0 and 256, inclusive");
1112 memset (hba, 0,
sizeof hba);
1113 for (i = 0; i < split; i++) {
1115 hba [i / 8] |= (1 << (i & 7));
1122 token =
next_token (&val, (
unsigned *)0, cfile);
1129 token =
next_token (&val, (
unsigned *)0, cfile);
1134 token =
next_token (&val, (
unsigned *)0, cfile);
1139 token =
next_token (&val, (
unsigned *)0, cfile);
1144 peer -> load_balance_max_secs = atoi (val);
1149 "invalid statement in peer declaration");
1151 dhcp_failover_state_dereference (&peer,
MDL);
1156 dhcp_failover_state_dereference (&peer,
MDL);
1159 }
while (token !=
RBRACE);
1164 if (!peer -> partner.address)
1165 parse_warn (cfile,
"peer address may not be omitted");
1168 peer->me.port = DEFAULT_FAILOVER_PORT;
1169 if (!peer->partner.port)
1170 peer->partner.port = DEFAULT_FAILOVER_PORT;
1172 if (peer -> i_am == primary) {
1175 "primary failover server must have hba or split.");
1176 }
else if (!peer -> mclt) {
1178 "primary failover server must have mclt.");
1182 if (!peer->max_lease_misbalance)
1183 peer->max_lease_misbalance = DEFAULT_MAX_LEASE_MISBALANCE;
1184 if (!peer->max_lease_ownership)
1185 peer->max_lease_ownership = DEFAULT_MAX_LEASE_OWNERSHIP;
1186 if (!peer->max_balance)
1187 peer->max_balance = DEFAULT_MAX_BALANCE_TIME;
1188 if (!peer->min_balance)
1189 peer->min_balance = DEFAULT_MIN_BALANCE_TIME;
1190 if (!peer->me.max_flying_updates)
1191 peer->me.max_flying_updates = DEFAULT_MAX_FLYING_UPDATES;
1192 if (!peer->me.max_response_delay)
1193 peer->me.max_response_delay = DEFAULT_MAX_RESPONSE_DELAY;
1207 peer -> name, isc_result_totext (status));
1208 dhcp_failover_state_dereference (&peer,
MDL);
1212 dhcp_failover_state_t *peer)
1217 dhcp_failover_state_t *state;
1218 dhcp_failover_config_t *cp;
1221 token =
next_token (&val, (
unsigned *)0, cfile);
1222 if (token !=
PEER) {
1228 token =
next_token (&val, (
unsigned *)0, cfile);
1232 log_fatal (
"failover peer name %s: no memory",
1236 parse_warn (cfile,
"expecting failover peer name.");
1242 state = (dhcp_failover_state_t *)0;
1245 parse_warn (cfile,
"unknown failover peer: %s", name);
1250 token =
next_token (&val, (
unsigned *)0, cfile);
1251 if (token !=
STATE) {
1258 state = (dhcp_failover_state_t *)0;
1259 dhcp_failover_state_reference (&state, peer,
MDL);
1261 token =
next_token (&val, (
unsigned *)0, cfile);
1266 dhcp_failover_state_dereference (&state,
MDL);
1270 token =
next_token (&val, (
unsigned *)0, cfile);
1277 token =
next_token (&val, (
unsigned *)0, cfile);
1278 if (token !=
STATE) {
1283 &cp -> state, &cp -> stos);
1287 cp = &state -> partner;
1291 if (state -> i_am == primary) {
1293 "mclt not valid for primary");
1296 token =
next_token (&val, (
unsigned *)0, cfile);
1301 state -> mclt = atoi (val);
1306 parse_warn (cfile,
"expecting state setting.");
1309 dhcp_failover_state_dereference (&state,
MDL);
1312 }
while (token !=
RBRACE);
1313 dhcp_failover_state_dereference (&state,
MDL);
1317 struct
parse *cfile;
1326 token =
next_token (&val, (
unsigned *)0, cfile);
1381 parse_warn (cfile,
"unknown failover state");
1386 token =
next_token (&val, (
unsigned *)0, cfile);
1387 if (token ==
SEMI) {
1430 void parse_authoring_byte_order (
struct parse *cfile)
1439 "authoring-byte-order specified too late.\n"
1440 "It must occur before the first lease in file\n");
1445 token =
next_token(&val, (
unsigned *)0, cfile);
1454 parse_warn(cfile,
"authoring-byte-order is invalid: "
1455 " it must be big-endian or little-endian.");
1461 log_error (
"WARNING: Lease file authored using different"
1462 " byte order, will attempt to convert");
1466 if (token !=
SEMI) {
1467 parse_warn(cfile,
"corrupt lease file; expecting a semicolon");
1487 void parse_lease_id_format (
struct parse *cfile)
1502 parse_warn(cfile,
"lease-id-format is invalid: "
1503 " it must be octal or hex.");
1512 if (token !=
SEMI) {
1513 parse_warn(cfile,
"corrupt lease file; expecting a semicolon");
1551 void get_permit(cfile, permit_head, is_allow, valid_from, valid_until)
1552 struct
parse *cfile;
1553 struct
permit **permit_head;
1555 TIME *valid_from, *valid_until;
1560 int need_clients = 1;
1625 permit->
class = NULL;
1633 if (*valid_from || *valid_until) {
1634 parse_warn(cfile,
"duplicate \"after\" clause.");
1650 parse_warn (cfile,
"expecting permit type.");
1660 if ((need_clients != 0) &&
1668 while (*permit_head)
1669 permit_head = &((*permit_head)->next);
1670 *permit_head = permit;
1683 struct permit *plp, *prp;
1690 for (plp = lhs; plp; plp = plp ->
next) {
1692 for (prp = rhs; prp; prp = prp ->
next) {
1693 if (prp -> type == plp -> type &&
1695 prp ->
class == plp ->
class)) {
1726 struct
parse *cfile;
1727 struct group *group;
1734 int declaration = 0;
1735 isc_result_t status;
1736 struct lease *lpchain = NULL, *lp;
1739 status = pool_allocate(&pool,
MDL);
1742 isc_result_totext (status));
1752 parse_warn(cfile,
"Dynamic pools are only valid inside "
1753 "subnet or shared-network statements.");
1762 #if defined (FAILOVER_PROTOCOL)
1765 dhcp_failover_state_reference
1771 pool_dereference(&pool,
MDL);
1784 "expecting \"failover peer\".");
1788 #if defined (FAILOVER_PROTOCOL)
1790 dhcp_failover_state_dereference
1795 #if defined (FAILOVER_PROTOCOL)
1799 if (token !=
PEER) {
1811 dhcp_failover_state_dereference
1817 "failover peer %s: %s", val,
1818 isc_result_totext (status));
1868 #if defined (FAILOVER_PROTOCOL)
1884 for (lp = lpchain; lp; lp = lp->
next) {
1885 pool_dereference(&lp->pool,
MDL);
1886 pool_reference(&lp->pool, pp,
MDL);
1889 #if defined (BINARY_LEASES)
1903 for (; *
p; p = &((*p)->next))
1905 pool_reference(p, pool,
MDL);
1911 parse_warn(cfile,
"Pool declaration with no address range.");
1912 log_error(
"Pool declarations must always contain at least");
1920 lease_reference(&lp, lpchain,
MDL);
1921 lease_dereference(&lpchain,
MDL);
1923 lease_reference(&lpchain, lp->
next,
MDL);
1924 lease_dereference(&lp->next,
MDL);
1925 lease_dereference(&lp,
MDL);
1928 pool_dereference(&pool,
MDL);
1935 struct
parse *cfile;
1940 token =
next_token (&val, (
unsigned *)0, cfile);
1953 struct
parse *cfile;
1954 struct group *group;
1960 int declaration = 0;
1963 isc_result_t status;
1970 parse_warn (cfile,
"expecting a name for host declaration.");
1976 status = host_allocate (&host,
MDL);
1978 log_fatal (
"can't allocate host decl struct %s: %s",
1979 name, isc_result_totext (status));
1980 host -> name =
name;
1982 log_fatal (
"can't clone group for host %s", name);
1984 host_dereference (&host,
MDL);
1992 token =
peek_token (&val, (
unsigned *)0, cfile);
1999 parse_warn (cfile,
"unexpected end of file");
2021 if (token ==
GROUP) {
2024 token =
next_token (&val, (
unsigned *)0, cfile);
2027 "expecting string or identifier.");
2033 val, strlen (val),
MDL)) {
2034 parse_warn (cfile,
"unknown group %s in host %s",
2037 if (host -> named_group)
2038 group_object_dereference
2039 (&host -> named_group,
MDL);
2040 group_object_reference (&host -> named_group,
2042 group_object_dereference (&go,
MDL);
2051 unsigned char *t = 0;
2059 "client identifier.",
2065 token =
peek_token (&val, (
unsigned *)0, cfile);
2069 host -> client_identifier.terminated = 1;
2074 (
unsigned char *)0, &len,
':', 16, 8);
2077 "expecting hex list.");
2080 s = (
const char *)t;
2083 (&host -> client_identifier.buffer,
2084 len + host -> client_identifier.terminated,
MDL))
2085 log_fatal (
"no memory for uid for host %s.",
2087 host -> client_identifier.data =
2088 host -> client_identifier.buffer -> data;
2089 host -> client_identifier.len = len;
2090 memcpy (host -> client_identifier.buffer -> data, s,
2091 len + host -> client_identifier.terminated);
2103 "only one host-identifier allowed "
2114 "host-identifier v6relopt "
2115 "must have a number");
2119 host->
relays = atoi(val);
2122 "host-identifier v6relopt "
2123 "must have a number >= 0");
2127 }
else if (token !=
OPTION) {
2129 "host-identifier must be an option"
2176 (
unsigned char *)host -> name,
2177 strlen (host -> name),
MDL)) {
2179 host_dereference (&hp,
MDL);
2183 if (host -> group -> statements ||
2184 (host -> group -> authoritative !=
2186 if (host -> group -> next)
2207 parse_warn (cfile,
"host %s: %s", host -> name,
2208 isc_result_totext (status));
2210 host_dereference (&host,
MDL);
2218 struct
parse *cfile;
2219 struct group *group;
2224 struct class *
class = NULL, *pc = NULL;
2225 int declaration = 0;
2232 isc_result_t status = ISC_R_FAILURE;
2233 int matchedonce = 0;
2234 int submatchedonce = 0;
2252 class_reference(&
class, pc,
MDL);
2254 class_dereference(&pc,
MDL);
2269 data.
len = strlen (val);
2272 log_fatal (
"no memory for class name.");
2277 "implicit-vendor-class" :
"implicit-user-class";
2288 log_fatal (
"No memory for class name %s.", tname);
2303 class_dereference (&pc,
MDL);
2309 memcpy ((
char *)data.
buffer -> data, val,
2312 memset (&data, 0,
sizeof data);
2315 class_dereference (&pc,
MDL);
2319 parse_warn (cfile,
"Expecting string or hex list.");
2321 class_dereference (&pc,
MDL);
2329 class_hash_lookup (&
class, pc -> hash,
2336 status = subclass_allocate (&
class,
MDL);
2338 status = class_allocate (&
class,
MDL);
2342 class_reference (&
class -> superclass, pc,
MDL);
2343 class -> lease_limit = pc -> lease_limit;
2344 if (
class -> lease_limit) {
2345 class -> billed_leases =
2346 dmalloc (
class -> lease_limit *
2348 if (!
class -> billed_leases)
2350 memset (
class -> billed_leases, 0,
2351 (
class -> lease_limit *
2352 sizeof (
struct lease *)));
2357 log_fatal (
"No memory for subclass hash.");
2358 class_hash_add (pc -> hash,
2359 (
const char *)
class -> hash_string.data,
2360 class -> hash_string.len,
2361 (
void *)
class,
MDL);
2366 log_fatal (
"no memory to clone class group.");
2375 log_fatal (
"no memory for class statement.");
2376 stmt -> op = supersede_option_statement;
2379 stmt -> data.option -> data = data;
2383 option_code_hash_lookup(
2388 class -> statements = stmt;
2401 if (
class -> superclass) {
2403 if (token ==
SEMI) {
2407 status = class_reference (cp,
class,
MDL);
2408 class_dereference (&
class,
MDL);
2410 class_dereference (&pc,
MDL);
2420 class_dereference (&
class,
MDL);
2422 class_dereference (&pc,
MDL);
2433 parse_warn (cfile,
"unexpected end of file");
2435 }
else if (token ==
DYNAMIC) {
2447 }
else if (token ==
MATCH) {
2450 "invalid match in subclass.");
2461 "one 'match if' clause.");
2472 "expecting boolean expr.");
2476 #if defined (DEBUG_EXPRESSION_PARSE)
2482 }
else if (token ==
SPAWN) {
2486 "invalid spawn in subclass.");
2490 class -> spawning = 1;
2492 if (token !=
WITH) {
2494 "expecting with after spawn");
2499 if (submatchedonce) {
2501 "can't override existing %s.",
2513 "expecting data expr.");
2517 #if defined (DEBUG_EXPRESSION_PARSE)
2523 }
else if (token ==
LEASE) {
2526 if (token !=
LIMIT) {
2539 class -> lease_limit = atoi (val);
2542 class -> billed_leases =
2543 dmalloc (
class -> lease_limit *
2545 if (!
class -> billed_leases)
2546 log_fatal (
"no memory for billed leases.");
2547 memset (
class -> billed_leases, 0,
2548 (
class -> lease_limit *
2549 sizeof (
struct lease *)));
2561 struct class *theclass = NULL;
2566 class_dereference(&theclass,
MDL);
2569 class_hash_delete(pc->hash,
2581 class_reference (&c ->
nic,
class,
MDL);
2586 status = class_reference (cp,
class,
MDL);
2587 class_dereference (&
class,
MDL);
2589 class_dereference (&pc,
MDL);
2597 struct
parse *cfile;
2598 struct group *group;
2604 int declaration = 0;
2605 isc_result_t status;
2608 status = shared_network_allocate (&share,
MDL);
2610 log_fatal (
"Can't allocate shared subnet: %s",
2611 isc_result_totext (status));
2613 log_fatal (
"Can't clone group for shared net");
2619 token =
peek_token (&val, (
unsigned *)0, cfile);
2624 parse_warn (cfile,
"zero-length shared network name");
2625 val =
"<no-name-given>";
2629 log_fatal (
"no memory for shared network name");
2635 "expecting a name for shared-network");
2637 shared_network_dereference (&share,
MDL);
2641 share -> name =
name;
2644 shared_network_dereference (&share,
MDL);
2649 token =
peek_token (&val, (
unsigned *)0, cfile);
2654 "empty shared-network decl");
2657 shared_network_dereference (&share,
MDL);
2661 parse_warn (cfile,
"unexpected end of file");
2665 token =
next_token (&val, (
unsigned *)0, cfile);
2677 shared_network_dereference (&share,
MDL);
2682 common_subnet_parsing(
struct parse *cfile,
2686 struct subnet *t, *u;
2688 int declaration = 0;
2693 subnet_dereference(&subnet,
MDL);
2704 parse_warn (cfile,
"unexpected end of file");
2722 subnet_reference(&share->
subnets, subnet,
MDL);
2734 subnet_dereference(&share->
subnets,
2736 subnet_reference(&share->
subnets,
2739 subnet_dereference(&subnet,
MDL);
2746 subnet_dereference(&subnet,
MDL);
2754 struct
parse *cfile;
2759 struct subnet *subnet;
2761 unsigned char addr [4];
2762 unsigned len =
sizeof addr;
2763 isc_result_t status;
2765 subnet = (
struct subnet *)0;
2766 status = subnet_allocate (&subnet,
MDL);
2768 log_fatal (
"Allocation of new subnet failed: %s",
2769 isc_result_totext (status));
2784 log_fatal(
"Allocation of group for new subnet failed.");
2787 subnet_reference (&subnet -> group -> subnet, subnet,
MDL);
2791 subnet_dereference (&subnet,
MDL);
2794 memcpy (iaddr.
iabuf, addr, len);
2796 subnet ->
net = iaddr;
2798 token =
next_token (&val, (
unsigned *)0, cfile);
2807 subnet_dereference (&subnet,
MDL);
2810 memcpy (iaddr.
iabuf, addr, len);
2820 if (maskstr == NULL) {
2821 log_fatal(
"Allocation of subnet maskstr failed: %s",
2826 "subnet %s netmask %s: bad subnet number/mask combination.",
2829 subnet_dereference (&subnet,
MDL);
2834 common_subnet_parsing(cfile, share, subnet);
2842 #if !defined(DHCPv6)
2846 struct subnet *subnet;
2847 isc_result_t status;
2852 const static int mask[] = { 0x00, 0x80, 0xC0, 0xE0,
2853 0xF0, 0xF8, 0xFC, 0xFE };
2856 #if defined(DHCP4o6)
2858 parse_warn(cfile,
"subnet6 statement is only supported "
2859 "in DHCPv6 and DHCPv4o6 modes.");
2865 parse_warn(cfile,
"subnet6 statement is only supported "
2873 status = subnet_allocate(&subnet,
MDL);
2875 log_fatal(
"Allocation of new subnet failed: %s",
2876 isc_result_totext(status));
2892 log_fatal(
"Allocation of group for new subnet failed.");
2898 subnet_dereference(&subnet,
MDL);
2903 if (token !=
SLASH) {
2920 parse_warn(cfile,
"Expecting a number between 0 and 128.");
2926 parse_warn(cfile,
"New subnet mask too short.");
2936 if (ofs < subnet->netmask.len) {
2939 while (--ofs >= 0) {
2945 if (memcmp(&iaddr, &subnet->
net, 16) != 0) {
2947 "subnet %s/%d: prefix not long enough for address.",
2949 subnet_dereference(&subnet,
MDL);
2954 if (!common_subnet_parsing(cfile, share, subnet)) {
2963 struct
parse *cfile;
2964 struct group *group;
2969 int declaration = 0;
2971 isc_result_t status;
2979 log_fatal(
"no memory for explicit group.");
2987 log_fatal(
"no memory for group decl name %s", val);
3009 }
else if (token ==
DYNAMIC) {
3013 }
else if (token ==
STATIC) {
3028 strlen(name),
MDL)) {
3034 status = group_object_allocate(&t,
MDL);
3036 log_fatal(
"no memory for group decl %s: %s",
3037 val, isc_result_totext(status));
3046 group_object_dereference(&t,
MDL);
3056 struct parse *cfile,
3093 if (token ==
COMMA) {
3096 }
while (token ==
COMMA);
3130 unsigned char addr [4];
3131 unsigned len =
sizeof addr;
3139 int noequal, newbinding;
3142 isc_result_t status;
3146 unsigned buflen = 0;
3147 struct class *
class;
3149 lease = (
struct lease *)0;
3150 status = lease_allocate (&lease,
MDL);
3156 lease_dereference (&lease,
MDL);
3163 lease_dereference (&lease,
MDL);
3168 token =
next_token (&val, (
unsigned *)0, cfile);
3172 parse_warn (cfile,
"unexpected end of file");
3175 strncpy (tbuf, val,
sizeof tbuf);
3176 tbuf [(
sizeof tbuf) - 1] = 0;
3228 token =
peek_token (&val, (
unsigned *)0, cfile);
3230 unsigned char *tuid;
3232 if (buflen < sizeof lease ->
uid_buf) {
3237 tuid = ((
unsigned char *)
3241 lease_dereference (&lease,
3248 memcpy (tuid, val, lease ->
uid_len);
3249 lease ->
uid = tuid;
3253 (cfile, (
unsigned char *)0,
3254 &buflen,
':', 16, 8));
3255 if (!lease ->
uid) {
3256 lease_dereference (&lease,
MDL);
3262 lease ->
uid = (
unsigned char *)0;
3270 if (!lease ->
uid) {
3277 token =
next_token (&val, (
unsigned *)0, cfile);
3281 lease_dereference (&lease,
MDL);
3316 token =
next_token (&val, (
unsigned *)0, cfile);
3322 goto do_binding_state;
3332 goto do_binding_state;
3338 token =
next_token (&val, (
unsigned *)0, cfile);
3339 if (token !=
STATE) {
3344 token =
next_token (&val, (
unsigned *)0, cfile);
3382 "%s: expecting a binding state.",
3388 if (seenbit == 256) {
3397 if (!(seenmask & 128))
3401 if (!(seenmask & 512))
3403 }
else if (seenbit == 128)
3405 else if (seenbit == 512)
3408 log_fatal(
"Impossible condition at %s:%d.",
3416 token =
peek_token (&val, (
unsigned *)0, cfile);
3421 lease_dereference (&lease,
MDL);
3431 "expecting a hostname.");
3433 lease_dereference (&lease,
MDL);
3441 class = (struct class *)0;
3442 token =
next_token (&val, (
unsigned *)0, cfile);
3443 if (token ==
CLASS) {
3445 (
unsigned *)0, cfile);
3453 if (lease -> billing_class)
3454 class_dereference (&lease -> billing_class,
3459 "unknown class %s", val);
3462 if (lease -> billing_class)
3463 class_dereference (&lease -> billing_class,
3473 class_reference (&lease -> billing_class,
3475 class_dereference (&
class,
MDL);
3484 lease_dereference (&lease,
MDL);
3489 on->
data.
on.statements) {
3496 on->
data.
on.statements) {
3514 "agent option expected.");
3521 log_error (
"no memory to stash agent option");
3525 *
p; p = &((*p) -> cdr))
3529 &((*p) -> car)), oc,
MDL);
3537 token =
next_token (&val, (
unsigned *)0, cfile);
3540 "%s can't be a variable name",
3544 lease_dereference (&lease,
MDL);
3553 binding = (
struct binding *)0;
3556 if (!lease -> scope)
3558 (&lease -> scope,
MDL)))
3564 memset (binding, 0,
sizeof *binding);
3567 if (!binding -> name)
3570 strcpy (binding -> name, val);
3578 log_fatal(
"no memory for binding value.");
3581 token =
next_token (&val, (
unsigned *)0, cfile);
3582 if (token !=
EQUAL) {
3584 "expecting '=' in set statement.");
3589 if (!parse_binding_value(cfile, nv)) {
3591 lease_dereference(&lease,
MDL);
3612 if (!strcasecmp (val,
"ddns-fwd-name")) {
3616 }
else if (!strcasecmp (val,
"ddns-rev-name")) {
3621 parse_warn(cfile,
"Unexpected configuration "
3625 lease_dereference (&lease,
MDL);
3629 if (seenmask & seenbit) {
3631 "Too many %s parameters in lease %s\n",
3634 seenmask |= seenbit;
3639 if (!(seenmask & 256)) {
3643 #if defined (FAILOVER_PROTOCOL)
3650 #if defined (FAILOVER_PROTOCOL)
3663 if (!(seenmask & 65536))
3666 lease_reference (lp, lease,
MDL);
3667 lease_dereference (&lease,
MDL);
3686 if ((cfile == NULL) || (value == NULL))
3693 value->
type = binding_data;
3706 value->
type = binding_data;
3726 }
else if (token ==
PERCENT) {
3730 parse_warn(cfile,
"expecting decimal number.");
3735 value->
type = binding_numeric;
3737 }
else if (token ==
NAME) {
3739 value->
type = binding_boolean;
3740 if (!strcasecmp(val,
"true"))
3742 else if (!strcasecmp(val,
"false"))
3745 parse_warn(cfile,
"expecting true or false");
3751 parse_warn (cfile,
"expecting a constant value.");
3764 struct
parse *cfile;
3765 struct group *group;
3767 struct
pool *inpool;
3768 struct
lease **lpchain;
3770 struct iaddr low, high, net;
3771 unsigned char addr [4];
3772 unsigned len =
sizeof addr;
3776 struct subnet *subnet;
3779 isc_result_t status;
3790 memcpy (low.
iabuf, addr, len);
3794 token =
peek_token (&val, (
unsigned *)0, cfile);
3801 memcpy (high.
iabuf, addr, len);
3805 token =
next_token (&val, (
unsigned *)0, cfile);
3806 if (token !=
SEMI) {
3813 subnet = group -> subnet;
3817 for (subnet = share ->
subnets;
3818 subnet; subnet = subnet -> next_sibling) {
3820 if (
addr_eq (net, subnet -> net))
3824 parse_warn (cfile,
"address range not on network %s",
3826 log_error (
"Be sure to place pool statement after %s",
3827 "related subnet declarations.");
3833 struct pool *last = (
struct pool *)0;
3838 for (pool = share ->
pools; pool; pool = pool ->
next) {
3843 permit_dynamic_bootp_clients)) ||
3848 permit_all_clients))) {
3857 status = pool_allocate (&pool,
MDL);
3859 log_fatal (
"no memory for ad-hoc pool: %s",
3860 isc_result_totext (status));
3863 log_fatal (
"no memory for ad-hoc permit.");
3869 pool -> permit_list =
p;
3872 pool -> prohibit_list =
p;
3876 pool_reference (&last ->
next, pool,
MDL);
3878 pool_reference (&share ->
pools, pool,
MDL);
3882 log_fatal (
"no memory for anon pool group.");
3884 pool = (
struct pool *)0;
3886 pool_reference (&pool, last,
MDL);
3888 pool_reference (&pool, share ->
pools,
MDL);
3891 pool = (
struct pool *)0;
3892 pool_reference (&pool, inpool,
MDL);
3895 #if defined (FAILOVER_PROTOCOL)
3899 parse_warn (cfile,
"dynamic-bootp flag is %s",
3900 "not permitted for address");
3901 log_error (
"range declarations where there is a failover");
3902 log_error (
"peer in scope. If you wish to declare an");
3903 log_error (
"address range from which dynamic bootp leases");
3904 log_error (
"can be allocated, please declare it within a");
3905 log_error (
"pool declaration that also contains the \"no");
3906 log_error (
"failover\" statement. The failover protocol");
3907 log_error (
"itself does not permit dynamic bootp - this");
3908 log_error (
"is not a limitation specific to the ISC DHCP");
3909 log_error (
"server. Please don't ask me to defend this");
3910 log_error (
"until you have read and really tried %s",
3912 log_error (
"the failover protocol specification.");
3922 pool_dereference (&pool,
MDL);
3927 add_ipv6_pool_to_subnet(
struct subnet *subnet, u_int16_t type,
3928 struct iaddr *lo_addr,
int bits,
int units,
3931 struct in6_addr tmp_in6_addr;
3938 if (lo_addr->
len !=
sizeof(tmp_in6_addr)) {
3939 log_fatal(
"Internal error: Attempt to add non-IPv6 address "
3940 "to IPv6 shared network.");
3942 memcpy(&tmp_in6_addr, lo_addr->
iabuf,
sizeof(tmp_in6_addr));
3960 subnet_reference(&pool->
subnet, subnet,
MDL);
3974 while (pond->
ipv6_pools[num_pools] != NULL) {
3982 if (num_pools > 0) {
3984 sizeof(
struct ipv6_pool *) * num_pools);
4012 if ((units - bits) > (
sizeof(isc_uint64_t) * 8)) {
4017 isc_uint64_t space_left
4020 = (isc_uint64_t)(1) << (units -
bits);
4022 if (addon > space_left) {
4059 add_ipv6_pond_to_network(
struct group *group,
4062 struct ipv6_pond *pond = NULL, *last = NULL;
4064 isc_result_t status;
4082 log_fatal (
"no memory for ad-hoc ipv6 pond: %s",
4083 isc_result_totext (status));
4086 log_fatal (
"no memory for ad-hoc ipv6 permit.");
4089 p->
type = permit_all_clients;
4102 log_fatal (
"no memory for anon pool group.");
4115 struct group *group,
4117 struct iaddr lo, hi;
4127 parse_warn(cfile,
"range6 statement is only supported "
4134 if (group->
subnet == NULL)
4147 parse_warn(cfile,
"range6 start address is outside the subnet");
4155 memset(&net, 0,
sizeof(net));
4162 if (token ==
SLASH) {
4175 if ((bits < 0) || (bits > 128)) {
4176 parse_warn(cfile,
"networks have 0 to 128 bits");
4182 "network mask smaller than subnet mask");
4197 parse_warn(cfile,
"temporary mask too short");
4235 "range6 end address is outside the subnet");
4245 log_fatal(
"Error converting range to CIDR networks");
4256 if (inpond != NULL) {
4259 add_ipv6_pond_to_network(group, &pond);
4263 for (p=nets; p != NULL; p=p->
next) {
4264 add_ipv6_pool_to_subnet(group->
subnet, type,
4276 if (token !=
SEMI) {
4287 struct group *group,
4289 struct iaddr lo, hi;
4298 parse_warn(cfile,
"prefix6 statement is only supported "
4305 if (group->
subnet == NULL)
4325 " is outside the subnet");
4345 " is outside the subnet");
4355 if (token !=
SLASH) {
4369 if ((bits <= 0) || (bits >= 128)) {
4370 parse_warn(cfile,
"networks have 0 to 128 bits (exclusive)");
4381 parse_warn(cfile,
"network mask smaller than subnet mask");
4394 if (token !=
SEMI) {
4405 log_fatal(
"Error converting prefix to CIDR");
4414 if (inpond != NULL) {
4417 add_ipv6_pond_to_network(group, &pond);
4420 for (p = nets; p != NULL; p = p->
next) {
4453 while (*h != NULL) {
4473 if (token !=
SLASH) {
4489 if (token !=
SEMI) {
4502 parse_warn(cfile,
"networks have 0 to 128 bits");
4538 struct
parse *cfile;
4539 struct group *group;
4546 int declaration = 0;
4547 isc_result_t status;
4553 isc_result_totext (status));
4560 parse_warn(cfile,
"pool6s are only valid inside "
4561 "subnet statements.");
4634 for (; *
p; p = &((*p)->next))
4641 parse_warn (cfile,
"Pool6 declaration with no %s.",
4642 "address range6 or prefix6");
4643 log_error (
"Pool6 declarations must always contain at least");
4644 log_error (
"one range6 or prefix6 statement.");
4662 struct
parse *cfile;
4667 unsigned char rf = flag;
4676 token =
next_token (&val, (
unsigned *)0, cfile);
4711 parse_warn (cfile,
"expecting allow/deny key");
4719 log_fatal(
"Unable to find server option %u (%s:%d).",
4729 #if !defined(DHCPv6)
4734 struct ia_xx *ia = NULL;
4736 struct ia_xx *old_ia;
4745 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
4746 isc_boolean_t newbinding;
4754 parse_warn(cfile,
"IA_NA is only supported in DHCPv6 mode.");
4759 if (!parse_iaid_duid(cfile, &ia, &iaid,
MDL)) {
4767 parse_warn(cfile,
"corrupt lease file; expecting left brace");
4774 if (token ==
RBRACE)
break;
4776 if (token ==
CLTT) {
4783 "expecting IAADDR or right brace");
4790 "expecting IPv6 address");
4798 "expecting left brace");
4808 if (token ==
RBRACE)
break;
4817 "unexpected end of file");
4823 if (token !=
STATE) {
4857 if (token !=
SEMI) {
4874 prefer = atoi (val);
4883 if (token ==
SEMI) {
4887 "corrupt lease file; "
4888 "expecting semicolon.");
4911 if (token ==
SEMI) {
4915 "corrupt lease file; "
4916 "expecting semicolon.");
4928 if ((token !=
NAME) &&
4960 if (bnd->
name == NULL) {
4966 newbinding = ISC_TRUE;
4968 newbinding = ISC_FALSE;
4977 if (token !=
EQUAL) {
4983 if (!parse_binding_value(cfile, nv)) {
5015 if (on_star[0] == NULL) {
5043 "expecting ia_na contents, "
5052 "missing state in iaaddr");
5055 if (end_time == -1) {
5057 "missing end time in iaaddr");
5067 iaaddr->
state = state;
5069 iaaddr->
valid = valid;
5073 if (scope != NULL) {
5085 (i < 2) && on_star[i] != NULL ;
5087 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5088 on_star[i]->
data.
on.statements) {
5093 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5094 on_star[i]->
data.
on.statements) {
5106 inet_ntop(AF_INET6, &iaaddr->
addr,
5107 addr_buf,
sizeof(addr_buf));
5108 log_error(
"No pool found for IA_NA address %s",
5117 log_error(
"Non EUI-64 lease in EUI-64 pool: %s"
5128 inet_ntop(AF_INET6, &iaaddr->
addr,
5129 addr_buf,
sizeof(addr_buf));
5130 parse_warn(cfile,
"duplicate na lease for address %s",
5176 #if !defined(DHCPv6)
5181 struct ia_xx *ia = NULL;
5183 struct ia_xx *old_ia;
5192 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5193 isc_boolean_t newbinding;
5201 parse_warn(cfile,
"IA_TA is only supported in DHCPv6 mode.");
5206 if (!parse_iaid_duid(cfile, &ia, &iaid,
MDL)) {
5214 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5221 if (token ==
RBRACE)
break;
5223 if (token ==
CLTT) {
5230 "expecting IAADDR or right brace");
5237 "expecting IPv6 address");
5245 "expecting left brace");
5255 if (token ==
RBRACE)
break;
5264 "unexpected end of file");
5270 if (token !=
STATE) {
5304 if (token !=
SEMI) {
5321 prefer = atoi (val);
5330 if (token ==
SEMI) {
5334 "corrupt lease file; "
5335 "expecting semicolon.");
5358 if (token ==
SEMI) {
5362 "corrupt lease file; "
5363 "expecting semicolon.");
5375 if ((token !=
NAME) &&
5407 if (bnd->
name == NULL) {
5413 newbinding = ISC_TRUE;
5415 newbinding = ISC_FALSE;
5424 if (token !=
EQUAL) {
5430 if (!parse_binding_value(cfile, nv)) {
5462 if (on_star[0] == NULL) {
5490 "expecting ia_ta contents, "
5499 "missing state in iaaddr");
5502 if (end_time == -1) {
5504 "missing end time in iaaddr");
5514 iaaddr->
state = state;
5516 iaaddr->
valid = valid;
5520 if (scope != NULL) {
5532 (i < 2) && on_star[i] != NULL ;
5534 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5535 on_star[i]->
data.
on.statements) {
5540 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5541 on_star[i]->
data.
on.statements) {
5553 inet_ntop(AF_INET6, &iaaddr->
addr,
5554 addr_buf,
sizeof(addr_buf));
5555 log_error(
"No pool found for IA_TA address %s",
5564 inet_ntop(AF_INET6, &iaaddr->
addr,
5565 addr_buf,
sizeof(addr_buf));
5566 parse_warn(cfile,
"duplicate ta lease for address %s",
5612 #if !defined(DHCPv6)
5617 struct ia_xx *ia = NULL;
5619 struct ia_xx *old_ia;
5629 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5630 isc_boolean_t newbinding;
5638 parse_warn(cfile,
"IA_PD is only supported in DHCPv6 mode.");
5643 if (!parse_iaid_duid(cfile, &ia, &iaid,
MDL)) {
5651 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5658 if (token ==
RBRACE)
break;
5660 if (token ==
CLTT) {
5666 parse_warn(cfile,
"corrupt lease file; expecting "
5667 "IAPREFIX or right brace");
5674 "expecting IPv6 prefix");
5682 "expecting left brace");
5692 if (token ==
RBRACE)
break;
5701 "unexpected end of file");
5707 if (token !=
STATE) {
5741 if (token !=
SEMI) {
5758 prefer = atoi (val);
5767 if (token ==
SEMI) {
5771 "corrupt lease file; "
5772 "expecting semicolon.");
5795 if (token ==
SEMI) {
5799 "corrupt lease file; "
5800 "expecting semicolon.");
5812 if ((token !=
NAME) &&
5844 if (bnd->
name == NULL) {
5850 newbinding = ISC_TRUE;
5852 newbinding = ISC_FALSE;
5861 if (token !=
EQUAL) {
5867 if (!parse_binding_value(cfile, nv)) {
5899 if (on_star[0] == NULL) {
5927 "expecting ia_pd contents, "
5936 "missing state in iaprefix");
5939 if (end_time == -1) {
5941 "missing end time in iaprefix");
5950 iapref->
plen = plen;
5951 iapref->
state = state;
5953 iapref->
valid = valid;
5957 if (scope != NULL) {
5969 (i < 2) && on_star[i] != NULL ;
5971 if ((on_star[i]->data.on.evtypes &
ON_EXPIRY) &&
5972 on_star[i]->
data.
on.statements) {
5977 if ((on_star[i]->data.on.evtypes &
ON_RELEASE) &&
5978 on_star[i]->
data.
on.statements) {
5992 inet_ntop(AF_INET6, &iapref->
addr,
5993 addr_buf,
sizeof(addr_buf));
5994 log_error(
"No pool found for prefix %s/%d", addr_buf,
6003 inet_ntop(AF_INET6, &iapref->
addr,
6004 addr_buf,
sizeof(addr_buf));
6005 parse_warn(cfile,
"duplicate pd lease for address %s",
6065 unsigned char bytes[128];
6068 len =
parse_X(cfile, bytes,
sizeof(bytes));
6075 memset(&duid, 0x0,
sizeof(duid));
6077 log_fatal(
"parse_server_duid: out of memory");
6080 memcpy(duid.buffer->data, bytes, len);
6082 duid.data = duid.buffer->data;
6106 u_int32_t enterprise_number;
6133 parse_warn(cfile,
"enterprise number expected");
6137 enterprise_number = atoi(val);
6149 memset(&duid, 0,
sizeof(duid));
6150 duid.len = 2 + 4 +
len;
6152 log_fatal(
"Out of memory storing DUID");
6154 duid.data = (
unsigned char *)duid.buffer->data;
6156 putULong(duid.buffer->data + 2, enterprise_number);
6157 memcpy(duid.buffer->data + 6, val, len);
6170 else if (token ==
LL) {
6193 memset(&ll_addr, 0,
sizeof(ll_addr));
6201 memset(&duid, 0,
sizeof(duid));
6202 duid.len = 2 + 2 + ll_addr.len;
6204 log_fatal(
"Out of memory storing DUID");
6206 duid.data = (
unsigned char *)duid.buffer->data;
6208 putUShort(duid.buffer->data + 2, ll_type);
6209 memcpy(duid.buffer->data + 4,
6210 ll_addr.data, ll_addr.len);
6225 else if (token ==
LLT) {
6255 llt_time = atoi(val);
6257 memset(&ll_addr, 0,
sizeof(ll_addr));
6265 memset(&duid, 0,
sizeof(duid));
6266 duid.len = 2 + 2 + 4 + ll_addr.len;
6268 log_fatal(
"Out of memory storing DUID");
6270 duid.data = (
unsigned char *)duid.buffer->data;
6272 putUShort(duid.buffer->data + 2, ll_type);
6273 putULong(duid.buffer->data + 4, llt_time);
6274 memcpy(duid.buffer->data + 8,
6275 ll_addr.data, ll_addr.len);
6292 else if (token ==
NUMBER) {
6293 duid_type_num = atoi(val);
6305 memset(&duid, 0,
sizeof(duid));
6308 log_fatal(
"Out of memory storing DUID");
6310 duid.data = (
unsigned char *)duid.buffer->data;
6311 putUShort(duid.buffer->data, duid_type_num);
6312 memcpy(duid.buffer->data + 2, val, len);
6322 parse_warn(cfile,
"DUID type of LLT, EN, or LL expected");
6331 if (token !=
SEMI) {
6355 memcpy(&value, source, 4);
6359 "authoring-byte-order not in the lease file.\n"
6360 "Assuming file byte order matches this server.\n");
6365 value = (((value >> 24) & 0xff) |
6366 ((value << 8) & 0xff0000) |
6367 ((value >> 8) & 0xff00) |
6368 ((value << 24) & 0xff000000));
6389 parse_iaid_duid(
struct parse* cfile,
struct ia_xx** ia, u_int32_t *iaid,
6391 unsigned char bytes[132];
6395 log_error(
"parse_iaid_duid: ia ptr cannot be null");
6400 len =
parse_X(cfile, bytes,
sizeof(bytes));
6403 "iaid+ia_xx string too short");
6412 if (
ia_allocate(ia, *iaid, (
const char*)bytes + 4, len - 4, file, line)
6414 log_fatal(
"parse_iaid_duid:Out of memory.");
void parse_subnet6_declaration(struct parse *, struct shared_network *)
struct iaddrcidrnet cidrnet
#define GROUP_OBJECT_DYNAMIC
void parse_option_space_decl(struct parse *cfile)
int parse_X(struct parse *cfile, u_int8_t *buf, unsigned max)
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)
void parse_server_duid_conf(struct parse *cfile)
void parse_trace_setup(void)
void parse_host_declaration(struct parse *, struct group *)
void trace_conf_input(trace_type_t *, unsigned, char *)
int parse_option_code_definition(struct parse *cfile, struct option *option)
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)
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)
int permit_list_match(struct permit *, struct permit *)
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
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
enum executable_statement::statement_op op
uint32_t parse_byte_order_uint32(const void *source)
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)
isc_result_t lease_file_subparse(struct parse *)
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
void parse_address_range(struct parse *, struct group *, int, struct pool *, struct lease **)
enum binding_value::@15 type
struct data_string hash_string
int parse_lease_declaration(struct lease **, struct parse *)
const char * path_dhcpd_db
int parse_allow_deny(struct option_cache **oc, struct parse *cfile, int flag)
int log_error(const char *,...) __attribute__((__format__(__printf__
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 **, struct parse *, enum dhcp_token)
int parse_lbrace(struct parse *)
enum dhcp_token peek_token(const char **rval, unsigned *rlen, struct parse *cfile)
parse_warn(cfile,"expecting ip-address or ip-address/prefixlen")
log_fatal("no memory for uname information.")
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 get_permit(struct parse *cfile, struct permit **permit_head, int is_allow, TIME *valid_from, TIME *valid_until)
Parse allow and deny statements.
int binding_value_allocate(struct binding_value **cptr, const char *file, int line)
void parse_ia_ta_declaration(struct parse *)
struct executable_statement * statements
int parse_cshl(struct data_string *data, struct parse *cfile)
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)
isc_result_t readconf(void)
int subnet_inner_than(const struct subnet *, const struct subnet *, int)
time_t hard_lifetime_end_time
struct permit * prohibit_list
void parse_subnet_declaration(struct parse *, struct shared_network *)
host_hash_t * host_name_hash
#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)
trace_type_t * trace_type_register(const char *, void *, void(*)(trace_type_t *, unsigned, char *), void(*)(trace_type_t *), const char *, int)
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)
void parse_pool_statement(struct parse *, struct group *, int)
Parse a pool statement.
int make_concat(struct expression **expr, struct expression *left, struct expression *right)
struct expression * submatch
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)
TIME parse_date(struct parse *)
struct data_string host_id
void parse_shared_net_declaration(struct parse *, struct group *)
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)
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)
const char * pin6_addr(const struct in6_addr *)
void * dmalloc(size_t, const char *, int)
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 db_startup(int testp)
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)
int parse_statement(struct parse *, struct group *, int, struct host_decl *, int)
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 *)
int make_const_data(struct expression **expr, const unsigned char *data, unsigned len, int terminated, int allocate, const char *file, int line)
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
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 parse_class_declaration(struct class **, struct parse *, struct group *, int)
int option_chain_head_allocate(struct option_chain_head **ptr, const char *file, int line)
void parse_ia_pd_declaration(struct parse *)
int parse_ip6_prefix(struct parse *cfile, struct iaddr *addr, u_int8_t *plen)
struct subnet * next_sibling
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
TIME parse_date_core(struct parse *)
struct interface_info * interface
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)
group_hash_t * group_name_hash
struct executable_statement * statements
#define DHO_VENDOR_CLASS_IDENTIFIER
struct universe agent_universe
isc_result_t parse_option_name(struct parse *, int, int *, struct option **)
isc_result_t trace_get_file(trace_type_t *, const char *, unsigned *, char **)
struct ipv6_pool ** pools
char * piaddrcidr(const struct iaddr *addr, unsigned int bits)
struct collection * collections
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
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 trace_write_packet(trace_type_t *, unsigned, const char *, const char *, int)
isc_result_t range2cidr(struct iaddrcidrnetlist **result, const struct iaddr *lo, const struct iaddr *hi)
isc_result_t read_conf_file(const char *, struct group *, int, int)
struct shared_network * shared_network
void trace_conf_stop(trace_type_t *ttype)
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, const char *file, int line)
const unsigned char * data
isc_result_t conf_file_subparse(struct parse *, struct group *, int)
struct binding_scope * scope
void parse_group_declaration(struct parse *, struct group *)
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_ia_na_declaration(struct parse *)
void parse_hardware_param(struct parse *cfile, struct hardware *hardware)
int clone_group(struct group **gp, struct group *group, const char *file, int line)
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)
#define GROUP_OBJECT_STATIC
int option_dereference(struct option **dest, const char *file, int line)
#define SV_CLIENT_UPDATES