33static void config_min_valid_lifetime(
struct element *,
struct parse *);
34static void config_def_valid_lifetime(
struct element *,
struct parse *);
35static void config_max_valid_lifetime(
struct element *,
struct parse *);
36static void config_file(
struct element *,
struct parse *);
37static void config_sname(
struct element *,
struct parse *);
38static void config_next_server(
struct element *,
struct parse *);
39static void config_vendor_option_space(
struct element *,
struct parse *);
40static void config_site_option_space(
struct element *,
struct parse *);
41static struct element *default_qualifying_suffix(
void);
42static void config_qualifying_suffix(
struct element *,
struct parse *);
43static void config_enable_updates(
struct element *,
struct parse *);
44static void config_ddns_update_style(
struct element *,
struct parse *);
45static void config_preferred_lifetime(
struct element *,
struct parse *);
46static void config_match_client_id(
struct element *,
struct parse *);
47static void config_echo_client_id(
struct element *,
struct parse *);
111 }
else if (token ==
LBRACE) {
117 }
else if (token ==
EOL) {
200 }
while (token ==
DOT);
219 unsigned char addr[4];
220 unsigned len =
sizeof(addr);
261 if ((h ==
NULL) || (h->h_addr_list[0] ==
NULL))
268 "/// %s resolves into multiple addresses",
293 unsigned char addr[4];
294 unsigned len =
sizeof(addr);
303is_hex_string(
const char *
s)
331 char v6[
sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
346 is_hex_string(val)) ||
437 if (!
ether || (hlen != 6)) {
439 cfile->issue_counter++;
466 unsigned *max,
int separator,
467 int base,
unsigned size)
471 unsigned char *
bufp = buf, *
s;
476 bufp = (
unsigned char *)
malloc(*max * size / 8);
489 if (token != separator) {
517 }
while (++count != *max);
528 int base,
unsigned size)
530 const unsigned char *ptr = (
const unsigned char *)
str;
562 tval = tval -
'a' + 10;
563 else if (tval >=
'A')
564 tval = tval -
'A' + 10;
565 else if (tval >=
'0')
571 "Bogus number %s: digit %d not in base %d",
573 val = val * base + tval;
577 max = (1 << (size - 1));
579 max = (1 << (size - 1)) + ((1 << (size - 1)) - 1);
584 "%s%lo exceeds max (%d) for precision.",
586 (
unsigned long)val, max);
590 "%s%lx exceeds max (%d) for precision.",
592 (
unsigned long)val, max);
596 "%s%lu exceeds max (%d) for precision.",
598 (
unsigned long)val, max);
606 *buf = -(
unsigned long)val;
616 "Unexpected integer size: %d\n", size);
632 "Unexpected integer size: %d\n", size);
657 "expecting identifier after option keyword.");
737 "/// option %s.%s redefinition",
804 cfile->issue_counter++;
817 "expecting number 1, 2, 4.");
843 cfile->issue_counter++;
889 "expecting a 10base number");
895 }
while (token !=
SEMI);
997 cfile->issue_counter++;
1009 if (token ==
ARRAY) {
1031 if (
saved->length > 0)
1036 "encapsulate must always be the last item.");
1049 cfile->issue_counter++;
1058 "only uniform array inside record.");
1067 cfile->issue_counter++;
1081 switch (
atoi(val)) {
1111 "%s bit precision is not supported.", val);
1126 type =
"ipv4-address";
1130 type =
"ipv6-address";
1146 "MUST NOT be compressed");
1172 "expecting option space identifier");
1205 if (token ==
COMMA) {
1211 "%s must be at end of record.",
1212 last ==
't' ?
"text" :
"string");
1226 "Arrays of encapsulations don't make sense.");
1248 "compatible with Kea");
1353 (*
fmt ==
'X') || (*
fmt ==
'u'))
1424 }
while (*
fmt !=
'\0');
1438 static unsigned char
1439 from64[] = {64, 64, 64, 64, 64, 64, 64, 64,
1440 64, 64, 64, 62, 64, 64, 64, 63,
1441 52, 53, 54, 55, 56, 57, 58, 59,
1442 60, 61, 64, 64, 64, 64, 64, 64,
1443 64, 0, 1, 2, 3, 4, 5, 6,
1444 7, 8, 9, 10, 11, 12, 13, 14,
1445 15, 16, 17, 18, 19, 20, 21, 22,
1446 23, 24, 25, 64, 64, 64, 64, 64,
1447 64, 26, 27, 28, 29, 30, 31, 32,
1448 33, 34, 35, 36, 37, 38, 39, 40,
1449 41, 42, 43, 44, 45, 46, 47, 48,
1450 49, 50, 51, 64, 64, 64, 64, 64};
1468 for (
i = 0; val[
i];
i++) {
1472 if (((val[
i] <
' ') || (val[
i] >
'z')) ||
1473 ((
from64[val[
i] -
' '] > 63) && (val[
i] !=
'='))) {
1617 else if (token ==
LOCAL)
1627 cfile->issue_counter++;
1646 cfile->issue_counter++;
1656 cfile->issue_counter++;
1743 "case statement in inappropriate scope.");
1751 "inappropriate scope.");
1755 cfile->issue_counter++;
1770 "%s can't be a variable name", val);
1773 cfile->issue_counter++;
1791 "expecting argument name");
1796 }
while (token ==
COMMA);
1817 mapSet(func, expr,
"body");
1826 "expecting '=' in %s statement.",
1827 flag ?
"define" :
"set");
1834 "expecting expression.");
1853 cfile->issue_counter++;
1869 "expecting data expression.");
1899 "expecting expression.");
1923 "expecting data expression.");
1938 cfile->issue_counter++;
1944 "yet log statements");
1959 else if (token ==
ERROR)
1963 else if (token ==
INFO)
2014 cfile->issue_counter++;
2025 if (
s->content[
s->length - 1] !=
'.')
2049 cfile->issue_counter++;
2117 mapSet(zone, values,
"primary");
2124 mapSet(zone, values,
"secondary");
2134 "expecting IP addr or "
2138 }
while (token ==
COMMA);
2147 mapSet(zone, values,
"primary6");
2154 mapSet(zone, values,
"secondary6");
2165 }
while (token ==
COMMA);
2223 cfile->issue_counter++;
2251 "expecting key algorithm name.");
2321 cfile->issue_counter++;
2341 }
while (token ==
OR);
2387 cfile->issue_counter++;
2403 "expecting data or numeric expression.");
2453 ?
"data" :
"numeric"));
2490 cfile->issue_counter++;
2532 if (token ==
ELSE) {
2541 "expecting if statement");
2545 }
else if (token !=
LBRACE)
2558 }
else if (token ==
ELSIF) {
2564 "expecting conditional.");
2619 "boolean value (true/false/on/off) expected");
2714 cfile->issue_counter++;
2732 cfile->issue_counter++;
2769 cfile->issue_counter++;
2777 cfile->issue_counter++;
2785 cfile->issue_counter++;
2793 cfile->issue_counter++;
2807 "expecting data expression.");
2813 if (token !=
COMMA) {
2823 "expecting numeric expression.");
2848 cfile->issue_counter++;
2890 cfile->issue_counter++;
2911 cfile->issue_counter++;
2920 cfile->issue_counter++;
2943 if (token ==
COMMA) {
2961 cfile->issue_counter++;
3009 cfile->issue_counter++;
3041 cfile->issue_counter++;
3055 }
while (token ==
COMMA);
3079 cfile->issue_counter++;
3084 "not supported by Kea");
3094 cfile->issue_counter++;
3102 cfile->issue_counter++;
3110 cfile->issue_counter++;
3118 cfile->issue_counter++;
3126 cfile->issue_counter++;
3134 cfile->issue_counter++;
3143 cfile->issue_counter++;
3151 cfile->issue_counter++;
3159 cfile->issue_counter++;
3194 cfile->issue_counter++;
3203 "expecting data expression.");
3214 switch (
atoi(val)) {
3240 cfile->issue_counter++;
3256 switch (
atoi(val)) {
3307#ifndef ISC_R_SUCCESS
3308#define ISC_R_SUCCESS 0
3317#ifndef DHCP_R_NOTAUTH
3318#define DHCP_R_NOTAUTH ((6 << 16) + 21)
3327#ifndef ISC_R_NOTIMPLEMENTED
3328#define ISC_R_NOTIMPLEMENTED 27
3337#ifndef DHCP_R_NOTZONE
3338#define DHCP_R_NOTZONE ((6 << 16) + 22)
3347#ifndef DHCP_R_NXDOMAIN
3348#define DHCP_R_NXDOMAIN ((6 << 16) + 15)
3357#ifndef DHCP_R_NXRRSET
3358#define DHCP_R_NXRRSET ((6 << 16) + 20)
3367#ifndef DHCP_R_REFUSED
3368#define DHCP_R_REFUSED ((6 << 16) + 17)
3377#ifndef DHCP_R_SERVFAIL
3378#define DHCP_R_SERVFAIL ((6 << 16) + 14)
3387#ifndef DHCP_R_YXDOMAIN
3388#define DHCP_R_YXDOMAIN ((6 << 16) + 18)
3397#ifndef DHCP_R_YXRRSET
3398#define DHCP_R_YXRRSET ((6 << 16) + 19)
3418#define S_REBOOTING 1
3428#define S_SELECTING 3
3438#define S_REQUESTING 4
3468#define S_REBINDING 7
3487 cfile->issue_counter++;
3499 cfile->issue_counter++;
3521 "\"foo.example.com\"");
3524 cfile->issue_counter++;
3536 cfile->issue_counter++;
3578 cfile->issue_counter++;
3586 cfile->issue_counter++;
3599 "expecting expression.");
3605 }
while (token ==
COMMA);
3639 "expecting right-hand side.");
3669 else if (token ==
EQUAL)
3767 "expecting a subexpression");
3807 "expecting data expression");
3819 "expecting boolean expressions");
3850 "expecting numeric expressions");
3911 for (
i = 0;
i < len;
i++) {
3912 if (val[
i] ==
',') {
3977 (*
fmt ==
'X') || (*
fmt ==
'u'))
4000 if ((*
fmt ==
'D') && (
fmt[1] ==
'c'))
4011 }
while (*
fmt !=
'\0');
4016 if (token ==
COMMA) {
4030 }
while (*
fmt ==
'a');
4038 "lowercase true or false");
4071 else if (*
fmt ==
'A')
4075 if ((*
fmt ==
'A') || (*
fmt ==
'a'))
4083 if (
fmt[1] ==
'o') {
4093 if (token ==
SEMI) {
4105 "malformed encapsulation "
4117 "malformed enumeration "
4124 else if (
fmt[1] !=
'o')
4128 }
while (*
fmt !=
'\0');
4130 if ((*
fmt ==
'A') || (*
fmt ==
'a')) {
4133 if (token ==
COMMA) {
4139 if ((*
fmt ==
'A') || (
fmt[1] ==
'\0'))
4147 }
while ((*
fmt ==
'A') || (*
fmt ==
'a'));
4156 "last type in the record to binary");
4161 cfile->issue_counter++;
4185 data =
mapGet(expr,
"data");
4195 data =
mapGet(expr,
"data");
4235 cfile->issue_counter++;
4241 msg =
makeString(-1,
"/// Kea does not support option data ");
4276 "to true when setting data "
4277 "for relevant options, cf Kea #250");
4289 "to true when setting data "
4290 "for relevant options, cf Kea #250");
4305 }
else if (token ==
EQUAL) {
4320 "expecting a data expression.");
4352 cfile->issue_counter++;
4413 "or hexadecimal data.");
4425 "or hexadecimal data.");
4540 "or hexadecimal data.");
4658 if (token ==
COMMA) {
4683 }
while (token ==
COMMA);
4728 else if (token ==
STRING)
4732 "or hexadecimal data.");
4838 struct comments *comments;
4853 cfile->issue_counter++;
4859 msg =
makeString(-1,
"/// Kea does not support option data ");
4897 }
else if (token ==
EQUAL) {
4909 "expecting a data expression.");
4912 mapSet(config, expr,
"value");
4948 config_def_valid_lifetime(config,
cfile);
4951 config_max_valid_lifetime(config,
cfile);
4954 config_min_valid_lifetime(config,
cfile);
4957 config_file(config,
cfile);
4960 config_sname(config,
cfile);
4963 config_next_server(config,
cfile);
4967 "here it is used as a config option");
4969 config_vendor_option_space(config,
cfile);
4972 config_site_option_space(config,
cfile);
4975 config_qualifying_suffix(config,
cfile);
4978 config_enable_updates(config,
cfile);
4981 config_ddns_update_style(config,
cfile);
4984 config_preferred_lifetime(config,
cfile);
4987 config_match_client_id(config,
cfile);
4990 config_echo_client_id(config,
cfile);
5010 for (scope =
cfile->stack_top; scope > 0; --scope) {
5011 int kind =
cfile->stack[scope]->kind;
5025 "unsupported scope");
5028 cfile->issue_counter++;
5033 "an internal pool scope");
5049 for (scope =
cfile->stack_top; scope > 0; --scope) {
5050 int kind =
cfile->stack[scope]->kind;
5064 "unsupported scope");
5067 cfile->issue_counter++;
5072 "an internal pool scope");
5088 for (scope =
cfile->stack_top; scope > 0; --scope) {
5089 int kind =
cfile->stack[scope]->kind;
5103 "unsupported scope");
5106 cfile->issue_counter++;
5111 "an internal pool scope");
5130 for (scope =
cfile->stack_top; scope > 0; --scope) {
5131 int kind =
cfile->stack[scope]->kind;
5146 "an unsupported scope");
5149 cfile->issue_counter++;
5167 for (scope =
cfile->stack_top; scope > 0; --scope) {
5168 int kind =
cfile->stack[scope]->kind;
5183 "an unsupported scope");
5186 cfile->issue_counter++;
5204 for (scope =
cfile->stack_top; scope > 0; --scope) {
5205 int kind =
cfile->stack[scope]->kind;
5219 "an internal unsupported scope");
5249 "vendor-option-space value is not a string");
5270 if ((code ==
NULL) ||
5325 msg =
makeString(-1,
"/// Please to move private (code 224..254)");
5334default_qualifying_suffix(
void)
5341 "domain-name option value)");
5358 for (scope =
cfile->stack_top; scope > 0; --scope)
5369 cfile->issue_counter++;
5393 for (scope =
cfile->stack_top; scope > 0; --scope)
5404 cfile->issue_counter++;
5416 qs = default_qualifying_suffix();
5441 for (scope =
cfile->stack_top; scope > 0; --scope)
5450 cfile->issue_counter++;
5454 for (scope =
cfile->stack_top; scope > 0; --scope)
5465 cfile->issue_counter++;
5479 qs = default_qualifying_suffix();
5502 for (scope =
cfile->stack_top; scope > 0; --scope) {
5503 int kind =
cfile->stack[scope]->kind;
5517 "unsupported scope");
5520 cfile->issue_counter++;
5525 "an internal pool scope");
5531 "current value...");
5561 for (scope =
cfile->stack_top; scope > 0; --scope) {
5562 int kind =
cfile->stack[scope]->kind;
5579 cfile->issue_counter++;
5584 "an internal pool scope");
5602 for (scope =
cfile->stack_top; scope > 0; --scope) {
5603 int kind =
cfile->stack[scope]->kind;
5613 cfile->issue_counter++;
5904#ifdef keep_expr_const_data_precedence
5964#ifndef keep_expr_const_data_precedence
5975 return op_val(
op1) - op_val(
op2);
6139 return op_val(op) - op_val(
expression(expr));
int parse_allow_deny(struct option_cache **oc, struct parse *cfile, int flag)
enum dhcp_token next_raw_token(const char **rval, unsigned *rlen, struct parse *cfile)
enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen, struct parse *cfile)
enum dhcp_token peek_token(const char **rval, unsigned *rlen, struct parse *cfile)
enum dhcp_token next_token(const char **rval, unsigned *rlen, struct parse *cfile)
isc_result_t save_parse_state(struct parse *cfile)
isc_result_t restore_parse_state(struct parse *cfile)
int parse_boolean(struct parse *cfile)
unsigned char * parse_numeric_aggregate(struct parse *cfile, unsigned char *buf, unsigned *max, int separator, int base, unsigned size)
int parse_string(struct parse *cfile, char **sptr, unsigned *lptr)
int parse_option_token(struct expression **rv, struct parse *cfile, const char **fmt, struct expression *expr, int uniform, int lookups)
int parse_boolean_expression(struct expression **expr, struct parse *cfile, int *lose)
void skip_to_semi(struct parse *cfile)
int parse_option_statement(struct executable_statement **result, struct parse *cfile, int lookups, struct option *option, enum statement_op op)
int parse_expression(struct expression **expr, struct parse *cfile, int *lose, enum expression_context context, struct expression **plhs, enum expr_op binop)
int parse_semi(struct parse *cfile)
int parse_key(struct parse *cfile)
int parse_switch_statement(struct executable_statement **result, struct parse *cfile, int *lose)
int parse_option_code_definition(struct parse *cfile, struct option *option)
int parse_ip6_addr(struct parse *cfile, struct iaddr *addr)
int parse_zone(struct dns_zone *zone, struct parse *cfile)
void skip_to_rbrace(struct parse *cfile, int brace_count)
int parse_if_statement(struct executable_statement **result, struct parse *cfile, int *lose)
int parse_numeric_expression(struct expression **expr, struct parse *cfile, int *lose)
int parse_data_expression(struct expression **expr, struct parse *cfile, int *lose)
void convert_num(struct parse *cfile, unsigned char *buf, const char *str, int base, unsigned size)
int parse_executable_statements(struct executable_statement **statements, struct parse *cfile, int *lose, enum expression_context case_context)
struct expression * parse_domain_list(struct parse *cfile, int compress)
int parse_non_binary(struct expression **expr, struct parse *cfile, int *lose, enum expression_context context)
int parse_base64(struct data_string *data, struct parse *cfile)
char * parse_host_name(struct parse *cfile)
int parse_ip_addr_or_hostname(struct expression **expr, struct parse *cfile, int uniform)
int parse_cshl(struct data_string *data, struct parse *cfile)
void parse_hardware_param(struct parse *cfile, struct hardware *hardware)
int parse_on_statement(struct executable_statement **result, struct parse *cfile, int *lose)
int parse_option_data(struct expression **expr, struct parse *cfile, int lookups, struct option *option)
void parse_option_space_decl(struct parse *cfile)
int parse_ip_addr(struct parse *cfile, struct iaddr *addr)
int parse_executable_statement(struct executable_statement **result, struct parse *cfile, int *lose, enum expression_context case_context)
int parse_case_statement(struct executable_statement **result, struct parse *cfile, int *lose, enum expression_context case_context)
isc_result_t parse_option_name(struct parse *cfile, int allocate, int *known, struct option **opt)
void putShort(unsigned char *, int32_t)
void putLong(unsigned char *, int32_t)
void putUShort(unsigned char *, u_int32_t)
void putULong(unsigned char *, u_int32_t)
void concatString(struct string *s, const struct string *a)
void listPush(struct element *l, struct element *e)
struct comment * createComment(const char *line)
void resetInt(struct element *e, int64_t i)
isc_boolean_t eqString(const struct string *s, const struct string *o)
struct string * makeString(int l, const char *s)
isc_boolean_t boolValue(const struct element *e)
struct element * createHexa(struct string *h)
struct element * createList(void)
struct element * createBool(isc_boolean_t b)
struct string * allocString(void)
size_t mapSize(const struct element *m)
void appendString(struct string *s, const char *a)
struct element * listGet(struct element *l, int i)
struct string * stringValue(struct element *e)
struct element * createNull(void)
isc_boolean_t mapContains(const struct element *m, const char *k)
struct string * quote(struct string *s)
struct string * hexaValue(struct element *s)
struct element * createInt(int64_t i)
void mapSet(struct element *m, struct element *e, const char *k)
size_t listSize(const struct element *l)
void resetString(struct element *e, const struct string *s)
struct element * createMap(void)
struct element * createString(const struct string *s)
void resetBy(struct element *e, struct element *o)
void mapRemove(struct element *m, const char *k)
struct element * mapGet(struct element *m, const char *k)
int64_t intValue(const struct element *e)
struct string * makeStringExt(int l, const char *s, char fmt)
#define TAILQ_INSERT_TAIL(head, elm)
#define TAILQ_FOREACH(var, head)
#define TAILQ_CONCAT(head1, head2)
#define TAILQ_EMPTY(head)
#define DHO_VIVSO_SUBOPTIONS
#define skip_token(a, b, c)
#define HARDWARE_ADDR_LEN
struct element * eval_data_expression(struct element *expr, isc_boolean_t *modifiedp)
#define ISC_R_NOTIMPLEMENTED
void parse_vendor_code_definition(struct parse *cfile, struct option *option)
struct string * escape_option_string(unsigned len, const char *val, isc_boolean_t *require_binary, isc_boolean_t *modified)
int expr_precedence(enum expr_op op, struct element *expr)
struct string * parse_ip6_addr_txt(struct parse *cfile)
isc_boolean_t parse_option_binary(struct element *expr, struct parse *cfile, struct option *option, isc_boolean_t ambiguous)
isc_boolean_t parse_config_statement(struct element *result, struct parse *cfile, struct option *option, enum statement_op op)
isc_boolean_t parse_config_data(struct element *expr, struct parse *cfile, struct option *option)
struct string * parse_hexa(struct parse *cfile)
struct string * parse_option_token_binary(struct parse *cfile, const char *fmt)
struct string * parse_option_textbin(struct parse *cfile, struct option *option)
struct string * convert_format(const char *fmt, isc_boolean_t *is_array, isc_boolean_t *encapsulate)
void parse_error(struct parse *cfile, const char *fmt,...)
struct option * option_lookup_code(const char *, unsigned)
void add_option_data(struct element *, struct element *)
struct option * option_lookup_name(const char *, const char *)
struct comments * get_config_comments(unsigned)
void push_option(struct option *)
@ supersede_option_statement
@ default_option_statement
@ prepend_option_statement
@ append_option_statement
struct space * space_lookup(const char *)
void push_space(struct space *)
enum option_status status
const struct space * space
enum option_status status
enum expression_context op_context(enum expr_op op)
int is_boolean_expression(struct expression *expr)
int is_numeric_expression(struct expression *expr)
int is_data_expression(struct expression *expr)
int op_precedence(enum expr_op op1, enum expr_op op2)
@ context_data_or_numeric
@ expr_variable_reference