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);
41 static int parse_iaid_duid(
struct parse *cfile,
struct ia_xx** ia,
42 u_int32_t *iaid,
const char*
file,
int line);
69 #if defined(LDAP_CONFIGURATION) 70 if (res != ISC_R_SUCCESS)
73 return ldap_read_config ();
80 int group_type,
int leasep)
93 ttype = trace_readleases_type;
95 ttype = trace_readconf_type;
104 if (status != ISC_R_SUCCESS)
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) 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)",
163 strcpy (dbuf, filename);
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);
177 status =
new_parse(&cfile, -1, fbuf, ulen, filename, 0);
184 if (status != ISC_R_SUCCESS || cfile == NULL)
192 #if defined (TRACING) 199 #if defined (TRACING) 206 static int postconf_initialized;
207 static int leaseconf_initialized;
212 tflen = strlen (data);
213 flen = len - tflen - 1;
214 fbuf = data + tflen + 1;
220 status =
new_parse(&cfile, -1, fbuf, flen, data, 0);
221 if (status == ISC_R_SUCCESS || cfile != NULL) {
222 if (ttype == trace_readleases_type)
231 if (!postconf_initialized && ttype == trace_readconf_type) {
233 postconf_initialized = 1;
236 if (!leaseconf_initialized && ttype == trace_readleases_type) {
238 leaseconf_initialized = 1;
294 "possibly corrupt lease file");
295 }
else if (token ==
IA_NA) {
297 }
else if (token ==
IA_TA) {
299 }
else if (token ==
IA_PD) {
301 }
else if (token ==
CLASS) {
307 }
else if (token ==
HOST) {
309 }
else if (token ==
GROUP) {
311 #if defined (FAILOVER_PROTOCOL) 314 (cfile, (dhcp_failover_state_t *)0);
321 parse_authoring_byte_order(cfile);
323 log_error (
"Corrupt lease file - possible data loss!");
384 token =
peek_token (&val, (
unsigned *)0, cfile);
389 token =
next_token (&val, (
unsigned *)0, cfile);
391 parse_warn (cfile,
"filename string expected.");
395 if (status != ISC_R_SUCCESS)
404 if (global_host_once &&
406 global_host_once = 0;
407 log_error(
"WARNING: Host declarations are " 408 "global. They are not limited to " 409 "the scope you declared them in.");
415 "host declarations not allowed here.");
426 "group declarations not allowed here.");
437 parse_warn (cfile,
"shared-network parameters not %s.",
452 "subnet declarations not allowed here.");
478 status = shared_network_allocate (&share,
MDL);
479 if (status != ISC_R_SUCCESS)
480 log_fatal (
"Can't allocate shared subnet: %s",
481 isc_result_totext (status));
483 log_fatal (
"Can't allocate group for shared net");
514 share->
name = strdup(n);
516 if (share->
name == NULL)
517 log_fatal(
"Out of memory allocating default " 518 "shared network name (\"%s\").", n);
526 shared_network_dereference(&share,
MDL);
533 "class declarations not allowed here.");
544 "class declarations not allowed here.");
555 "class declarations not allowed here.");
566 "class declarations not allowed here.");
579 parse_warn(cfile,
"Host %s hardware address already " 588 parse_warn (cfile,
"hardware address parameter %s",
589 "not allowed here.");
601 "Only one fixed address " 602 "declaration per host.");
608 "fixed-address parameter not " 618 parse_warn (cfile,
"pool declared within pool.");
621 parse_warn (cfile,
"pool declared outside of network");
632 "range declaration not allowed here.");
645 "range6 declaration not allowed here.");
656 "prefix6 declaration not allowed here.");
667 "fixed-prefix6 declaration not " 678 parse_warn (cfile,
"pool6 declared within pool.");
681 parse_warn (cfile,
"pool6 declared outside of network");
692 token =
next_token (&val, (
unsigned *)0, cfile);
695 group -> authoritative = 0;
705 group -> authoritative = 1;
708 parse_warn (cfile,
"authority makes no sense here.");
718 log_fatal(
"Server identifier not in hash (%s:%d).",
725 token =
peek_token (&val, (
unsigned *)0, cfile);
726 if (token ==
SPACE) {
729 "option space definitions %s",
730 "may not be scoped.");
740 if (status == ISC_R_SUCCESS) {
741 token =
peek_token (&val, (
unsigned *)0, cfile);
745 "option definitions%s",
746 " may not be scoped.");
758 option_name_hash_delete(
761 option_code_hash_delete(
789 goto insert_statement;
797 parse_warn (cfile,
"failover peers may only be %s",
798 "defined in shared-network");
799 log_error (
"declarations and the outer scope.");
803 token =
next_token (&val, (
unsigned *)0, cfile);
804 #if defined (FAILOVER_PROTOCOL) 819 token =
next_token (&val, (
unsigned *)0, cfile);
820 parse_lease_id_format(cfile);
831 "expecting a declaration");
834 "expecting a parameter %s",
887 #if defined (FAILOVER_PROTOCOL) 895 dhcp_failover_state_t *peer;
900 unsigned hba_len =
sizeof hba;
904 dhcp_failover_config_t *cp;
906 token =
next_token (&val, (
unsigned *)0, cfile);
913 token =
next_token (&val, (
unsigned *)0, cfile);
917 log_fatal (
"no memory for peer name %s", name);
920 parse_warn (cfile,
"expecting failover peer name.");
926 peer = (dhcp_failover_state_t *)0;
929 token =
next_token (&val, (
unsigned *)0, cfile);
932 parse_warn (cfile,
"failover peer reference not %s",
933 "in shared-network declaration");
936 parse_warn (cfile,
"reference to unknown%s%s",
937 " failover peer ", name);
941 dhcp_failover_state_reference
945 dhcp_failover_state_dereference (&peer,
MDL);
948 }
else if (token ==
STATE) {
950 parse_warn (cfile,
"state declaration for unknown%s%s",
951 " failover peer ", name);
956 dhcp_failover_state_dereference (&peer,
MDL);
959 }
else if (token !=
LBRACE) {
966 parse_warn (cfile,
"redeclaration of failover peer %s", name);
968 dhcp_failover_state_dereference (&peer,
MDL);
973 status = dhcp_failover_state_allocate (&peer,
MDL);
974 if (status != ISC_R_SUCCESS)
975 log_fatal (
"Can't allocate failover peer %s: %s",
976 name, isc_result_totext (status));
984 token =
next_token (&val, (
unsigned *)0, cfile);
990 peer -> i_am = primary;
994 peer -> i_am = secondary;
997 "secondary may not define %s",
998 "load balance settings.");
1002 cp = &peer -> partner;
1009 dhcp_failover_state_dereference (&peer,
MDL);
1019 token =
next_token (&val, (
unsigned *)0, cfile);
1024 cp -> port = atoi (val);
1028 tp = &peer->max_lease_misbalance;
1032 tp = &peer->max_lease_ownership;
1036 tp = &peer->max_balance;
1040 tp = &peer->min_balance;
1044 tp = &peer->auto_partner_down;
1048 tp = &cp -> max_response_delay;
1050 token =
next_token (&val, (
unsigned *)0, cfile);
1054 dhcp_failover_state_dereference (&peer,
MDL);
1061 tp = &cp -> max_flying_updates;
1070 if (peer -> i_am == secondary)
1072 "secondary may not define %s",
1073 "load balance settings.");
1077 dhcp_failover_state_dereference (&peer,
MDL);
1080 if (hba_len != 32) {
1082 "HBA must be exactly 32 bytes.");
1091 memcpy (peer -> hba, hba, 32);
1095 token =
next_token (&val, (
unsigned *)0, cfile);
1096 if (peer -> i_am == secondary)
1098 "secondary may not define %s",
1099 "load balance settings.");
1103 dhcp_failover_state_dereference (&peer,
MDL);
1109 "0 and 256, inclusive");
1111 memset (hba, 0,
sizeof hba);
1112 for (i = 0; i < split; i++) {
1114 hba [i / 8] |= (1 << (i & 7));
1121 token =
next_token (&val, (
unsigned *)0, cfile);
1128 token =
next_token (&val, (
unsigned *)0, cfile);
1133 token =
next_token (&val, (
unsigned *)0, cfile);
1138 token =
next_token (&val, (
unsigned *)0, cfile);
1143 peer -> load_balance_max_secs = atoi (val);
1148 "invalid statement in peer declaration");
1150 dhcp_failover_state_dereference (&peer,
MDL);
1155 dhcp_failover_state_dereference (&peer,
MDL);
1158 }
while (token !=
RBRACE);
1163 if (!peer -> partner.address)
1164 parse_warn (cfile,
"peer address may not be omitted");
1167 peer->me.port = DEFAULT_FAILOVER_PORT;
1168 if (!peer->partner.port)
1169 peer->partner.port = DEFAULT_FAILOVER_PORT;
1171 if (peer -> i_am == primary) {
1174 "primary failover server must have hba or split.");
1175 }
else if (!peer -> mclt) {
1177 "primary failover server must have mclt.");
1181 if (!peer->max_lease_misbalance)
1182 peer->max_lease_misbalance = DEFAULT_MAX_LEASE_MISBALANCE;
1183 if (!peer->max_lease_ownership)
1184 peer->max_lease_ownership = DEFAULT_MAX_LEASE_OWNERSHIP;
1185 if (!peer->max_balance)
1186 peer->max_balance = DEFAULT_MAX_BALANCE_TIME;
1187 if (!peer->min_balance)
1188 peer->min_balance = DEFAULT_MIN_BALANCE_TIME;
1189 if (!peer->me.max_flying_updates)
1190 peer->me.max_flying_updates = DEFAULT_MAX_FLYING_UPDATES;
1191 if (!peer->me.max_response_delay)
1192 peer->me.max_response_delay = DEFAULT_MAX_RESPONSE_DELAY;
1204 if (status != ISC_R_SUCCESS)
1206 peer -> name, isc_result_totext (status));
1207 dhcp_failover_state_dereference (&peer,
MDL);
1211 dhcp_failover_state_t *peer)
1216 dhcp_failover_state_t *state;
1217 dhcp_failover_config_t *cp;
1220 token =
next_token (&val, (
unsigned *)0, cfile);
1221 if (token !=
PEER) {
1227 token =
next_token (&val, (
unsigned *)0, cfile);
1231 log_fatal (
"failover peer name %s: no memory",
1235 parse_warn (cfile,
"expecting failover peer name.");
1241 state = (dhcp_failover_state_t *)0;
1244 parse_warn (cfile,
"unknown failover peer: %s", name);
1249 token =
next_token (&val, (
unsigned *)0, cfile);
1250 if (token !=
STATE) {
1257 state = (dhcp_failover_state_t *)0;
1258 dhcp_failover_state_reference (&state, peer,
MDL);
1260 token =
next_token (&val, (
unsigned *)0, cfile);
1265 dhcp_failover_state_dereference (&state,
MDL);
1269 token =
next_token (&val, (
unsigned *)0, cfile);
1276 token =
next_token (&val, (
unsigned *)0, cfile);
1277 if (token !=
STATE) {
1282 &cp -> state, &cp -> stos);
1286 cp = &state -> partner;
1290 if (state -> i_am == primary) {
1292 "mclt not valid for primary");
1295 token =
next_token (&val, (
unsigned *)0, cfile);
1300 state -> mclt = atoi (val);
1305 parse_warn (cfile,
"expecting state setting.");
1308 dhcp_failover_state_dereference (&state,
MDL);
1311 }
while (token !=
RBRACE);
1312 dhcp_failover_state_dereference (&state,
MDL);
1316 struct parse *cfile;
1380 parse_warn (cfile,
"unknown failover state");
1429 void parse_authoring_byte_order (
struct parse *cfile)
1438 "authoring-byte-order specified too late.\n" 1439 "It must occur before the first lease in file\n");
1453 parse_warn(cfile,
"authoring-byte-order is invalid: " 1454 " it must be big-endian or little-endian.");
1460 log_error (
"WARNING: Lease file authored using different" 1461 " byte order, will attempt to convert");
1466 parse_warn(cfile,
"corrupt lease file; expecting a semicolon");
1486 void parse_lease_id_format (
struct parse *cfile)
1501 parse_warn(cfile,
"lease-id-format is invalid: " 1502 " it must be octal or hex.");
1512 parse_warn(cfile,
"corrupt lease file; expecting a semicolon");
1550 void get_permit(cfile, permit_head, is_allow, valid_from, valid_until)
1551 struct parse *cfile;
1552 struct permit **permit_head;
1554 TIME *valid_from, *valid_until;
1559 int need_clients = 1;
1632 if (*valid_from || *valid_until) {
1633 parse_warn(cfile,
"duplicate \"after\" clause.");
1649 parse_warn (cfile,
"expecting permit type.");
1659 if ((need_clients != 0) &&
1667 while (*permit_head)
1668 permit_head = &((*permit_head)->next);
1682 struct permit *plp, *prp;
1689 for (plp = lhs; plp; plp = plp ->
next) {
1691 for (prp = rhs; prp; prp = prp ->
next) {
1694 prp ->
class == plp ->
class)) {
1725 struct parse *cfile;
1733 int declaration = 0;
1734 isc_result_t status;
1735 struct lease *lpchain = NULL, *lp;
1738 status = pool_allocate(&
pool,
MDL);
1739 if (status != ISC_R_SUCCESS)
1741 isc_result_totext (status));
1751 parse_warn(cfile,
"Dynamic pools are only valid inside " 1752 "subnet or shared-network statements.");
1761 #if defined (FAILOVER_PROTOCOL) 1764 dhcp_failover_state_reference
1783 "expecting \"failover peer\".");
1787 #if defined (FAILOVER_PROTOCOL) 1789 dhcp_failover_state_dereference
1794 #if defined (FAILOVER_PROTOCOL) 1798 if (token !=
PEER) {
1810 dhcp_failover_state_dereference
1814 if (status != ISC_R_SUCCESS)
1816 "failover peer %s: %s", val,
1817 isc_result_totext (status));
1867 #if defined (FAILOVER_PROTOCOL) 1883 for (lp = lpchain; lp; lp = lp->
next) {
1884 pool_dereference(&lp->pool,
MDL);
1885 pool_reference(&lp->pool, pp,
MDL);
1888 #if defined (BINARY_LEASES) 1902 for (; *p; p = &((*p)->next))
1910 parse_warn(cfile,
"Pool declaration with no address range.");
1911 log_error(
"Pool declarations must always contain at least");
1919 lease_reference(&lp, lpchain,
MDL);
1920 lease_dereference(&lpchain,
MDL);
1922 lease_reference(&lpchain, lp->
next,
MDL);
1923 lease_dereference(&lp->next,
MDL);
1924 lease_dereference(&lp,
MDL);
1934 struct parse *cfile;
1952 struct parse *cfile;
1959 int declaration = 0;
1962 isc_result_t status;
1969 parse_warn (cfile,
"expecting a name for host declaration.");
1975 status = host_allocate (&host,
MDL);
1976 if (status != ISC_R_SUCCESS)
1977 log_fatal (
"can't allocate host decl struct %s: %s",
1978 name, isc_result_totext (status));
1983 host_dereference (&host,
MDL);
1991 token =
peek_token (&val, (
unsigned *)0, cfile);
1998 parse_warn (cfile,
"unexpected end of file");
2020 if (token ==
GROUP) {
2023 token =
next_token (&val, (
unsigned *)0, cfile);
2026 "expecting string or identifier.");
2032 val, strlen (val),
MDL)) {
2033 parse_warn (cfile,
"unknown group %s in host %s",
2036 if (host -> named_group)
2037 group_object_dereference
2038 (&host -> named_group,
MDL);
2039 group_object_reference (&host -> named_group,
2041 group_object_dereference (&go,
MDL);
2050 unsigned char *t = 0;
2058 "client identifier.",
2064 token =
peek_token (&val, (
unsigned *)0, cfile);
2068 host -> client_identifier.terminated = 1;
2073 (
unsigned char *)0, &len,
':', 16, 8);
2076 "expecting hex list.");
2079 s = (
const char *)t;
2082 (&host -> client_identifier.buffer,
2083 len + host -> client_identifier.terminated,
MDL))
2084 log_fatal (
"no memory for uid for host %s.",
2086 host -> client_identifier.data =
2087 host -> client_identifier.buffer -> data;
2088 host -> client_identifier.len = len;
2089 memcpy (host -> client_identifier.buffer -> data, s,
2090 len + host -> client_identifier.terminated);
2102 "only one host-identifier allowed " 2113 "host-identifier v6relopt " 2114 "must have a number");
2118 host->
relays = atoi(val);
2121 "host-identifier v6relopt " 2122 "must have a number >= 0");
2126 }
else if (token !=
OPTION) {
2128 "host-identifier must be an option" 2136 if ((status != ISC_R_SUCCESS) || (
option == NULL)) {
2175 (
unsigned char *)host ->
name,
2176 strlen (host ->
name),
MDL)) {
2178 host_dereference (&hp,
MDL);
2182 if (host ->
group -> statements ||
2183 (host ->
group -> authoritative !=
2185 if (host ->
group -> next)
2205 if (status != ISC_R_SUCCESS)
2207 isc_result_totext (status));
2209 host_dereference (&host,
MDL);
2217 struct parse *cfile;
2223 struct class *
class = NULL, *pc = NULL;
2224 int declaration = 0;
2231 isc_result_t status = ISC_R_FAILURE;
2232 int matchedonce = 0;
2233 int submatchedonce = 0;
2251 class_reference(&
class, pc,
MDL);
2253 class_dereference(&pc,
MDL);
2268 data.len = strlen (val);
2271 log_fatal (
"no memory for class name.");
2273 data.terminated = 1;
2276 "implicit-vendor-class" :
"implicit-user-class";
2287 log_fatal (
"No memory for class name %s.", tname);
2288 strcpy (
name, tname);
2302 class_dereference (&pc,
MDL);
2306 data.terminated = 1;
2308 memcpy ((
char *)
data.buffer ->
data, val,
2314 class_dereference (&pc,
MDL);
2318 parse_warn (cfile,
"Expecting string or hex list.");
2320 class_dereference (&pc,
MDL);
2328 class_hash_lookup (&
class, pc -> hash,
2335 status = subclass_allocate (&
class,
MDL);
2337 status = class_allocate (&
class,
MDL);
2341 class_reference (&
class -> superclass, pc,
MDL);
2342 class -> lease_limit = pc -> lease_limit;
2343 if (
class -> lease_limit) {
2344 class -> billed_leases =
2345 dmalloc (
class -> lease_limit *
2347 if (!
class -> billed_leases)
2349 memset (
class -> billed_leases, 0,
2350 (
class -> lease_limit *
2351 sizeof (
struct lease *)));
2356 log_fatal (
"No memory for subclass hash.");
2357 class_hash_add (pc -> hash,
2358 (
const char *)
class -> hash_string.data,
2359 class -> hash_string.len,
2360 (
void *)
class,
MDL);
2365 log_fatal (
"no memory to clone class group.");
2374 log_fatal (
"no memory for class statement.");
2375 stmt -> op = supersede_option_statement;
2378 stmt -> data.option -> data = data;
2382 option_code_hash_lookup(
2387 class -> statements = stmt;
2400 if (
class -> superclass) {
2402 if (token ==
SEMI) {
2406 status = class_reference (cp,
class,
MDL);
2407 class_dereference (&
class,
MDL);
2409 class_dereference (&pc,
MDL);
2410 return cp ? (status == ISC_R_SUCCESS) : 1;
2419 class_dereference (&
class,
MDL);
2421 class_dereference (&pc,
MDL);
2432 parse_warn (cfile,
"unexpected end of file");
2434 }
else if (token ==
DYNAMIC) {
2446 }
else if (token ==
MATCH) {
2449 "invalid match in subclass.");
2460 "one 'match if' clause.");
2471 "expecting boolean expr.");
2475 #if defined (DEBUG_EXPRESSION_PARSE) 2481 }
else if (token ==
SPAWN) {
2485 "invalid spawn in subclass.");
2489 class -> spawning = 1;
2491 if (token !=
WITH) {
2493 "expecting with after spawn");
2498 if (submatchedonce) {
2500 "can't override existing %s.",
2512 "expecting data expr.");
2516 #if defined (DEBUG_EXPRESSION_PARSE) 2522 }
else if (token ==
LEASE) {
2525 if (token !=
LIMIT) {
2538 class -> lease_limit = atoi (val);
2541 class -> billed_leases =
2542 dmalloc (
class -> lease_limit *
2544 if (!
class -> billed_leases)
2545 log_fatal (
"no memory for billed leases.");
2546 memset (
class -> billed_leases, 0,
2547 (
class -> lease_limit *
2548 sizeof (
struct lease *)));
2560 struct class *theclass = NULL;
2563 if (status == ISC_R_SUCCESS) {
2565 class_dereference(&theclass,
MDL);
2568 class_hash_delete(pc->hash,
2580 class_reference (&c ->
nic,
class,
MDL);
2585 status = class_reference (cp,
class,
MDL);
2586 class_dereference (&
class,
MDL);
2588 class_dereference (&pc,
MDL);
2589 return cp ? (status == ISC_R_SUCCESS) : 1;
2596 struct parse *cfile;
2603 int declaration = 0;
2604 isc_result_t status;
2607 status = shared_network_allocate (&share,
MDL);
2608 if (status != ISC_R_SUCCESS)
2609 log_fatal (
"Can't allocate shared subnet: %s",
2610 isc_result_totext (status));
2612 log_fatal (
"Can't clone group for shared net");
2618 token =
peek_token (&val, (
unsigned *)0, cfile);
2623 parse_warn (cfile,
"zero-length shared network name");
2624 val =
"<no-name-given>";
2628 log_fatal (
"no memory for shared network name");
2634 "expecting a name for shared-network");
2636 shared_network_dereference (&share,
MDL);
2643 shared_network_dereference (&share,
MDL);
2648 token =
peek_token (&val, (
unsigned *)0, cfile);
2653 "empty shared-network decl");
2656 shared_network_dereference (&share,
MDL);
2660 parse_warn (cfile,
"unexpected end of file");
2664 token =
next_token (&val, (
unsigned *)0, cfile);
2676 shared_network_dereference (&share,
MDL);
2681 common_subnet_parsing(
struct parse *cfile,
2687 int declaration = 0;
2703 parse_warn (cfile,
"unexpected end of file");
2733 subnet_dereference(&share->
subnets,
2735 subnet_reference(&share->
subnets,
2753 struct parse *cfile;
2760 unsigned char addr [4];
2761 unsigned len =
sizeof addr;
2762 isc_result_t status;
2765 status = subnet_allocate (&
subnet,
MDL);
2766 if (status != ISC_R_SUCCESS)
2767 log_fatal (
"Allocation of new subnet failed: %s",
2768 isc_result_totext (status));
2783 log_fatal(
"Allocation of group for new subnet failed.");
2797 token =
next_token (&val, (
unsigned *)0, cfile);
2819 if (maskstr == NULL) {
2820 log_fatal(
"Allocation of subnet maskstr failed: %s",
2825 "subnet %s netmask %s: bad subnet number/mask combination.",
2833 common_subnet_parsing(cfile, share,
subnet);
2841 #if !defined(DHCPv6) 2846 isc_result_t status;
2851 const static int mask[] = { 0x00, 0x80, 0xC0, 0xE0,
2852 0xF0, 0xF8, 0xFC, 0xFE };
2855 #if defined(DHCP4o6) 2857 parse_warn(cfile,
"subnet6 statement is only supported " 2858 "in DHCPv6 and DHCPv4o6 modes.");
2864 parse_warn(cfile,
"subnet6 statement is only supported " 2873 if (status != ISC_R_SUCCESS) {
2874 log_fatal(
"Allocation of new subnet failed: %s",
2875 isc_result_totext(status));
2891 log_fatal(
"Allocation of group for new subnet failed.");
2902 if (token !=
SLASH) {
2919 parse_warn(cfile,
"Expecting a number between 0 and 128.");
2925 parse_warn(cfile,
"New subnet mask too short.");
2935 if (ofs < subnet->netmask.len) {
2938 while (--ofs >= 0) {
2946 "subnet %s/%d: prefix not long enough for address.",
2953 if (!common_subnet_parsing(cfile, share,
subnet)) {
2962 struct parse *cfile;
2968 int declaration = 0;
2970 isc_result_t status;
2978 log_fatal(
"no memory for explicit group.");
2986 log_fatal(
"no memory for group decl name %s", val);
3008 }
else if (token ==
DYNAMIC) {
3012 }
else if (token ==
STATIC) {
3033 status = group_object_allocate(&t,
MDL);
3034 if (status != ISC_R_SUCCESS)
3035 log_fatal(
"no memory for group decl %s: %s",
3036 val, isc_result_totext(status));
3045 group_object_dereference(&t,
MDL);
3055 struct parse *cfile,
3092 if (token ==
COMMA) {
3095 }
while (token ==
COMMA);
3129 unsigned char addr [4];
3130 unsigned len =
sizeof addr;
3138 int noequal, newbinding;
3141 isc_result_t status;
3145 unsigned buflen = 0;
3146 struct class *
class;
3149 status = lease_allocate (&
lease,
MDL);
3150 if (status != ISC_R_SUCCESS)
3167 token =
next_token (&val, (
unsigned *)0, cfile);
3171 parse_warn (cfile,
"unexpected end of file");
3174 strncpy (tbuf, val,
sizeof tbuf);
3175 tbuf [(
sizeof tbuf) - 1] = 0;
3227 token =
peek_token (&val, (
unsigned *)0, cfile);
3229 unsigned char *tuid;
3231 if (buflen < sizeof lease ->
uid_buf) {
3236 tuid = ((
unsigned char *)
3240 lease_dereference (&
lease,
3252 (cfile, (
unsigned char *)0,
3253 &buflen,
':', 16, 8));
3276 token =
next_token (&val, (
unsigned *)0, cfile);
3315 token =
next_token (&val, (
unsigned *)0, cfile);
3321 goto do_binding_state;
3331 goto do_binding_state;
3337 token =
next_token (&val, (
unsigned *)0, cfile);
3338 if (token !=
STATE) {
3343 token =
next_token (&val, (
unsigned *)0, cfile);
3381 "%s: expecting a binding state.",
3387 if (seenbit == 256) {
3396 if (!(seenmask & 128))
3400 if (!(seenmask & 512))
3402 }
else if (seenbit == 128)
3404 else if (seenbit == 512)
3407 log_fatal(
"Impossible condition at %s:%d.",
3415 token =
peek_token (&val, (
unsigned *)0, cfile);
3430 "expecting a hostname.");
3440 class = (struct
class *)0;
3441 token =
next_token (&val, (
unsigned *)0, cfile);
3442 if (token ==
CLASS) {
3444 (
unsigned *)0, cfile);
3452 if (
lease -> billing_class)
3453 class_dereference (&
lease -> billing_class,
3458 "unknown class %s", val);
3461 if (
lease -> billing_class)
3462 class_dereference (&
lease -> billing_class,
3472 class_reference (&
lease -> billing_class,
3474 class_dereference (&
class,
MDL);
3488 on->data.on.statements) {
3492 on->data.on.statements,
MDL);
3495 on->data.on.statements) {
3499 on->data.on.statements,
MDL);
3513 "agent option expected.");
3520 log_error (
"no memory to stash agent option");
3524 *p; p = &((*p) -> cdr))
3528 &((*p) -> car)), oc,
MDL);
3536 token =
next_token (&val, (
unsigned *)0, cfile);
3539 "%s can't be a variable name",
3555 if (!
lease -> scope)
3577 log_fatal(
"no memory for binding value.");
3580 token =
next_token (&val, (
unsigned *)0, cfile);
3581 if (token !=
EQUAL) {
3583 "expecting '=' in set statement.");
3588 if (!parse_binding_value(cfile, nv)) {
3611 if (!strcasecmp (val,
"ddns-fwd-name")) {
3615 }
else if (!strcasecmp (val,
"ddns-rev-name")) {
3620 parse_warn(cfile,
"Unexpected configuration " 3628 if (seenmask & seenbit) {
3630 "Too many %s parameters in lease %s\n",
3633 seenmask |= seenbit;
3638 if (!(seenmask & 256)) {
3642 #if defined (FAILOVER_PROTOCOL) 3649 #if defined (FAILOVER_PROTOCOL) 3662 if (!(seenmask & 65536))
3685 if ((cfile == NULL) || (value == NULL))
3692 value->
type = binding_data;
3700 memcpy(
data->buffer->data, val, buflen + 1);
3703 data->terminated = 1;
3705 value->
type = binding_data;
3720 memcpy(
data->buffer->data, s,
data->len);
3725 }
else if (token ==
PERCENT) {
3729 parse_warn(cfile,
"expecting decimal number.");
3734 value->
type = binding_numeric;
3736 }
else if (token ==
NAME) {
3738 value->
type = binding_boolean;
3739 if (!strcasecmp(val,
"true"))
3741 else if (!strcasecmp(val,
"false"))
3744 parse_warn(cfile,
"expecting true or false");
3750 parse_warn (cfile,
"expecting a constant value.");
3763 struct parse *cfile;
3766 struct pool *inpool;
3767 struct lease **lpchain;
3769 struct iaddr low, high, net;
3770 unsigned char addr [4];
3771 unsigned len =
sizeof addr;
3778 isc_result_t status;
3789 memcpy (low.
iabuf, addr, len);
3793 token =
peek_token (&val, (
unsigned *)0, cfile);
3800 memcpy (high.
iabuf, addr, len);
3804 token =
next_token (&val, (
unsigned *)0, cfile);
3805 if (token !=
SEMI) {
3823 parse_warn (cfile,
"address range not on network %s",
3825 log_error (
"Be sure to place pool statement after %s",
3826 "related subnet declarations.");
3832 struct pool *last = (
struct pool *)0;
3842 permit_dynamic_bootp_clients)) ||
3847 permit_all_clients))) {
3856 status = pool_allocate (&
pool,
MDL);
3857 if (status != ISC_R_SUCCESS)
3858 log_fatal (
"no memory for ad-hoc pool: %s",
3859 isc_result_totext (status));
3862 log_fatal (
"no memory for ad-hoc permit.");
3868 pool -> permit_list = p;
3871 pool -> prohibit_list = p;
3881 log_fatal (
"no memory for anon pool group.");
3885 pool_reference (&
pool, last,
MDL);
3891 pool_reference (&
pool, inpool,
MDL);
3894 #if defined (FAILOVER_PROTOCOL) 3898 parse_warn (cfile,
"dynamic-bootp flag is %s",
3899 "not permitted for address");
3900 log_error (
"range declarations where there is a failover");
3901 log_error (
"peer in scope. If you wish to declare an");
3902 log_error (
"address range from which dynamic bootp leases");
3903 log_error (
"can be allocated, please declare it within a");
3904 log_error (
"pool declaration that also contains the \"no");
3905 log_error (
"failover\" statement. The failover protocol");
3906 log_error (
"itself does not permit dynamic bootp - this");
3907 log_error (
"is not a limitation specific to the ISC DHCP");
3908 log_error (
"server. Please don't ask me to defend this");
3909 log_error (
"until you have read and really tried %s",
3911 log_error (
"the failover protocol specification.");
3921 pool_dereference (&
pool,
MDL);
3926 add_ipv6_pool_to_subnet(
struct subnet *
subnet, u_int16_t type,
3927 struct iaddr *lo_addr,
int bits,
int units,
3930 struct in6_addr tmp_in6_addr;
3937 if (lo_addr->
len !=
sizeof(tmp_in6_addr)) {
3938 log_fatal(
"Internal error: Attempt to add non-IPv6 address " 3939 "to IPv6 shared network.");
3941 memcpy(&tmp_in6_addr, lo_addr->
iabuf,
sizeof(tmp_in6_addr));
3958 pool->subnet = NULL;
3963 pool->ipv6_pond = NULL;
4011 if ((
units -
bits) > (
sizeof(isc_uint64_t) * 8)) {
4016 isc_uint64_t space_left
4021 if (addon > space_left) {
4058 add_ipv6_pond_to_network(
struct group *
group,
4061 struct ipv6_pond *pond = NULL, *last = NULL;
4063 isc_result_t status;
4080 if (status != ISC_R_SUCCESS)
4081 log_fatal (
"no memory for ad-hoc ipv6 pond: %s",
4082 isc_result_totext (status));
4085 log_fatal (
"no memory for ad-hoc ipv6 permit.");
4088 p->
type = permit_all_clients;
4101 log_fatal (
"no memory for anon pool group.");
4116 struct iaddr lo, hi;
4126 parse_warn(cfile,
"range6 statement is only supported " 4146 parse_warn(cfile,
"range6 start address is outside the subnet");
4154 memset(&net, 0,
sizeof(net));
4161 if (token ==
SLASH) {
4174 if ((bits < 0) || (bits > 128)) {
4175 parse_warn(cfile,
"networks have 0 to 128 bits");
4181 "network mask smaller than subnet mask");
4196 parse_warn(cfile,
"temporary mask too short");
4234 "range6 end address is outside the subnet");
4243 if (
range2cidr(&nets, &lo, &hi) != ISC_R_SUCCESS) {
4244 log_fatal(
"Error converting range to CIDR networks");
4255 if (inpond != NULL) {
4258 add_ipv6_pond_to_network(
group, &pond);
4262 for (p=nets; p != NULL; p=p->
next) {
4275 if (token !=
SEMI) {
4288 struct iaddr lo, hi;
4297 parse_warn(cfile,
"prefix6 statement is only supported " 4324 " is outside the subnet");
4344 " is outside the subnet");
4354 if (token !=
SLASH) {
4368 if ((bits <= 0) || (bits >= 128)) {
4369 parse_warn(cfile,
"networks have 0 to 128 bits (exclusive)");
4380 parse_warn(cfile,
"network mask smaller than subnet mask");
4393 if (token !=
SEMI) {
4403 if (
range2cidr(&nets, &lo, &hi) != ISC_R_SUCCESS) {
4404 log_fatal(
"Error converting prefix to CIDR");
4413 if (inpond != NULL) {
4416 add_ipv6_pond_to_network(
group, &pond);
4419 for (p = nets; p != NULL; p = p->
next) {
4452 while (*h != NULL) {
4472 if (token !=
SLASH) {
4488 if (token !=
SEMI) {
4501 parse_warn(cfile,
"networks have 0 to 128 bits");
4537 struct parse *cfile;
4545 int declaration = 0;
4546 isc_result_t status;
4550 if (status != ISC_R_SUCCESS)
4552 isc_result_totext (status));
4559 parse_warn(cfile,
"pool6s are only valid inside " 4560 "subnet statements.");
4633 for (; *p; p = &((*p)->next))
4640 parse_warn (cfile,
"Pool6 declaration with no %s.",
4641 "address range6 or prefix6");
4642 log_error (
"Pool6 declarations must always contain at least");
4643 log_error (
"one range6 or prefix6 statement.");
4661 struct parse *cfile;
4666 unsigned char rf = flag;
4675 token =
next_token (&val, (
unsigned *)0, cfile);
4710 parse_warn (cfile,
"expecting allow/deny key");
4718 log_fatal(
"Unable to find server option %u (%s:%d).",
4728 #if !defined(DHCPv6) 4733 struct ia_xx *ia = NULL;
4735 struct ia_xx *old_ia;
4744 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
4745 isc_boolean_t newbinding;
4753 parse_warn(cfile,
"IA_NA is only supported in DHCPv6 mode.");
4758 if (!parse_iaid_duid(cfile, &ia, &iaid,
MDL)) {
4766 parse_warn(cfile,
"corrupt lease file; expecting left brace");
4773 if (token ==
RBRACE)
break;
4775 if (token ==
CLTT) {
4782 "expecting IAADDR or right brace");
4789 "expecting IPv6 address");
4797 "expecting left brace");
4807 if (token ==
RBRACE)
break;
4816 "unexpected end of file");
4822 if (token !=
STATE) {
4856 if (token !=
SEMI) {
4873 prefer = atoi (val);
4882 if (token ==
SEMI) {
4886 "corrupt lease file; " 4887 "expecting semicolon.");
4910 if (token ==
SEMI) {
4914 "corrupt lease file; " 4915 "expecting semicolon.");
4927 if ((token !=
NAME) &&
4959 if (bnd->
name == NULL) {
4963 strcpy(bnd->
name, val);
4965 newbinding = ISC_TRUE;
4967 newbinding = ISC_FALSE;
4976 if (token !=
EQUAL) {
4982 if (!parse_binding_value(cfile, nv)) {
5042 "expecting ia_na contents, " 5051 "missing state in iaaddr");
5054 if (end_time == -1) {
5056 "missing end time in iaaddr");
5061 if (iasubopt_allocate(&iaaddr,
MDL) != ISC_R_SUCCESS) {
5066 iaaddr->
state = state;
5068 iaaddr->
valid = valid;
5072 if (scope != NULL) {
5084 (i < 2) &&
on_star[i] != NULL ;
5087 on_star[i]->data.on.statements) {
5093 on_star[i]->data.on.statements) {
5104 &iaaddr->
addr) != ISC_R_SUCCESS) {
5105 inet_ntop(AF_INET6, &iaaddr->
addr,
5106 addr_buf,
sizeof(addr_buf));
5107 log_error(
"No pool found for IA_NA address %s",
5115 iaaddr, ia) != ISC_R_SUCCESS) {
5116 inet_ntop(AF_INET6, &iaaddr->
addr,
5117 addr_buf,
sizeof(addr_buf));
5118 parse_warn(cfile,
"duplicate na lease for address %s",
5164 #if !defined(DHCPv6) 5169 struct ia_xx *ia = NULL;
5171 struct ia_xx *old_ia;
5180 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5181 isc_boolean_t newbinding;
5189 parse_warn(cfile,
"IA_TA is only supported in DHCPv6 mode.");
5194 if (!parse_iaid_duid(cfile, &ia, &iaid,
MDL)) {
5202 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5209 if (token ==
RBRACE)
break;
5211 if (token ==
CLTT) {
5218 "expecting IAADDR or right brace");
5225 "expecting IPv6 address");
5233 "expecting left brace");
5243 if (token ==
RBRACE)
break;
5252 "unexpected end of file");
5258 if (token !=
STATE) {
5292 if (token !=
SEMI) {
5309 prefer = atoi (val);
5318 if (token ==
SEMI) {
5322 "corrupt lease file; " 5323 "expecting semicolon.");
5346 if (token ==
SEMI) {
5350 "corrupt lease file; " 5351 "expecting semicolon.");
5363 if ((token !=
NAME) &&
5395 if (bnd->
name == NULL) {
5399 strcpy(bnd->
name, val);
5401 newbinding = ISC_TRUE;
5403 newbinding = ISC_FALSE;
5412 if (token !=
EQUAL) {
5418 if (!parse_binding_value(cfile, nv)) {
5478 "expecting ia_ta contents, " 5487 "missing state in iaaddr");
5490 if (end_time == -1) {
5492 "missing end time in iaaddr");
5497 if (iasubopt_allocate(&iaaddr,
MDL) != ISC_R_SUCCESS) {
5502 iaaddr->
state = state;
5504 iaaddr->
valid = valid;
5508 if (scope != NULL) {
5520 (i < 2) &&
on_star[i] != NULL ;
5523 on_star[i]->data.on.statements) {
5529 on_star[i]->data.on.statements) {
5540 &iaaddr->
addr) != ISC_R_SUCCESS) {
5541 inet_ntop(AF_INET6, &iaaddr->
addr,
5542 addr_buf,
sizeof(addr_buf));
5543 log_error(
"No pool found for IA_TA address %s",
5551 iaaddr, ia) != ISC_R_SUCCESS) {
5552 inet_ntop(AF_INET6, &iaaddr->
addr,
5553 addr_buf,
sizeof(addr_buf));
5554 parse_warn(cfile,
"duplicate ta lease for address %s",
5600 #if !defined(DHCPv6) 5605 struct ia_xx *ia = NULL;
5607 struct ia_xx *old_ia;
5617 char addr_buf[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
5618 isc_boolean_t newbinding;
5626 parse_warn(cfile,
"IA_PD is only supported in DHCPv6 mode.");
5631 if (!parse_iaid_duid(cfile, &ia, &iaid,
MDL)) {
5639 parse_warn(cfile,
"corrupt lease file; expecting left brace");
5646 if (token ==
RBRACE)
break;
5648 if (token ==
CLTT) {
5654 parse_warn(cfile,
"corrupt lease file; expecting " 5655 "IAPREFIX or right brace");
5662 "expecting IPv6 prefix");
5670 "expecting left brace");
5680 if (token ==
RBRACE)
break;
5689 "unexpected end of file");
5695 if (token !=
STATE) {
5729 if (token !=
SEMI) {
5746 prefer = atoi (val);
5755 if (token ==
SEMI) {
5759 "corrupt lease file; " 5760 "expecting semicolon.");
5783 if (token ==
SEMI) {
5787 "corrupt lease file; " 5788 "expecting semicolon.");
5800 if ((token !=
NAME) &&
5832 if (bnd->
name == NULL) {
5836 strcpy(bnd->
name, val);
5838 newbinding = ISC_TRUE;
5840 newbinding = ISC_FALSE;
5849 if (token !=
EQUAL) {
5855 if (!parse_binding_value(cfile, nv)) {
5915 "expecting ia_pd contents, " 5924 "missing state in iaprefix");
5927 if (end_time == -1) {
5929 "missing end time in iaprefix");
5934 if (iasubopt_allocate(&iapref,
MDL) != ISC_R_SUCCESS) {
5938 iapref->
plen = plen;
5939 iapref->
state = state;
5941 iapref->
valid = valid;
5945 if (scope != NULL) {
5957 (i < 2) &&
on_star[i] != NULL ;
5960 on_star[i]->data.on.statements) {
5966 on_star[i]->data.on.statements) {
5978 &iapref->
addr) != ISC_R_SUCCESS) ||
5980 inet_ntop(AF_INET6, &iapref->
addr,
5981 addr_buf,
sizeof(addr_buf));
5982 log_error(
"No pool found for prefix %s/%d", addr_buf,
5990 iapref, ia) != ISC_R_SUCCESS) {
5991 inet_ntop(AF_INET6, &iapref->
addr,
5992 addr_buf,
sizeof(addr_buf));
5993 parse_warn(cfile,
"duplicate pd lease for address %s",
6053 unsigned char bytes[128];
6063 memset(&duid, 0x0,
sizeof(duid));
6065 log_fatal(
"parse_server_duid: out of memory");
6068 memcpy(duid.buffer->data, bytes,
len);
6070 duid.data = duid.buffer->data;
6094 u_int32_t enterprise_number;
6121 parse_warn(cfile,
"enterprise number expected");
6125 enterprise_number = atoi(val);
6137 memset(&duid, 0,
sizeof(duid));
6138 duid.len = 2 + 4 +
len;
6140 log_fatal(
"Out of memory storing DUID");
6142 duid.data = (
unsigned char *)duid.buffer->data;
6144 putULong(duid.buffer->data + 2, enterprise_number);
6145 memcpy(duid.buffer->data + 6, val,
len);
6158 else if (token ==
LL) {
6181 memset(&ll_addr, 0,
sizeof(ll_addr));
6189 memset(&duid, 0,
sizeof(duid));
6190 duid.len = 2 + 2 + ll_addr.len;
6192 log_fatal(
"Out of memory storing DUID");
6194 duid.data = (
unsigned char *)duid.buffer->data;
6196 putUShort(duid.buffer->data + 2, ll_type);
6197 memcpy(duid.buffer->data + 4,
6198 ll_addr.data, ll_addr.len);
6213 else if (token ==
LLT) {
6243 llt_time = atoi(val);
6245 memset(&ll_addr, 0,
sizeof(ll_addr));
6253 memset(&duid, 0,
sizeof(duid));
6254 duid.len = 2 + 2 + 4 + ll_addr.len;
6256 log_fatal(
"Out of memory storing DUID");
6258 duid.data = (
unsigned char *)duid.buffer->data;
6260 putUShort(duid.buffer->data + 2, ll_type);
6261 putULong(duid.buffer->data + 4, llt_time);
6262 memcpy(duid.buffer->data + 8,
6263 ll_addr.data, ll_addr.len);
6280 else if (token ==
NUMBER) {
6281 duid_type_num = atoi(val);
6293 memset(&duid, 0,
sizeof(duid));
6296 log_fatal(
"Out of memory storing DUID");
6298 duid.data = (
unsigned char *)duid.buffer->data;
6299 putUShort(duid.buffer->data, duid_type_num);
6300 memcpy(duid.buffer->data + 2, val,
len);
6310 parse_warn(cfile,
"DUID type of LLT, EN, or LL expected");
6319 if (token !=
SEMI) {
6343 memcpy(&value, source, 4);
6347 "authoring-byte-order not in the lease file.\n" 6348 "Assuming file byte order matches this server.\n");
6353 value = (((value >> 24) & 0xff) |
6354 ((value << 8) & 0xff0000) |
6355 ((value >> 8) & 0xff00) |
6356 ((value << 24) & 0xff000000));
6377 parse_iaid_duid(
struct parse* cfile,
struct ia_xx** ia, u_int32_t *iaid,
6379 unsigned char bytes[132];
6383 log_error(
"parse_iaid_duid: ia ptr cannot be null");
6391 "iaid+ia_xx string too short");
6402 log_fatal(
"parse_iaid_duid:Out of memory.");
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)
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)
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
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)
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
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 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)
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)
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 * 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 parse_shared_net_declaration(struct parse *cfile, struct group *group)
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)
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)
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 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
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)
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 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)
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