1 %{
2 /*
3 * configlexer.lex - lexical analyzer for unbound config file
4 *
5 * Copyright (c) 2001-2006, NLnet Labs. All rights reserved
6 *
7 * See LICENSE for the license.
8 *
9 */
10 #include "config.h"
11
12 /* because flex keeps having sign-unsigned compare problems that are unfixed*/
13 #if defined(__clang__)||(defined(__GNUC__)&&((__GNUC__ >4)||(defined(__GNUC_MINOR__)&&(__GNUC__ ==4)&&(__GNUC_MINOR__ >=2))))
14 #pragma GCC diagnostic ignored "-Wsign-compare"
15 #endif
16
17 #include <ctype.h>
18 #include <strings.h>
19 #ifdef HAVE_GLOB_H
20 # include <glob.h>
21 #endif
22
23 #include "util/config_file.h"
24 #include "configparser.h"
25 void ub_c_error(const char *message);
26
27 #if 0
28 #define LEXOUT(s) printf s /* used ONLY when debugging */
29 #else
30 #define LEXOUT(s)
31 #endif
32
33 /** avoid warning in about fwrite return value */
34 #define ECHO ub_c_error_msg("syntax error at text: %s", ub_c_text)
35
36 /** A parser variable, this is a statement in the config file which is
37 * of the form variable: value1 value2 ... nargs is the number of values. */
38 #define YDVAR(nargs, var) \
39 num_args=(nargs); \
40 LEXOUT(("v(%s%d) ", ub_c_text, num_args)); \
41 if(num_args > 0) { BEGIN(val); } \
42 return (var);
43
44 struct inc_state {
45 char* filename;
46 int line;
47 YY_BUFFER_STATE buffer;
48 struct inc_state* next;
49 int inc_toplevel;
50 };
51 static struct inc_state* config_include_stack = NULL;
52 static int inc_depth = 0;
53 static int inc_prev = 0;
54 static int num_args = 0;
55 static int inc_toplevel = 0;
56
init_cfg_parse(void)57 void init_cfg_parse(void)
58 {
59 config_include_stack = NULL;
60 inc_depth = 0;
61 inc_prev = 0;
62 num_args = 0;
63 inc_toplevel = 0;
64 }
65
config_start_include(const char * filename,int toplevel)66 static void config_start_include(const char* filename, int toplevel)
67 {
68 FILE *input;
69 struct inc_state* s;
70 char* nm;
71 if(inc_depth+1 > 100000) {
72 ub_c_error_msg("too many include files");
73 return;
74 }
75 if(*filename == '\0') {
76 ub_c_error_msg("empty include file name");
77 return;
78 }
79 s = (struct inc_state*)malloc(sizeof(*s));
80 if(!s) {
81 ub_c_error_msg("include %s: malloc failure", filename);
82 return;
83 }
84 if(cfg_parser->chroot && strncmp(filename, cfg_parser->chroot,
85 strlen(cfg_parser->chroot)) == 0) {
86 filename += strlen(cfg_parser->chroot);
87 }
88 nm = strdup(filename);
89 if(!nm) {
90 ub_c_error_msg("include %s: strdup failure", filename);
91 free(s);
92 return;
93 }
94 input = fopen(filename, "r");
95 if(!input) {
96 ub_c_error_msg("cannot open include file '%s': %s",
97 filename, strerror(errno));
98 free(s);
99 free(nm);
100 return;
101 }
102 LEXOUT(("switch_to_include_file(%s)\n", filename));
103 inc_depth++;
104 s->filename = cfg_parser->filename;
105 s->line = cfg_parser->line;
106 s->buffer = YY_CURRENT_BUFFER;
107 s->inc_toplevel = inc_toplevel;
108 s->next = config_include_stack;
109 config_include_stack = s;
110 cfg_parser->filename = nm;
111 cfg_parser->line = 1;
112 inc_toplevel = toplevel;
113 yy_switch_to_buffer(yy_create_buffer(input, YY_BUF_SIZE));
114 }
115
config_start_include_glob(const char * filename,int toplevel)116 static void config_start_include_glob(const char* filename, int toplevel)
117 {
118
119 /* check for wildcards */
120 #ifdef HAVE_GLOB
121 glob_t g;
122 int i, r, flags;
123 if(!(!strchr(filename, '*') && !strchr(filename, '?') && !strchr(filename, '[') &&
124 !strchr(filename, '{') && !strchr(filename, '~'))) {
125 flags = 0
126 #ifdef GLOB_ERR
127 | GLOB_ERR
128 #endif
129 /* do not set GLOB_NOSORT so the results are sorted
130 and in a predictable order. */
131 #ifdef GLOB_BRACE
132 | GLOB_BRACE
133 #endif
134 #ifdef GLOB_TILDE
135 | GLOB_TILDE
136 #endif
137 ;
138 memset(&g, 0, sizeof(g));
139 if(cfg_parser->chroot && strncmp(filename, cfg_parser->chroot,
140 strlen(cfg_parser->chroot)) == 0) {
141 filename += strlen(cfg_parser->chroot);
142 }
143 r = glob(filename, flags, NULL, &g);
144 if(r) {
145 /* some error */
146 globfree(&g);
147 if(r == GLOB_NOMATCH)
148 return; /* no matches for pattern */
149 config_start_include(filename, toplevel); /* let original deal with it */
150 return;
151 }
152 /* process files found, if any */
153 for(i=(int)g.gl_pathc-1; i>=0; i--) {
154 config_start_include(g.gl_pathv[i], toplevel);
155 }
156 globfree(&g);
157 return;
158 }
159 #endif /* HAVE_GLOB */
160
161 config_start_include(filename, toplevel);
162 }
163
config_end_include(void)164 static void config_end_include(void)
165 {
166 struct inc_state* s = config_include_stack;
167 --inc_depth;
168 if(!s) return;
169 free(cfg_parser->filename);
170 cfg_parser->filename = s->filename;
171 cfg_parser->line = s->line;
172 yy_delete_buffer(YY_CURRENT_BUFFER);
173 yy_switch_to_buffer(s->buffer);
174 config_include_stack = s->next;
175 inc_toplevel = s->inc_toplevel;
176 free(s);
177 }
178
179 #ifndef yy_set_bol /* compat definition, for flex 2.4.6 */
180 #define yy_set_bol(at_bol) \
181 { \
182 if ( ! yy_current_buffer ) \
183 yy_current_buffer = yy_create_buffer( ub_c_in, YY_BUF_SIZE ); \
184 yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \
185 }
186 #endif
187
188 %}
189 %option noinput
190 %option nounput
191 %{
192 #ifndef YY_NO_UNPUT
193 #define YY_NO_UNPUT 1
194 #endif
195 #ifndef YY_NO_INPUT
196 #define YY_NO_INPUT 1
197 #endif
198 %}
199
200 SPACE [ \t]
201 LETTER [a-zA-Z]
202 UNQUOTEDLETTER [^\'\"\n\r \t\\]|\\.
203 UNQUOTEDLETTER_NOCOLON [^\:\'\"\n\r \t\\]|\\.
204 NEWLINE [\r\n]
205 COMMENT \#
206 COLON \:
207 DQANY [^\"\n\r\\]|\\.
208 SQANY [^\'\n\r\\]|\\.
209
210 %x quotedstring singlequotedstr include include_quoted val include_toplevel include_toplevel_quoted
211
212 %%
213 <INITIAL,val>{SPACE}* {
214 LEXOUT(("SP ")); /* ignore */ }
215 <INITIAL,val>{SPACE}*{COMMENT}.* {
216 /* note that flex makes the longest match and '.' is any but not nl */
217 LEXOUT(("comment(%s) ", ub_c_text)); /* ignore */ }
218 server{COLON} { YDVAR(0, VAR_SERVER) }
219 qname-minimisation{COLON} { YDVAR(1, VAR_QNAME_MINIMISATION) }
220 qname-minimisation-strict{COLON} { YDVAR(1, VAR_QNAME_MINIMISATION_STRICT) }
221 num-threads{COLON} { YDVAR(1, VAR_NUM_THREADS) }
222 verbosity{COLON} { YDVAR(1, VAR_VERBOSITY) }
223 port{COLON} { YDVAR(1, VAR_PORT) }
224 outgoing-range{COLON} { YDVAR(1, VAR_OUTGOING_RANGE) }
225 outgoing-port-permit{COLON} { YDVAR(1, VAR_OUTGOING_PORT_PERMIT) }
226 outgoing-port-avoid{COLON} { YDVAR(1, VAR_OUTGOING_PORT_AVOID) }
227 outgoing-num-tcp{COLON} { YDVAR(1, VAR_OUTGOING_NUM_TCP) }
228 incoming-num-tcp{COLON} { YDVAR(1, VAR_INCOMING_NUM_TCP) }
229 do-ip4{COLON} { YDVAR(1, VAR_DO_IP4) }
230 do-ip6{COLON} { YDVAR(1, VAR_DO_IP6) }
231 do-nat64{COLON} { YDVAR(1, VAR_DO_NAT64) }
232 prefer-ip4{COLON} { YDVAR(1, VAR_PREFER_IP4) }
233 prefer-ip6{COLON} { YDVAR(1, VAR_PREFER_IP6) }
234 do-udp{COLON} { YDVAR(1, VAR_DO_UDP) }
235 do-tcp{COLON} { YDVAR(1, VAR_DO_TCP) }
236 tcp-upstream{COLON} { YDVAR(1, VAR_TCP_UPSTREAM) }
237 tcp-mss{COLON} { YDVAR(1, VAR_TCP_MSS) }
238 outgoing-tcp-mss{COLON} { YDVAR(1, VAR_OUTGOING_TCP_MSS) }
239 tcp-idle-timeout{COLON} { YDVAR(1, VAR_TCP_IDLE_TIMEOUT) }
240 max-reuse-tcp-queries{COLON} { YDVAR(1, VAR_MAX_REUSE_TCP_QUERIES) }
241 tcp-reuse-timeout{COLON} { YDVAR(1, VAR_TCP_REUSE_TIMEOUT) }
242 tcp-auth-query-timeout{COLON} { YDVAR(1, VAR_TCP_AUTH_QUERY_TIMEOUT) }
243 edns-tcp-keepalive{COLON} { YDVAR(1, VAR_EDNS_TCP_KEEPALIVE) }
244 edns-tcp-keepalive-timeout{COLON} { YDVAR(1, VAR_EDNS_TCP_KEEPALIVE_TIMEOUT) }
245 sock-queue-timeout{COLON} { YDVAR(1, VAR_SOCK_QUEUE_TIMEOUT) }
246 ssl-upstream{COLON} { YDVAR(1, VAR_SSL_UPSTREAM) }
247 tls-upstream{COLON} { YDVAR(1, VAR_SSL_UPSTREAM) }
248 ssl-service-key{COLON} { YDVAR(1, VAR_SSL_SERVICE_KEY) }
249 tls-service-key{COLON} { YDVAR(1, VAR_SSL_SERVICE_KEY) }
250 ssl-service-pem{COLON} { YDVAR(1, VAR_SSL_SERVICE_PEM) }
251 tls-service-pem{COLON} { YDVAR(1, VAR_SSL_SERVICE_PEM) }
252 ssl-port{COLON} { YDVAR(1, VAR_SSL_PORT) }
253 tls-port{COLON} { YDVAR(1, VAR_SSL_PORT) }
254 ssl-cert-bundle{COLON} { YDVAR(1, VAR_TLS_CERT_BUNDLE) }
255 tls-cert-bundle{COLON} { YDVAR(1, VAR_TLS_CERT_BUNDLE) }
256 tls-win-cert{COLON} { YDVAR(1, VAR_TLS_WIN_CERT) }
257 tls-system-cert{COLON} { YDVAR(1, VAR_TLS_WIN_CERT) }
258 additional-ssl-port{COLON} { YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
259 additional-tls-port{COLON} { YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
260 tls-additional-ports{COLON} { YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
261 tls-additional-port{COLON} { YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
262 tls-session-ticket-keys{COLON} { YDVAR(1, VAR_TLS_SESSION_TICKET_KEYS) }
263 tls-ciphers{COLON} { YDVAR(1, VAR_TLS_CIPHERS) }
264 tls-ciphersuites{COLON} { YDVAR(1, VAR_TLS_CIPHERSUITES) }
265 tls-use-sni{COLON} { YDVAR(1, VAR_TLS_USE_SNI) }
266 https-port{COLON} { YDVAR(1, VAR_HTTPS_PORT) }
267 http-endpoint{COLON} { YDVAR(1, VAR_HTTP_ENDPOINT) }
268 http-max-streams{COLON} { YDVAR(1, VAR_HTTP_MAX_STREAMS) }
269 http-query-buffer-size{COLON} { YDVAR(1, VAR_HTTP_QUERY_BUFFER_SIZE) }
270 http-response-buffer-size{COLON} { YDVAR(1, VAR_HTTP_RESPONSE_BUFFER_SIZE) }
271 http-nodelay{COLON} { YDVAR(1, VAR_HTTP_NODELAY) }
272 http-notls-downstream{COLON} { YDVAR(1, VAR_HTTP_NOTLS_DOWNSTREAM) }
273 quic-port{COLON} { YDVAR(1, VAR_QUIC_PORT) }
274 quic-size{COLON} { YDVAR(1, VAR_QUIC_SIZE) }
275 use-systemd{COLON} { YDVAR(1, VAR_USE_SYSTEMD) }
276 do-daemonize{COLON} { YDVAR(1, VAR_DO_DAEMONIZE) }
277 interface{COLON} { YDVAR(1, VAR_INTERFACE) }
278 ip-address{COLON} { YDVAR(1, VAR_INTERFACE) }
279 outgoing-interface{COLON} { YDVAR(1, VAR_OUTGOING_INTERFACE) }
280 interface-automatic{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC) }
281 interface-automatic-ports{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC_PORTS) }
282 so-rcvbuf{COLON} { YDVAR(1, VAR_SO_RCVBUF) }
283 so-sndbuf{COLON} { YDVAR(1, VAR_SO_SNDBUF) }
284 so-reuseport{COLON} { YDVAR(1, VAR_SO_REUSEPORT) }
285 ip-transparent{COLON} { YDVAR(1, VAR_IP_TRANSPARENT) }
286 ip-freebind{COLON} { YDVAR(1, VAR_IP_FREEBIND) }
287 ip-dscp{COLON} { YDVAR(1, VAR_IP_DSCP) }
288 chroot{COLON} { YDVAR(1, VAR_CHROOT) }
289 username{COLON} { YDVAR(1, VAR_USERNAME) }
290 directory{COLON} { YDVAR(1, VAR_DIRECTORY) }
291 logfile{COLON} { YDVAR(1, VAR_LOGFILE) }
292 pidfile{COLON} { YDVAR(1, VAR_PIDFILE) }
293 root-hints{COLON} { YDVAR(1, VAR_ROOT_HINTS) }
294 stream-wait-size{COLON} { YDVAR(1, VAR_STREAM_WAIT_SIZE) }
295 edns-buffer-size{COLON} { YDVAR(1, VAR_EDNS_BUFFER_SIZE) }
296 msg-buffer-size{COLON} { YDVAR(1, VAR_MSG_BUFFER_SIZE) }
297 msg-cache-size{COLON} { YDVAR(1, VAR_MSG_CACHE_SIZE) }
298 msg-cache-slabs{COLON} { YDVAR(1, VAR_MSG_CACHE_SLABS) }
299 rrset-cache-size{COLON} { YDVAR(1, VAR_RRSET_CACHE_SIZE) }
300 rrset-cache-slabs{COLON} { YDVAR(1, VAR_RRSET_CACHE_SLABS) }
301 cache-max-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_TTL) }
302 cache-max-negative-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_NEGATIVE_TTL) }
303 cache-min-negative-ttl{COLON} { YDVAR(1, VAR_CACHE_MIN_NEGATIVE_TTL) }
304 cache-min-ttl{COLON} { YDVAR(1, VAR_CACHE_MIN_TTL) }
305 infra-host-ttl{COLON} { YDVAR(1, VAR_INFRA_HOST_TTL) }
306 infra-lame-ttl{COLON} { YDVAR(1, VAR_INFRA_LAME_TTL) }
307 infra-cache-slabs{COLON} { YDVAR(1, VAR_INFRA_CACHE_SLABS) }
308 infra-cache-numhosts{COLON} { YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
309 infra-cache-lame-size{COLON} { YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
310 infra-cache-min-rtt{COLON} { YDVAR(1, VAR_INFRA_CACHE_MIN_RTT) }
311 infra-cache-max-rtt{COLON} { YDVAR(1, VAR_INFRA_CACHE_MAX_RTT) }
312 infra-keep-probing{COLON} { YDVAR(1, VAR_INFRA_KEEP_PROBING) }
313 num-queries-per-thread{COLON} { YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
314 jostle-timeout{COLON} { YDVAR(1, VAR_JOSTLE_TIMEOUT) }
315 delay-close{COLON} { YDVAR(1, VAR_DELAY_CLOSE) }
316 udp-connect{COLON} { YDVAR(1, VAR_UDP_CONNECT) }
317 target-fetch-policy{COLON} { YDVAR(1, VAR_TARGET_FETCH_POLICY) }
318 harden-short-bufsize{COLON} { YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
319 harden-large-queries{COLON} { YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
320 harden-glue{COLON} { YDVAR(1, VAR_HARDEN_GLUE) }
321 harden-unverified-glue{COLON} { YDVAR(1, VAR_HARDEN_UNVERIFIED_GLUE) }
322 harden-dnssec-stripped{COLON} { YDVAR(1, VAR_HARDEN_DNSSEC_STRIPPED) }
323 harden-below-nxdomain{COLON} { YDVAR(1, VAR_HARDEN_BELOW_NXDOMAIN) }
324 harden-referral-path{COLON} { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
325 harden-algo-downgrade{COLON} { YDVAR(1, VAR_HARDEN_ALGO_DOWNGRADE) }
326 harden-unknown-additional{COLON} { YDVAR(1, VAR_HARDEN_UNKNOWN_ADDITIONAL) }
327 use-caps-for-id{COLON} { YDVAR(1, VAR_USE_CAPS_FOR_ID) }
328 caps-whitelist{COLON} { YDVAR(1, VAR_CAPS_WHITELIST) }
329 caps-exempt{COLON} { YDVAR(1, VAR_CAPS_WHITELIST) }
330 unwanted-reply-threshold{COLON} { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
331 private-address{COLON} { YDVAR(1, VAR_PRIVATE_ADDRESS) }
332 private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) }
333 prefetch-key{COLON} { YDVAR(1, VAR_PREFETCH_KEY) }
334 prefetch{COLON} { YDVAR(1, VAR_PREFETCH) }
335 deny-any{COLON} { YDVAR(1, VAR_DENY_ANY) }
336 stub-zone{COLON} { YDVAR(0, VAR_STUB_ZONE) }
337 name{COLON} { YDVAR(1, VAR_NAME) }
338 stub-addr{COLON} { YDVAR(1, VAR_STUB_ADDR) }
339 stub-host{COLON} { YDVAR(1, VAR_STUB_HOST) }
340 stub-prime{COLON} { YDVAR(1, VAR_STUB_PRIME) }
341 stub-first{COLON} { YDVAR(1, VAR_STUB_FIRST) }
342 stub-no-cache{COLON} { YDVAR(1, VAR_STUB_NO_CACHE) }
343 stub-ssl-upstream{COLON} { YDVAR(1, VAR_STUB_SSL_UPSTREAM) }
344 stub-tls-upstream{COLON} { YDVAR(1, VAR_STUB_SSL_UPSTREAM) }
345 stub-tcp-upstream{COLON} { YDVAR(1, VAR_STUB_TCP_UPSTREAM) }
346 forward-zone{COLON} { YDVAR(0, VAR_FORWARD_ZONE) }
347 forward-addr{COLON} { YDVAR(1, VAR_FORWARD_ADDR) }
348 forward-host{COLON} { YDVAR(1, VAR_FORWARD_HOST) }
349 forward-first{COLON} { YDVAR(1, VAR_FORWARD_FIRST) }
350 forward-no-cache{COLON} { YDVAR(1, VAR_FORWARD_NO_CACHE) }
351 forward-ssl-upstream{COLON} { YDVAR(1, VAR_FORWARD_SSL_UPSTREAM) }
352 forward-tls-upstream{COLON} { YDVAR(1, VAR_FORWARD_SSL_UPSTREAM) }
353 forward-tcp-upstream{COLON} { YDVAR(1, VAR_FORWARD_TCP_UPSTREAM) }
354 auth-zone{COLON} { YDVAR(0, VAR_AUTH_ZONE) }
355 rpz{COLON} { YDVAR(0, VAR_RPZ) }
356 tags{COLON} { YDVAR(1, VAR_TAGS) }
357 rpz-action-override{COLON} { YDVAR(1, VAR_RPZ_ACTION_OVERRIDE) }
358 rpz-cname-override{COLON} { YDVAR(1, VAR_RPZ_CNAME_OVERRIDE) }
359 rpz-log{COLON} { YDVAR(1, VAR_RPZ_LOG) }
360 rpz-log-name{COLON} { YDVAR(1, VAR_RPZ_LOG_NAME) }
361 rpz-signal-nxdomain-ra{COLON} { YDVAR(1, VAR_RPZ_SIGNAL_NXDOMAIN_RA) }
362 zonefile{COLON} { YDVAR(1, VAR_ZONEFILE) }
363 master{COLON} { YDVAR(1, VAR_MASTER) }
364 primary{COLON} { YDVAR(1, VAR_MASTER) }
365 url{COLON} { YDVAR(1, VAR_URL) }
366 allow-notify{COLON} { YDVAR(1, VAR_ALLOW_NOTIFY) }
367 for-downstream{COLON} { YDVAR(1, VAR_FOR_DOWNSTREAM) }
368 for-upstream{COLON} { YDVAR(1, VAR_FOR_UPSTREAM) }
369 fallback-enabled{COLON} { YDVAR(1, VAR_FALLBACK_ENABLED) }
370 view{COLON} { YDVAR(0, VAR_VIEW) }
371 view-first{COLON} { YDVAR(1, VAR_VIEW_FIRST) }
372 do-not-query-address{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
373 do-not-query-localhost{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
374 access-control{COLON} { YDVAR(2, VAR_ACCESS_CONTROL) }
375 interface-action{COLON} { YDVAR(2, VAR_INTERFACE_ACTION) }
376 send-client-subnet{COLON} { YDVAR(1, VAR_SEND_CLIENT_SUBNET) }
377 client-subnet-zone{COLON} { YDVAR(1, VAR_CLIENT_SUBNET_ZONE) }
378 client-subnet-always-forward{COLON} { YDVAR(1, VAR_CLIENT_SUBNET_ALWAYS_FORWARD) }
379 client-subnet-opcode{COLON} { YDVAR(1, VAR_CLIENT_SUBNET_OPCODE) }
380 max-client-subnet-ipv4{COLON} { YDVAR(1, VAR_MAX_CLIENT_SUBNET_IPV4) }
381 max-client-subnet-ipv6{COLON} { YDVAR(1, VAR_MAX_CLIENT_SUBNET_IPV6) }
382 min-client-subnet-ipv4{COLON} { YDVAR(1, VAR_MIN_CLIENT_SUBNET_IPV4) }
383 min-client-subnet-ipv6{COLON} { YDVAR(1, VAR_MIN_CLIENT_SUBNET_IPV6) }
384 max-ecs-tree-size-ipv4{COLON} { YDVAR(1, VAR_MAX_ECS_TREE_SIZE_IPV4) }
385 max-ecs-tree-size-ipv6{COLON} { YDVAR(1, VAR_MAX_ECS_TREE_SIZE_IPV6) }
386 hide-identity{COLON} { YDVAR(1, VAR_HIDE_IDENTITY) }
387 hide-version{COLON} { YDVAR(1, VAR_HIDE_VERSION) }
388 hide-trustanchor{COLON} { YDVAR(1, VAR_HIDE_TRUSTANCHOR) }
389 hide-http-user-agent{COLON} { YDVAR(1, VAR_HIDE_HTTP_USER_AGENT) }
390 identity{COLON} { YDVAR(1, VAR_IDENTITY) }
391 version{COLON} { YDVAR(1, VAR_VERSION) }
392 http-user-agent{COLON} { YDVAR(1, VAR_HTTP_USER_AGENT) }
393 module-config{COLON} { YDVAR(1, VAR_MODULE_CONF) }
394 dlv-anchor{COLON} { YDVAR(1, VAR_DLV_ANCHOR) }
395 dlv-anchor-file{COLON} { YDVAR(1, VAR_DLV_ANCHOR_FILE) }
396 trust-anchor-file{COLON} { YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
397 auto-trust-anchor-file{COLON} { YDVAR(1, VAR_AUTO_TRUST_ANCHOR_FILE) }
398 trusted-keys-file{COLON} { YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
399 trust-anchor{COLON} { YDVAR(1, VAR_TRUST_ANCHOR) }
400 trust-anchor-signaling{COLON} { YDVAR(1, VAR_TRUST_ANCHOR_SIGNALING) }
401 root-key-sentinel{COLON} { YDVAR(1, VAR_ROOT_KEY_SENTINEL) }
402 val-override-date{COLON} { YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
403 val-sig-skew-min{COLON} { YDVAR(1, VAR_VAL_SIG_SKEW_MIN) }
404 val-sig-skew-max{COLON} { YDVAR(1, VAR_VAL_SIG_SKEW_MAX) }
405 val-max-restart{COLON} { YDVAR(1, VAR_VAL_MAX_RESTART) }
406 val-bogus-ttl{COLON} { YDVAR(1, VAR_BOGUS_TTL) }
407 val-clean-additional{COLON} { YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
408 val-permissive-mode{COLON} { YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
409 aggressive-nsec{COLON} { YDVAR(1, VAR_AGGRESSIVE_NSEC) }
410 ignore-cd-flag{COLON} { YDVAR(1, VAR_IGNORE_CD_FLAG) }
411 disable-edns-do{COLON} { YDVAR(1, VAR_DISABLE_EDNS_DO) }
412 serve-expired{COLON} { YDVAR(1, VAR_SERVE_EXPIRED) }
413 serve-expired-ttl{COLON} { YDVAR(1, VAR_SERVE_EXPIRED_TTL) }
414 serve-expired-ttl-reset{COLON} { YDVAR(1, VAR_SERVE_EXPIRED_TTL_RESET) }
415 serve-expired-reply-ttl{COLON} { YDVAR(1, VAR_SERVE_EXPIRED_REPLY_TTL) }
416 serve-expired-client-timeout{COLON} { YDVAR(1, VAR_SERVE_EXPIRED_CLIENT_TIMEOUT) }
417 ede-serve-expired{COLON} { YDVAR(1, VAR_EDE_SERVE_EXPIRED) }
418 serve-original-ttl{COLON} { YDVAR(1, VAR_SERVE_ORIGINAL_TTL) }
419 fake-dsa{COLON} { YDVAR(1, VAR_FAKE_DSA) }
420 fake-sha1{COLON} { YDVAR(1, VAR_FAKE_SHA1) }
421 val-log-level{COLON} { YDVAR(1, VAR_VAL_LOG_LEVEL) }
422 key-cache-size{COLON} { YDVAR(1, VAR_KEY_CACHE_SIZE) }
423 key-cache-slabs{COLON} { YDVAR(1, VAR_KEY_CACHE_SLABS) }
424 neg-cache-size{COLON} { YDVAR(1, VAR_NEG_CACHE_SIZE) }
425 val-nsec3-keysize-iterations{COLON} {
426 YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
427 zonemd-permissive-mode{COLON} { YDVAR(1, VAR_ZONEMD_PERMISSIVE_MODE) }
428 zonemd-check{COLON} { YDVAR(1, VAR_ZONEMD_CHECK) }
429 zonemd-reject-absence{COLON} { YDVAR(1, VAR_ZONEMD_REJECT_ABSENCE) }
430 add-holddown{COLON} { YDVAR(1, VAR_ADD_HOLDDOWN) }
431 del-holddown{COLON} { YDVAR(1, VAR_DEL_HOLDDOWN) }
432 keep-missing{COLON} { YDVAR(1, VAR_KEEP_MISSING) }
433 permit-small-holddown{COLON} { YDVAR(1, VAR_PERMIT_SMALL_HOLDDOWN) }
434 use-syslog{COLON} { YDVAR(1, VAR_USE_SYSLOG) }
435 log-identity{COLON} { YDVAR(1, VAR_LOG_IDENTITY) }
436 log-time-ascii{COLON} { YDVAR(1, VAR_LOG_TIME_ASCII) }
437 log-time-iso{COLON} { YDVAR(1, VAR_LOG_TIME_ISO) }
438 log-queries{COLON} { YDVAR(1, VAR_LOG_QUERIES) }
439 log-replies{COLON} { YDVAR(1, VAR_LOG_REPLIES) }
440 log-tag-queryreply{COLON} { YDVAR(1, VAR_LOG_TAG_QUERYREPLY) }
441 log-local-actions{COLON} { YDVAR(1, VAR_LOG_LOCAL_ACTIONS) }
442 log-servfail{COLON} { YDVAR(1, VAR_LOG_SERVFAIL) }
443 log-destaddr{COLON} { YDVAR(1, VAR_LOG_DESTADDR) }
444 local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) }
445 local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) }
446 local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) }
447 unblock-lan-zones{COLON} { YDVAR(1, VAR_UNBLOCK_LAN_ZONES) }
448 insecure-lan-zones{COLON} { YDVAR(1, VAR_INSECURE_LAN_ZONES) }
449 statistics-interval{COLON} { YDVAR(1, VAR_STATISTICS_INTERVAL) }
450 statistics-cumulative{COLON} { YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
451 extended-statistics{COLON} { YDVAR(1, VAR_EXTENDED_STATISTICS) }
452 statistics-inhibit-zero{COLON} { YDVAR(1, VAR_STATISTICS_INHIBIT_ZERO) }
453 shm-enable{COLON} { YDVAR(1, VAR_SHM_ENABLE) }
454 shm-key{COLON} { YDVAR(1, VAR_SHM_KEY) }
455 remote-control{COLON} { YDVAR(0, VAR_REMOTE_CONTROL) }
456 control-enable{COLON} { YDVAR(1, VAR_CONTROL_ENABLE) }
457 control-interface{COLON} { YDVAR(1, VAR_CONTROL_INTERFACE) }
458 control-port{COLON} { YDVAR(1, VAR_CONTROL_PORT) }
459 control-use-cert{COLON} { YDVAR(1, VAR_CONTROL_USE_CERT) }
460 server-key-file{COLON} { YDVAR(1, VAR_SERVER_KEY_FILE) }
461 server-cert-file{COLON} { YDVAR(1, VAR_SERVER_CERT_FILE) }
462 control-key-file{COLON} { YDVAR(1, VAR_CONTROL_KEY_FILE) }
463 control-cert-file{COLON} { YDVAR(1, VAR_CONTROL_CERT_FILE) }
464 python-script{COLON} { YDVAR(1, VAR_PYTHON_SCRIPT) }
465 python{COLON} { YDVAR(0, VAR_PYTHON) }
466 dynlib-file{COLON} { YDVAR(1, VAR_DYNLIB_FILE) }
467 dynlib{COLON} { YDVAR(0, VAR_DYNLIB) }
468 domain-insecure{COLON} { YDVAR(1, VAR_DOMAIN_INSECURE) }
469 minimal-responses{COLON} { YDVAR(1, VAR_MINIMAL_RESPONSES) }
470 rrset-roundrobin{COLON} { YDVAR(1, VAR_RRSET_ROUNDROBIN) }
471 unknown-server-time-limit{COLON} { YDVAR(1, VAR_UNKNOWN_SERVER_TIME_LIMIT) }
472 discard-timeout{COLON} { YDVAR(1, VAR_DISCARD_TIMEOUT) }
473 wait-limit{COLON} { YDVAR(1, VAR_WAIT_LIMIT) }
474 wait-limit-cookie{COLON} { YDVAR(1, VAR_WAIT_LIMIT_COOKIE) }
475 wait-limit-netblock{COLON} { YDVAR(1, VAR_WAIT_LIMIT_NETBLOCK) }
476 wait-limit-cookie-netblock{COLON} { YDVAR(1, VAR_WAIT_LIMIT_COOKIE_NETBLOCK) }
477 max-udp-size{COLON} { YDVAR(1, VAR_MAX_UDP_SIZE) }
478 dns64-prefix{COLON} { YDVAR(1, VAR_DNS64_PREFIX) }
479 dns64-synthall{COLON} { YDVAR(1, VAR_DNS64_SYNTHALL) }
480 dns64-ignore-aaaa{COLON} { YDVAR(1, VAR_DNS64_IGNORE_AAAA) }
481 nat64-prefix{COLON} { YDVAR(1, VAR_NAT64_PREFIX) }
482 define-tag{COLON} { YDVAR(1, VAR_DEFINE_TAG) }
483 local-zone-tag{COLON} { YDVAR(2, VAR_LOCAL_ZONE_TAG) }
484 access-control-tag{COLON} { YDVAR(2, VAR_ACCESS_CONTROL_TAG) }
485 access-control-tag-action{COLON} { YDVAR(3, VAR_ACCESS_CONTROL_TAG_ACTION) }
486 access-control-tag-data{COLON} { YDVAR(3, VAR_ACCESS_CONTROL_TAG_DATA) }
487 access-control-view{COLON} { YDVAR(2, VAR_ACCESS_CONTROL_VIEW) }
488 interface-tag{COLON} { YDVAR(2, VAR_INTERFACE_TAG) }
489 interface-tag-action{COLON} { YDVAR(3, VAR_INTERFACE_TAG_ACTION) }
490 interface-tag-data{COLON} { YDVAR(3, VAR_INTERFACE_TAG_DATA) }
491 interface-view{COLON} { YDVAR(2, VAR_INTERFACE_VIEW) }
492 local-zone-override{COLON} { YDVAR(3, VAR_LOCAL_ZONE_OVERRIDE) }
493 dnstap{COLON} { YDVAR(0, VAR_DNSTAP) }
494 dnstap-enable{COLON} { YDVAR(1, VAR_DNSTAP_ENABLE) }
495 dnstap-bidirectional{COLON} { YDVAR(1, VAR_DNSTAP_BIDIRECTIONAL) }
496 dnstap-socket-path{COLON} { YDVAR(1, VAR_DNSTAP_SOCKET_PATH) }
497 dnstap-ip{COLON} { YDVAR(1, VAR_DNSTAP_IP) }
498 dnstap-tls{COLON} { YDVAR(1, VAR_DNSTAP_TLS) }
499 dnstap-tls-server-name{COLON} { YDVAR(1, VAR_DNSTAP_TLS_SERVER_NAME) }
500 dnstap-tls-cert-bundle{COLON} { YDVAR(1, VAR_DNSTAP_TLS_CERT_BUNDLE) }
501 dnstap-tls-client-key-file{COLON} {
502 YDVAR(1, VAR_DNSTAP_TLS_CLIENT_KEY_FILE) }
503 dnstap-tls-client-cert-file{COLON} {
504 YDVAR(1, VAR_DNSTAP_TLS_CLIENT_CERT_FILE) }
505 dnstap-send-identity{COLON} { YDVAR(1, VAR_DNSTAP_SEND_IDENTITY) }
506 dnstap-send-version{COLON} { YDVAR(1, VAR_DNSTAP_SEND_VERSION) }
507 dnstap-identity{COLON} { YDVAR(1, VAR_DNSTAP_IDENTITY) }
508 dnstap-version{COLON} { YDVAR(1, VAR_DNSTAP_VERSION) }
509 dnstap-log-resolver-query-messages{COLON} {
510 YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES) }
511 dnstap-log-resolver-response-messages{COLON} {
512 YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES) }
513 dnstap-log-client-query-messages{COLON} {
514 YDVAR(1, VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES) }
515 dnstap-log-client-response-messages{COLON} {
516 YDVAR(1, VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES) }
517 dnstap-log-forwarder-query-messages{COLON} {
518 YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES) }
519 dnstap-log-forwarder-response-messages{COLON} {
520 YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES) }
521 dnstap-sample-rate{COLON} { YDVAR(1, VAR_DNSTAP_SAMPLE_RATE) }
522 disable-dnssec-lame-check{COLON} { YDVAR(1, VAR_DISABLE_DNSSEC_LAME_CHECK) }
523 ip-ratelimit{COLON} { YDVAR(1, VAR_IP_RATELIMIT) }
524 ip-ratelimit-cookie{COLON} { YDVAR(1, VAR_IP_RATELIMIT_COOKIE) }
525 ratelimit{COLON} { YDVAR(1, VAR_RATELIMIT) }
526 ip-ratelimit-slabs{COLON} { YDVAR(1, VAR_IP_RATELIMIT_SLABS) }
527 ratelimit-slabs{COLON} { YDVAR(1, VAR_RATELIMIT_SLABS) }
528 ip-ratelimit-size{COLON} { YDVAR(1, VAR_IP_RATELIMIT_SIZE) }
529 ratelimit-size{COLON} { YDVAR(1, VAR_RATELIMIT_SIZE) }
530 ratelimit-for-domain{COLON} { YDVAR(2, VAR_RATELIMIT_FOR_DOMAIN) }
531 ratelimit-below-domain{COLON} { YDVAR(2, VAR_RATELIMIT_BELOW_DOMAIN) }
532 ip-ratelimit-factor{COLON} { YDVAR(1, VAR_IP_RATELIMIT_FACTOR) }
533 ratelimit-factor{COLON} { YDVAR(1, VAR_RATELIMIT_FACTOR) }
534 ip-ratelimit-backoff{COLON} { YDVAR(1, VAR_IP_RATELIMIT_BACKOFF) }
535 ratelimit-backoff{COLON} { YDVAR(1, VAR_RATELIMIT_BACKOFF) }
536 outbound-msg-retry{COLON} { YDVAR(1, VAR_OUTBOUND_MSG_RETRY) }
537 max-sent-count{COLON} { YDVAR(1, VAR_MAX_SENT_COUNT) }
538 max-query-restarts{COLON} { YDVAR(1, VAR_MAX_QUERY_RESTARTS) }
539 low-rtt{COLON} { YDVAR(1, VAR_LOW_RTT) }
540 fast-server-num{COLON} { YDVAR(1, VAR_FAST_SERVER_NUM) }
541 low-rtt-pct{COLON} { YDVAR(1, VAR_FAST_SERVER_PERMIL) }
542 low-rtt-permil{COLON} { YDVAR(1, VAR_FAST_SERVER_PERMIL) }
543 fast-server-permil{COLON} { YDVAR(1, VAR_FAST_SERVER_PERMIL) }
544 response-ip-tag{COLON} { YDVAR(2, VAR_RESPONSE_IP_TAG) }
545 response-ip{COLON} { YDVAR(2, VAR_RESPONSE_IP) }
546 response-ip-data{COLON} { YDVAR(2, VAR_RESPONSE_IP_DATA) }
547 dnscrypt{COLON} { YDVAR(0, VAR_DNSCRYPT) }
548 dnscrypt-enable{COLON} { YDVAR(1, VAR_DNSCRYPT_ENABLE) }
549 dnscrypt-port{COLON} { YDVAR(1, VAR_DNSCRYPT_PORT) }
550 dnscrypt-provider{COLON} { YDVAR(1, VAR_DNSCRYPT_PROVIDER) }
551 dnscrypt-secret-key{COLON} { YDVAR(1, VAR_DNSCRYPT_SECRET_KEY) }
552 dnscrypt-provider-cert{COLON} { YDVAR(1, VAR_DNSCRYPT_PROVIDER_CERT) }
553 dnscrypt-provider-cert-rotated{COLON} { YDVAR(1, VAR_DNSCRYPT_PROVIDER_CERT_ROTATED) }
554 dnscrypt-shared-secret-cache-size{COLON} {
555 YDVAR(1, VAR_DNSCRYPT_SHARED_SECRET_CACHE_SIZE) }
556 dnscrypt-shared-secret-cache-slabs{COLON} {
557 YDVAR(1, VAR_DNSCRYPT_SHARED_SECRET_CACHE_SLABS) }
558 dnscrypt-nonce-cache-size{COLON} { YDVAR(1, VAR_DNSCRYPT_NONCE_CACHE_SIZE) }
559 dnscrypt-nonce-cache-slabs{COLON} { YDVAR(1, VAR_DNSCRYPT_NONCE_CACHE_SLABS) }
560 pad-responses{COLON} { YDVAR(1, VAR_PAD_RESPONSES) }
561 pad-responses-block-size{COLON} { YDVAR(1, VAR_PAD_RESPONSES_BLOCK_SIZE) }
562 pad-queries{COLON} { YDVAR(1, VAR_PAD_QUERIES) }
563 pad-queries-block-size{COLON} { YDVAR(1, VAR_PAD_QUERIES_BLOCK_SIZE) }
564 ipsecmod-enabled{COLON} { YDVAR(1, VAR_IPSECMOD_ENABLED) }
565 ipsecmod-ignore-bogus{COLON} { YDVAR(1, VAR_IPSECMOD_IGNORE_BOGUS) }
566 ipsecmod-hook{COLON} { YDVAR(1, VAR_IPSECMOD_HOOK) }
567 ipsecmod-max-ttl{COLON} { YDVAR(1, VAR_IPSECMOD_MAX_TTL) }
568 ipsecmod-whitelist{COLON} { YDVAR(1, VAR_IPSECMOD_WHITELIST) }
569 ipsecmod-allow{COLON} { YDVAR(1, VAR_IPSECMOD_WHITELIST) }
570 ipsecmod-strict{COLON} { YDVAR(1, VAR_IPSECMOD_STRICT) }
571 cachedb{COLON} { YDVAR(0, VAR_CACHEDB) }
572 backend{COLON} { YDVAR(1, VAR_CACHEDB_BACKEND) }
573 secret-seed{COLON} { YDVAR(1, VAR_CACHEDB_SECRETSEED) }
574 cachedb-no-store{COLON} { YDVAR(1, VAR_CACHEDB_NO_STORE) }
575 cachedb-check-when-serve-expired{COLON} { YDVAR(1, VAR_CACHEDB_CHECK_WHEN_SERVE_EXPIRED) }
576 redis-server-host{COLON} { YDVAR(1, VAR_CACHEDB_REDISHOST) }
577 redis-server-port{COLON} { YDVAR(1, VAR_CACHEDB_REDISPORT) }
578 redis-server-path{COLON} { YDVAR(1, VAR_CACHEDB_REDISPATH) }
579 redis-server-password{COLON} { YDVAR(1, VAR_CACHEDB_REDISPASSWORD) }
580 redis-timeout{COLON} { YDVAR(1, VAR_CACHEDB_REDISTIMEOUT) }
581 redis-command-timeout{COLON} { YDVAR(1, VAR_CACHEDB_REDISCOMMANDTIMEOUT) }
582 redis-connect-timeout{COLON} { YDVAR(1, VAR_CACHEDB_REDISCONNECTTIMEOUT) }
583 redis-expire-records{COLON} { YDVAR(1, VAR_CACHEDB_REDISEXPIRERECORDS) }
584 redis-logical-db{COLON} { YDVAR(1, VAR_CACHEDB_REDISLOGICALDB) }
585 ipset{COLON} { YDVAR(0, VAR_IPSET) }
586 name-v4{COLON} { YDVAR(1, VAR_IPSET_NAME_V4) }
587 name-v6{COLON} { YDVAR(1, VAR_IPSET_NAME_V6) }
588 udp-upstream-without-downstream{COLON} { YDVAR(1, VAR_UDP_UPSTREAM_WITHOUT_DOWNSTREAM) }
589 tcp-connection-limit{COLON} { YDVAR(2, VAR_TCP_CONNECTION_LIMIT) }
590 answer-cookie{COLON} { YDVAR(1, VAR_ANSWER_COOKIE ) }
591 cookie-secret{COLON} { YDVAR(1, VAR_COOKIE_SECRET) }
592 cookie-secret-file{COLON} { YDVAR(1, VAR_COOKIE_SECRET_FILE) }
593 edns-client-string{COLON} { YDVAR(2, VAR_EDNS_CLIENT_STRING) }
594 edns-client-string-opcode{COLON} { YDVAR(1, VAR_EDNS_CLIENT_STRING_OPCODE) }
595 nsid{COLON} { YDVAR(1, VAR_NSID ) }
596 ede{COLON} { YDVAR(1, VAR_EDE ) }
597 proxy-protocol-port{COLON} { YDVAR(1, VAR_PROXY_PROTOCOL_PORT) }
598 iter-scrub-ns{COLON} { YDVAR(1, VAR_ITER_SCRUB_NS) }
599 iter-scrub-cname{COLON} { YDVAR(1, VAR_ITER_SCRUB_CNAME) }
600 max-global-quota{COLON} { YDVAR(1, VAR_MAX_GLOBAL_QUOTA) }
601 <INITIAL,val>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
602
603 /* Quoted strings. Strip leading and ending quotes */
604 <val>\" { BEGIN(quotedstring); LEXOUT(("QS ")); }
605 <quotedstring><<EOF>> {
606 ub_c_error("EOF inside quoted string");
607 if(--num_args == 0) { BEGIN(INITIAL); }
608 else { BEGIN(val); }
609 }
610 <quotedstring>{DQANY}* { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); }
611 <quotedstring>{NEWLINE} { ub_c_error("newline inside quoted string, no end \"");
612 cfg_parser->line++; BEGIN(INITIAL); }
613 <quotedstring>\" {
614 LEXOUT(("QE "));
615 if(--num_args == 0) { BEGIN(INITIAL); }
616 else { BEGIN(val); }
617 ub_c_text[ub_c_leng - 1] = '\0';
618 ub_c_lval.str = strdup(ub_c_text);
619 if(!ub_c_lval.str)
620 ub_c_error("out of memory");
621 return STRING_ARG;
622 }
623
624 /* Single Quoted strings. Strip leading and ending quotes */
625 <val>\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
626 <singlequotedstr><<EOF>> {
627 ub_c_error("EOF inside quoted string");
628 if(--num_args == 0) { BEGIN(INITIAL); }
629 else { BEGIN(val); }
630 }
631 <singlequotedstr>{SQANY}* { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); }
632 <singlequotedstr>{NEWLINE} { ub_c_error("newline inside quoted string, no end '");
633 cfg_parser->line++; BEGIN(INITIAL); }
634 <singlequotedstr>\' {
635 LEXOUT(("SQE "));
636 if(--num_args == 0) { BEGIN(INITIAL); }
637 else { BEGIN(val); }
638 ub_c_text[ub_c_leng - 1] = '\0';
639 ub_c_lval.str = strdup(ub_c_text);
640 if(!ub_c_lval.str)
641 ub_c_error("out of memory");
642 return STRING_ARG;
643 }
644
645 /* include: directive */
646 <INITIAL,val>include{COLON} {
647 LEXOUT(("v(%s) ", ub_c_text)); inc_prev = YYSTATE; BEGIN(include); }
648 <include><<EOF>> {
649 ub_c_error("EOF inside include directive");
650 BEGIN(inc_prev);
651 }
652 <include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ }
653 <include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
654 <include>\" { LEXOUT(("IQS ")); BEGIN(include_quoted); }
655 <include>{UNQUOTEDLETTER}* {
656 LEXOUT(("Iunquotedstr(%s) ", ub_c_text));
657 config_start_include_glob(ub_c_text, 0);
658 BEGIN(inc_prev);
659 }
660 <include_quoted><<EOF>> {
661 ub_c_error("EOF inside quoted string");
662 BEGIN(inc_prev);
663 }
664 <include_quoted>{DQANY}* { LEXOUT(("ISTR(%s) ", ub_c_text)); yymore(); }
665 <include_quoted>{NEWLINE} { ub_c_error("newline before \" in include name");
666 cfg_parser->line++; BEGIN(inc_prev); }
667 <include_quoted>\" {
668 LEXOUT(("IQE "));
669 ub_c_text[ub_c_leng - 1] = '\0';
670 config_start_include_glob(ub_c_text,0);
671 BEGIN(inc_prev);
672 }
673 <INITIAL,val><<EOF>> {
674 LEXOUT(("LEXEOF "));
675 yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
676 if (!config_include_stack) {
677 yyterminate();
678 } else {
679 fclose(yyin);
680 int prev_toplevel = inc_toplevel;
681 fclose(ub_c_in);
682 config_end_include();
683 if(prev_toplevel) return (VAR_FORCE_TOPLEVEL);
684 }
685 }
686
687 /* include-toplevel: directive */
688 <INITIAL,val>include-toplevel{COLON} {
689 LEXOUT(("v(%s) ", ub_c_text)); inc_prev = YYSTATE; BEGIN(include_toplevel);
690 }
691 <include_toplevel><<EOF>> {
692 ub_c_error("EOF inside include_toplevel directive");
693 BEGIN(inc_prev);
694 }
695 <include_toplevel>{SPACE}* { LEXOUT(("ITSP ")); /* ignore */ }
696 <include_toplevel>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
697 <include_toplevel>\" { LEXOUT(("ITQS ")); BEGIN(include_toplevel_quoted); }
698 <include_toplevel>{UNQUOTEDLETTER}* {
699 LEXOUT(("ITunquotedstr(%s) ", ub_c_text));
700 config_start_include_glob(ub_c_text, 1);
701 BEGIN(inc_prev);
702 return (VAR_FORCE_TOPLEVEL);
703 }
704 <include_toplevel_quoted><<EOF>> {
705 ub_c_error("EOF inside quoted string");
706 BEGIN(inc_prev);
707 }
708 <include_toplevel_quoted>{DQANY}* { LEXOUT(("ITSTR(%s) ", ub_c_text)); yymore(); }
709 <include_toplevel_quoted>{NEWLINE} {
710 ub_c_error("newline before \" in include name");
711 cfg_parser->line++; BEGIN(inc_prev);
712 }
713 <include_toplevel_quoted>\" {
714 LEXOUT(("ITQE "));
715 ub_c_text[yyleng - 1] = '\0';
716 config_start_include_glob(ub_c_text, 1);
717 BEGIN(inc_prev);
718 return (VAR_FORCE_TOPLEVEL);
719 }
720
721 <val>{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", ub_c_text));
722 if(--num_args == 0) { BEGIN(INITIAL); }
723 ub_c_lval.str = strdup(ub_c_text); return STRING_ARG; }
724
725 {UNQUOTEDLETTER_NOCOLON}* {
726 ub_c_error_msg("unknown keyword '%s'", ub_c_text);
727 }
728
729 <*>. {
730 ub_c_error_msg("stray '%s'", ub_c_text);
731 }
732
733 %%
734