xref: /freebsd/contrib/unbound/util/configlexer.lex (revision 058ac3e8063366dafa634d9107642e12b038bf09)
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 
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 
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 
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 
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 prefer-ip4{COLON}		{ YDVAR(1, VAR_PREFER_IP4) }
232 prefer-ip6{COLON}		{ YDVAR(1, VAR_PREFER_IP6) }
233 do-udp{COLON}			{ YDVAR(1, VAR_DO_UDP) }
234 do-tcp{COLON}			{ YDVAR(1, VAR_DO_TCP) }
235 tcp-upstream{COLON}		{ YDVAR(1, VAR_TCP_UPSTREAM) }
236 tcp-mss{COLON}			{ YDVAR(1, VAR_TCP_MSS) }
237 outgoing-tcp-mss{COLON}		{ YDVAR(1, VAR_OUTGOING_TCP_MSS) }
238 tcp-idle-timeout{COLON}		{ YDVAR(1, VAR_TCP_IDLE_TIMEOUT) }
239 max-reuse-tcp-queries{COLON}	{ YDVAR(1, VAR_MAX_REUSE_TCP_QUERIES) }
240 tcp-reuse-timeout{COLON}	{ YDVAR(1, VAR_TCP_REUSE_TIMEOUT) }
241 tcp-auth-query-timeout{COLON}	{ YDVAR(1, VAR_TCP_AUTH_QUERY_TIMEOUT) }
242 edns-tcp-keepalive{COLON}	{ YDVAR(1, VAR_EDNS_TCP_KEEPALIVE) }
243 edns-tcp-keepalive-timeout{COLON} { YDVAR(1, VAR_EDNS_TCP_KEEPALIVE_TIMEOUT) }
244 ssl-upstream{COLON}		{ YDVAR(1, VAR_SSL_UPSTREAM) }
245 tls-upstream{COLON}		{ YDVAR(1, VAR_SSL_UPSTREAM) }
246 ssl-service-key{COLON}		{ YDVAR(1, VAR_SSL_SERVICE_KEY) }
247 tls-service-key{COLON}		{ YDVAR(1, VAR_SSL_SERVICE_KEY) }
248 ssl-service-pem{COLON}		{ YDVAR(1, VAR_SSL_SERVICE_PEM) }
249 tls-service-pem{COLON}		{ YDVAR(1, VAR_SSL_SERVICE_PEM) }
250 ssl-port{COLON}			{ YDVAR(1, VAR_SSL_PORT) }
251 tls-port{COLON}			{ YDVAR(1, VAR_SSL_PORT) }
252 ssl-cert-bundle{COLON}		{ YDVAR(1, VAR_TLS_CERT_BUNDLE) }
253 tls-cert-bundle{COLON}		{ YDVAR(1, VAR_TLS_CERT_BUNDLE) }
254 tls-win-cert{COLON}		{ YDVAR(1, VAR_TLS_WIN_CERT) }
255 tls-system-cert{COLON}		{ YDVAR(1, VAR_TLS_WIN_CERT) }
256 additional-ssl-port{COLON}	{ YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
257 additional-tls-port{COLON}	{ YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
258 tls-additional-ports{COLON}	{ YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
259 tls-additional-port{COLON}	{ YDVAR(1, VAR_TLS_ADDITIONAL_PORT) }
260 tls-session-ticket-keys{COLON}	{ YDVAR(1, VAR_TLS_SESSION_TICKET_KEYS) }
261 tls-ciphers{COLON}		{ YDVAR(1, VAR_TLS_CIPHERS) }
262 tls-ciphersuites{COLON}		{ YDVAR(1, VAR_TLS_CIPHERSUITES) }
263 tls-use-sni{COLON}		{ YDVAR(1, VAR_TLS_USE_SNI) }
264 https-port{COLON}		{ YDVAR(1, VAR_HTTPS_PORT) }
265 http-endpoint{COLON}		{ YDVAR(1, VAR_HTTP_ENDPOINT) }
266 http-max-streams{COLON}		{ YDVAR(1, VAR_HTTP_MAX_STREAMS) }
267 http-query-buffer-size{COLON}	{ YDVAR(1, VAR_HTTP_QUERY_BUFFER_SIZE) }
268 http-response-buffer-size{COLON} { YDVAR(1, VAR_HTTP_RESPONSE_BUFFER_SIZE) }
269 http-nodelay{COLON}		{ YDVAR(1, VAR_HTTP_NODELAY) }
270 http-notls-downstream{COLON}	{ YDVAR(1, VAR_HTTP_NOTLS_DOWNSTREAM) }
271 use-systemd{COLON}		{ YDVAR(1, VAR_USE_SYSTEMD) }
272 do-daemonize{COLON}		{ YDVAR(1, VAR_DO_DAEMONIZE) }
273 interface{COLON}		{ YDVAR(1, VAR_INTERFACE) }
274 ip-address{COLON}		{ YDVAR(1, VAR_INTERFACE) }
275 outgoing-interface{COLON}	{ YDVAR(1, VAR_OUTGOING_INTERFACE) }
276 interface-automatic{COLON}	{ YDVAR(1, VAR_INTERFACE_AUTOMATIC) }
277 interface-automatic-ports{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC_PORTS) }
278 so-rcvbuf{COLON}		{ YDVAR(1, VAR_SO_RCVBUF) }
279 so-sndbuf{COLON}		{ YDVAR(1, VAR_SO_SNDBUF) }
280 so-reuseport{COLON}		{ YDVAR(1, VAR_SO_REUSEPORT) }
281 ip-transparent{COLON}		{ YDVAR(1, VAR_IP_TRANSPARENT) }
282 ip-freebind{COLON}		{ YDVAR(1, VAR_IP_FREEBIND) }
283 ip-dscp{COLON}		{ YDVAR(1, VAR_IP_DSCP) }
284 chroot{COLON}			{ YDVAR(1, VAR_CHROOT) }
285 username{COLON}			{ YDVAR(1, VAR_USERNAME) }
286 directory{COLON}		{ YDVAR(1, VAR_DIRECTORY) }
287 logfile{COLON}			{ YDVAR(1, VAR_LOGFILE) }
288 pidfile{COLON}			{ YDVAR(1, VAR_PIDFILE) }
289 root-hints{COLON}		{ YDVAR(1, VAR_ROOT_HINTS) }
290 stream-wait-size{COLON}		{ YDVAR(1, VAR_STREAM_WAIT_SIZE) }
291 edns-buffer-size{COLON}		{ YDVAR(1, VAR_EDNS_BUFFER_SIZE) }
292 msg-buffer-size{COLON}		{ YDVAR(1, VAR_MSG_BUFFER_SIZE) }
293 msg-cache-size{COLON}		{ YDVAR(1, VAR_MSG_CACHE_SIZE) }
294 msg-cache-slabs{COLON}		{ YDVAR(1, VAR_MSG_CACHE_SLABS) }
295 rrset-cache-size{COLON}		{ YDVAR(1, VAR_RRSET_CACHE_SIZE) }
296 rrset-cache-slabs{COLON}	{ YDVAR(1, VAR_RRSET_CACHE_SLABS) }
297 cache-max-ttl{COLON}     	{ YDVAR(1, VAR_CACHE_MAX_TTL) }
298 cache-max-negative-ttl{COLON}   { YDVAR(1, VAR_CACHE_MAX_NEGATIVE_TTL) }
299 cache-min-ttl{COLON}     	{ YDVAR(1, VAR_CACHE_MIN_TTL) }
300 infra-host-ttl{COLON}		{ YDVAR(1, VAR_INFRA_HOST_TTL) }
301 infra-lame-ttl{COLON}		{ YDVAR(1, VAR_INFRA_LAME_TTL) }
302 infra-cache-slabs{COLON}	{ YDVAR(1, VAR_INFRA_CACHE_SLABS) }
303 infra-cache-numhosts{COLON}	{ YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
304 infra-cache-lame-size{COLON}	{ YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
305 infra-cache-min-rtt{COLON}	{ YDVAR(1, VAR_INFRA_CACHE_MIN_RTT) }
306 infra-cache-max-rtt{COLON}	{ YDVAR(1, VAR_INFRA_CACHE_MAX_RTT) }
307 infra-keep-probing{COLON}	{ YDVAR(1, VAR_INFRA_KEEP_PROBING) }
308 num-queries-per-thread{COLON}	{ YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
309 jostle-timeout{COLON}		{ YDVAR(1, VAR_JOSTLE_TIMEOUT) }
310 delay-close{COLON}		{ YDVAR(1, VAR_DELAY_CLOSE) }
311 udp-connect{COLON}		{ YDVAR(1, VAR_UDP_CONNECT) }
312 target-fetch-policy{COLON}	{ YDVAR(1, VAR_TARGET_FETCH_POLICY) }
313 harden-short-bufsize{COLON}	{ YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
314 harden-large-queries{COLON}	{ YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
315 harden-glue{COLON}		{ YDVAR(1, VAR_HARDEN_GLUE) }
316 harden-dnssec-stripped{COLON}	{ YDVAR(1, VAR_HARDEN_DNSSEC_STRIPPED) }
317 harden-below-nxdomain{COLON}	{ YDVAR(1, VAR_HARDEN_BELOW_NXDOMAIN) }
318 harden-referral-path{COLON}	{ YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
319 harden-algo-downgrade{COLON}	{ YDVAR(1, VAR_HARDEN_ALGO_DOWNGRADE) }
320 use-caps-for-id{COLON}		{ YDVAR(1, VAR_USE_CAPS_FOR_ID) }
321 caps-whitelist{COLON}		{ YDVAR(1, VAR_CAPS_WHITELIST) }
322 caps-exempt{COLON}		{ YDVAR(1, VAR_CAPS_WHITELIST) }
323 unwanted-reply-threshold{COLON}	{ YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
324 private-address{COLON}		{ YDVAR(1, VAR_PRIVATE_ADDRESS) }
325 private-domain{COLON}		{ YDVAR(1, VAR_PRIVATE_DOMAIN) }
326 prefetch-key{COLON}		{ YDVAR(1, VAR_PREFETCH_KEY) }
327 prefetch{COLON}			{ YDVAR(1, VAR_PREFETCH) }
328 deny-any{COLON}			{ YDVAR(1, VAR_DENY_ANY) }
329 stub-zone{COLON}		{ YDVAR(0, VAR_STUB_ZONE) }
330 name{COLON}			{ YDVAR(1, VAR_NAME) }
331 stub-addr{COLON}		{ YDVAR(1, VAR_STUB_ADDR) }
332 stub-host{COLON}		{ YDVAR(1, VAR_STUB_HOST) }
333 stub-prime{COLON}		{ YDVAR(1, VAR_STUB_PRIME) }
334 stub-first{COLON}		{ YDVAR(1, VAR_STUB_FIRST) }
335 stub-no-cache{COLON}		{ YDVAR(1, VAR_STUB_NO_CACHE) }
336 stub-ssl-upstream{COLON}	{ YDVAR(1, VAR_STUB_SSL_UPSTREAM) }
337 stub-tls-upstream{COLON}	{ YDVAR(1, VAR_STUB_SSL_UPSTREAM) }
338 stub-tcp-upstream{COLON}	{ YDVAR(1, VAR_STUB_TCP_UPSTREAM) }
339 forward-zone{COLON}		{ YDVAR(0, VAR_FORWARD_ZONE) }
340 forward-addr{COLON}		{ YDVAR(1, VAR_FORWARD_ADDR) }
341 forward-host{COLON}		{ YDVAR(1, VAR_FORWARD_HOST) }
342 forward-first{COLON}		{ YDVAR(1, VAR_FORWARD_FIRST) }
343 forward-no-cache{COLON}		{ YDVAR(1, VAR_FORWARD_NO_CACHE) }
344 forward-ssl-upstream{COLON}	{ YDVAR(1, VAR_FORWARD_SSL_UPSTREAM) }
345 forward-tls-upstream{COLON}	{ YDVAR(1, VAR_FORWARD_SSL_UPSTREAM) }
346 forward-tcp-upstream{COLON}	{ YDVAR(1, VAR_FORWARD_TCP_UPSTREAM) }
347 auth-zone{COLON}		{ YDVAR(0, VAR_AUTH_ZONE) }
348 rpz{COLON}			{ YDVAR(0, VAR_RPZ) }
349 tags{COLON}			{ YDVAR(1, VAR_TAGS) }
350 rpz-action-override{COLON}	{ YDVAR(1, VAR_RPZ_ACTION_OVERRIDE) }
351 rpz-cname-override{COLON}	{ YDVAR(1, VAR_RPZ_CNAME_OVERRIDE) }
352 rpz-log{COLON}			{ YDVAR(1, VAR_RPZ_LOG) }
353 rpz-log-name{COLON}		{ YDVAR(1, VAR_RPZ_LOG_NAME) }
354 rpz-signal-nxdomain-ra{COLON}	{ YDVAR(1, VAR_RPZ_SIGNAL_NXDOMAIN_RA) }
355 zonefile{COLON}			{ YDVAR(1, VAR_ZONEFILE) }
356 master{COLON}			{ YDVAR(1, VAR_MASTER) }
357 primary{COLON}			{ YDVAR(1, VAR_MASTER) }
358 url{COLON}			{ YDVAR(1, VAR_URL) }
359 allow-notify{COLON}		{ YDVAR(1, VAR_ALLOW_NOTIFY) }
360 for-downstream{COLON}		{ YDVAR(1, VAR_FOR_DOWNSTREAM) }
361 for-upstream{COLON}		{ YDVAR(1, VAR_FOR_UPSTREAM) }
362 fallback-enabled{COLON}		{ YDVAR(1, VAR_FALLBACK_ENABLED) }
363 view{COLON}			{ YDVAR(0, VAR_VIEW) }
364 view-first{COLON}		{ YDVAR(1, VAR_VIEW_FIRST) }
365 do-not-query-address{COLON}	{ YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
366 do-not-query-localhost{COLON}	{ YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
367 access-control{COLON}		{ YDVAR(2, VAR_ACCESS_CONTROL) }
368 interface-action{COLON}		{ YDVAR(2, VAR_INTERFACE_ACTION) }
369 send-client-subnet{COLON}	{ YDVAR(1, VAR_SEND_CLIENT_SUBNET) }
370 client-subnet-zone{COLON}	{ YDVAR(1, VAR_CLIENT_SUBNET_ZONE) }
371 client-subnet-always-forward{COLON} { YDVAR(1, VAR_CLIENT_SUBNET_ALWAYS_FORWARD) }
372 client-subnet-opcode{COLON}	{ YDVAR(1, VAR_CLIENT_SUBNET_OPCODE) }
373 max-client-subnet-ipv4{COLON}	{ YDVAR(1, VAR_MAX_CLIENT_SUBNET_IPV4) }
374 max-client-subnet-ipv6{COLON}	{ YDVAR(1, VAR_MAX_CLIENT_SUBNET_IPV6) }
375 min-client-subnet-ipv4{COLON}	{ YDVAR(1, VAR_MIN_CLIENT_SUBNET_IPV4) }
376 min-client-subnet-ipv6{COLON}	{ YDVAR(1, VAR_MIN_CLIENT_SUBNET_IPV6) }
377 max-ecs-tree-size-ipv4{COLON}	{ YDVAR(1, VAR_MAX_ECS_TREE_SIZE_IPV4) }
378 max-ecs-tree-size-ipv6{COLON}	{ YDVAR(1, VAR_MAX_ECS_TREE_SIZE_IPV6) }
379 hide-identity{COLON}		{ YDVAR(1, VAR_HIDE_IDENTITY) }
380 hide-version{COLON}		{ YDVAR(1, VAR_HIDE_VERSION) }
381 hide-trustanchor{COLON}		{ YDVAR(1, VAR_HIDE_TRUSTANCHOR) }
382 hide-http-user-agent{COLON}		{ YDVAR(1, VAR_HIDE_HTTP_USER_AGENT) }
383 identity{COLON}			{ YDVAR(1, VAR_IDENTITY) }
384 version{COLON}			{ YDVAR(1, VAR_VERSION) }
385 http-user-agent{COLON}			{ YDVAR(1, VAR_HTTP_USER_AGENT) }
386 module-config{COLON}     	{ YDVAR(1, VAR_MODULE_CONF) }
387 dlv-anchor{COLON}		{ YDVAR(1, VAR_DLV_ANCHOR) }
388 dlv-anchor-file{COLON}		{ YDVAR(1, VAR_DLV_ANCHOR_FILE) }
389 trust-anchor-file{COLON}	{ YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
390 auto-trust-anchor-file{COLON}	{ YDVAR(1, VAR_AUTO_TRUST_ANCHOR_FILE) }
391 trusted-keys-file{COLON}	{ YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
392 trust-anchor{COLON}		{ YDVAR(1, VAR_TRUST_ANCHOR) }
393 trust-anchor-signaling{COLON}	{ YDVAR(1, VAR_TRUST_ANCHOR_SIGNALING) }
394 root-key-sentinel{COLON}	{ YDVAR(1, VAR_ROOT_KEY_SENTINEL) }
395 val-override-date{COLON}	{ YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
396 val-sig-skew-min{COLON}		{ YDVAR(1, VAR_VAL_SIG_SKEW_MIN) }
397 val-sig-skew-max{COLON}		{ YDVAR(1, VAR_VAL_SIG_SKEW_MAX) }
398 val-max-restart{COLON}		{ YDVAR(1, VAR_VAL_MAX_RESTART) }
399 val-bogus-ttl{COLON}		{ YDVAR(1, VAR_BOGUS_TTL) }
400 val-clean-additional{COLON}	{ YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
401 val-permissive-mode{COLON}	{ YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
402 aggressive-nsec{COLON}		{ YDVAR(1, VAR_AGGRESSIVE_NSEC) }
403 ignore-cd-flag{COLON}		{ YDVAR(1, VAR_IGNORE_CD_FLAG) }
404 serve-expired{COLON}		{ YDVAR(1, VAR_SERVE_EXPIRED) }
405 serve-expired-ttl{COLON}	{ YDVAR(1, VAR_SERVE_EXPIRED_TTL) }
406 serve-expired-ttl-reset{COLON}	{ YDVAR(1, VAR_SERVE_EXPIRED_TTL_RESET) }
407 serve-expired-reply-ttl{COLON}	{ YDVAR(1, VAR_SERVE_EXPIRED_REPLY_TTL) }
408 serve-expired-client-timeout{COLON}	{ YDVAR(1, VAR_SERVE_EXPIRED_CLIENT_TIMEOUT) }
409 ede-serve-expired{COLON}	{ YDVAR(1, VAR_EDE_SERVE_EXPIRED) }
410 serve-original-ttl{COLON}	{ YDVAR(1, VAR_SERVE_ORIGINAL_TTL) }
411 fake-dsa{COLON}			{ YDVAR(1, VAR_FAKE_DSA) }
412 fake-sha1{COLON}		{ YDVAR(1, VAR_FAKE_SHA1) }
413 val-log-level{COLON}		{ YDVAR(1, VAR_VAL_LOG_LEVEL) }
414 key-cache-size{COLON}		{ YDVAR(1, VAR_KEY_CACHE_SIZE) }
415 key-cache-slabs{COLON}		{ YDVAR(1, VAR_KEY_CACHE_SLABS) }
416 neg-cache-size{COLON}		{ YDVAR(1, VAR_NEG_CACHE_SIZE) }
417 val-nsec3-keysize-iterations{COLON}	{
418 				  YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
419 zonemd-permissive-mode{COLON}	{ YDVAR(1, VAR_ZONEMD_PERMISSIVE_MODE) }
420 zonemd-check{COLON}		{ YDVAR(1, VAR_ZONEMD_CHECK) }
421 zonemd-reject-absence{COLON}	{ YDVAR(1, VAR_ZONEMD_REJECT_ABSENCE) }
422 add-holddown{COLON}		{ YDVAR(1, VAR_ADD_HOLDDOWN) }
423 del-holddown{COLON}		{ YDVAR(1, VAR_DEL_HOLDDOWN) }
424 keep-missing{COLON}		{ YDVAR(1, VAR_KEEP_MISSING) }
425 permit-small-holddown{COLON}	{ YDVAR(1, VAR_PERMIT_SMALL_HOLDDOWN) }
426 use-syslog{COLON}		{ YDVAR(1, VAR_USE_SYSLOG) }
427 log-identity{COLON}		{ YDVAR(1, VAR_LOG_IDENTITY) }
428 log-time-ascii{COLON}		{ YDVAR(1, VAR_LOG_TIME_ASCII) }
429 log-queries{COLON}		{ YDVAR(1, VAR_LOG_QUERIES) }
430 log-replies{COLON}		{ YDVAR(1, VAR_LOG_REPLIES) }
431 log-tag-queryreply{COLON}	{ YDVAR(1, VAR_LOG_TAG_QUERYREPLY) }
432 log-local-actions{COLON}       { YDVAR(1, VAR_LOG_LOCAL_ACTIONS) }
433 log-servfail{COLON}		{ YDVAR(1, VAR_LOG_SERVFAIL) }
434 local-zone{COLON}		{ YDVAR(2, VAR_LOCAL_ZONE) }
435 local-data{COLON}		{ YDVAR(1, VAR_LOCAL_DATA) }
436 local-data-ptr{COLON}		{ YDVAR(1, VAR_LOCAL_DATA_PTR) }
437 unblock-lan-zones{COLON}	{ YDVAR(1, VAR_UNBLOCK_LAN_ZONES) }
438 insecure-lan-zones{COLON}	{ YDVAR(1, VAR_INSECURE_LAN_ZONES) }
439 statistics-interval{COLON}	{ YDVAR(1, VAR_STATISTICS_INTERVAL) }
440 statistics-cumulative{COLON}	{ YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
441 extended-statistics{COLON}	{ YDVAR(1, VAR_EXTENDED_STATISTICS) }
442 shm-enable{COLON}		{ YDVAR(1, VAR_SHM_ENABLE) }
443 shm-key{COLON}			{ YDVAR(1, VAR_SHM_KEY) }
444 remote-control{COLON}		{ YDVAR(0, VAR_REMOTE_CONTROL) }
445 control-enable{COLON}		{ YDVAR(1, VAR_CONTROL_ENABLE) }
446 control-interface{COLON}	{ YDVAR(1, VAR_CONTROL_INTERFACE) }
447 control-port{COLON}		{ YDVAR(1, VAR_CONTROL_PORT) }
448 control-use-cert{COLON}		{ YDVAR(1, VAR_CONTROL_USE_CERT) }
449 server-key-file{COLON}		{ YDVAR(1, VAR_SERVER_KEY_FILE) }
450 server-cert-file{COLON}		{ YDVAR(1, VAR_SERVER_CERT_FILE) }
451 control-key-file{COLON}		{ YDVAR(1, VAR_CONTROL_KEY_FILE) }
452 control-cert-file{COLON}	{ YDVAR(1, VAR_CONTROL_CERT_FILE) }
453 python-script{COLON}		{ YDVAR(1, VAR_PYTHON_SCRIPT) }
454 python{COLON}			{ YDVAR(0, VAR_PYTHON) }
455 dynlib-file{COLON}		{ YDVAR(1, VAR_DYNLIB_FILE) }
456 dynlib{COLON}			{ YDVAR(0, VAR_DYNLIB) }
457 domain-insecure{COLON}		{ YDVAR(1, VAR_DOMAIN_INSECURE) }
458 minimal-responses{COLON}	{ YDVAR(1, VAR_MINIMAL_RESPONSES) }
459 rrset-roundrobin{COLON}		{ YDVAR(1, VAR_RRSET_ROUNDROBIN) }
460 unknown-server-time-limit{COLON} { YDVAR(1, VAR_UNKNOWN_SERVER_TIME_LIMIT) }
461 max-udp-size{COLON}		{ YDVAR(1, VAR_MAX_UDP_SIZE) }
462 dns64-prefix{COLON}		{ YDVAR(1, VAR_DNS64_PREFIX) }
463 dns64-synthall{COLON}		{ YDVAR(1, VAR_DNS64_SYNTHALL) }
464 dns64-ignore-aaaa{COLON}	{ YDVAR(1, VAR_DNS64_IGNORE_AAAA) }
465 define-tag{COLON}		{ YDVAR(1, VAR_DEFINE_TAG) }
466 local-zone-tag{COLON}		{ YDVAR(2, VAR_LOCAL_ZONE_TAG) }
467 access-control-tag{COLON}	{ YDVAR(2, VAR_ACCESS_CONTROL_TAG) }
468 access-control-tag-action{COLON} { YDVAR(3, VAR_ACCESS_CONTROL_TAG_ACTION) }
469 access-control-tag-data{COLON}	{ YDVAR(3, VAR_ACCESS_CONTROL_TAG_DATA) }
470 access-control-view{COLON}	{ YDVAR(2, VAR_ACCESS_CONTROL_VIEW) }
471 interface-tag{COLON}		{ YDVAR(2, VAR_INTERFACE_TAG) }
472 interface-tag-action{COLON}	{ YDVAR(3, VAR_INTERFACE_TAG_ACTION) }
473 interface-tag-data{COLON}	{ YDVAR(3, VAR_INTERFACE_TAG_DATA) }
474 interface-view{COLON}		{ YDVAR(2, VAR_INTERFACE_VIEW) }
475 local-zone-override{COLON}	{ YDVAR(3, VAR_LOCAL_ZONE_OVERRIDE) }
476 dnstap{COLON}			{ YDVAR(0, VAR_DNSTAP) }
477 dnstap-enable{COLON}		{ YDVAR(1, VAR_DNSTAP_ENABLE) }
478 dnstap-bidirectional{COLON}	{ YDVAR(1, VAR_DNSTAP_BIDIRECTIONAL) }
479 dnstap-socket-path{COLON}	{ YDVAR(1, VAR_DNSTAP_SOCKET_PATH) }
480 dnstap-ip{COLON}		{ YDVAR(1, VAR_DNSTAP_IP) }
481 dnstap-tls{COLON}		{ YDVAR(1, VAR_DNSTAP_TLS) }
482 dnstap-tls-server-name{COLON}	{ YDVAR(1, VAR_DNSTAP_TLS_SERVER_NAME) }
483 dnstap-tls-cert-bundle{COLON}	{ YDVAR(1, VAR_DNSTAP_TLS_CERT_BUNDLE) }
484 dnstap-tls-client-key-file{COLON}	{
485 		YDVAR(1, VAR_DNSTAP_TLS_CLIENT_KEY_FILE) }
486 dnstap-tls-client-cert-file{COLON}	{
487 		YDVAR(1, VAR_DNSTAP_TLS_CLIENT_CERT_FILE) }
488 dnstap-send-identity{COLON}	{ YDVAR(1, VAR_DNSTAP_SEND_IDENTITY) }
489 dnstap-send-version{COLON}	{ YDVAR(1, VAR_DNSTAP_SEND_VERSION) }
490 dnstap-identity{COLON}		{ YDVAR(1, VAR_DNSTAP_IDENTITY) }
491 dnstap-version{COLON}		{ YDVAR(1, VAR_DNSTAP_VERSION) }
492 dnstap-log-resolver-query-messages{COLON}	{
493 		YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES) }
494 dnstap-log-resolver-response-messages{COLON}	{
495 		YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES) }
496 dnstap-log-client-query-messages{COLON}		{
497 		YDVAR(1, VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES) }
498 dnstap-log-client-response-messages{COLON}	{
499 		YDVAR(1, VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES) }
500 dnstap-log-forwarder-query-messages{COLON}	{
501 		YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES) }
502 dnstap-log-forwarder-response-messages{COLON}	{
503 		YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES) }
504 disable-dnssec-lame-check{COLON} { YDVAR(1, VAR_DISABLE_DNSSEC_LAME_CHECK) }
505 ip-ratelimit{COLON}		{ YDVAR(1, VAR_IP_RATELIMIT) }
506 ratelimit{COLON}		{ YDVAR(1, VAR_RATELIMIT) }
507 ip-ratelimit-slabs{COLON}		{ YDVAR(1, VAR_IP_RATELIMIT_SLABS) }
508 ratelimit-slabs{COLON}		{ YDVAR(1, VAR_RATELIMIT_SLABS) }
509 ip-ratelimit-size{COLON}		{ YDVAR(1, VAR_IP_RATELIMIT_SIZE) }
510 ratelimit-size{COLON}		{ YDVAR(1, VAR_RATELIMIT_SIZE) }
511 ratelimit-for-domain{COLON}	{ YDVAR(2, VAR_RATELIMIT_FOR_DOMAIN) }
512 ratelimit-below-domain{COLON}	{ YDVAR(2, VAR_RATELIMIT_BELOW_DOMAIN) }
513 ip-ratelimit-factor{COLON}		{ YDVAR(1, VAR_IP_RATELIMIT_FACTOR) }
514 ratelimit-factor{COLON}		{ YDVAR(1, VAR_RATELIMIT_FACTOR) }
515 ip-ratelimit-backoff{COLON}		{ YDVAR(1, VAR_IP_RATELIMIT_BACKOFF) }
516 ratelimit-backoff{COLON}		{ YDVAR(1, VAR_RATELIMIT_BACKOFF) }
517 outbound-msg-retry{COLON}		{ YDVAR(1, VAR_OUTBOUND_MSG_RETRY) }
518 low-rtt{COLON}			{ YDVAR(1, VAR_LOW_RTT) }
519 fast-server-num{COLON}		{ YDVAR(1, VAR_FAST_SERVER_NUM) }
520 low-rtt-pct{COLON}		{ YDVAR(1, VAR_FAST_SERVER_PERMIL) }
521 low-rtt-permil{COLON}		{ YDVAR(1, VAR_FAST_SERVER_PERMIL) }
522 fast-server-permil{COLON}	{ YDVAR(1, VAR_FAST_SERVER_PERMIL) }
523 response-ip-tag{COLON}		{ YDVAR(2, VAR_RESPONSE_IP_TAG) }
524 response-ip{COLON}		{ YDVAR(2, VAR_RESPONSE_IP) }
525 response-ip-data{COLON}		{ YDVAR(2, VAR_RESPONSE_IP_DATA) }
526 dnscrypt{COLON}			{ YDVAR(0, VAR_DNSCRYPT) }
527 dnscrypt-enable{COLON}		{ YDVAR(1, VAR_DNSCRYPT_ENABLE) }
528 dnscrypt-port{COLON}		{ YDVAR(1, VAR_DNSCRYPT_PORT) }
529 dnscrypt-provider{COLON}	{ YDVAR(1, VAR_DNSCRYPT_PROVIDER) }
530 dnscrypt-secret-key{COLON}	{ YDVAR(1, VAR_DNSCRYPT_SECRET_KEY) }
531 dnscrypt-provider-cert{COLON}	{ YDVAR(1, VAR_DNSCRYPT_PROVIDER_CERT) }
532 dnscrypt-provider-cert-rotated{COLON}	{ YDVAR(1, VAR_DNSCRYPT_PROVIDER_CERT_ROTATED) }
533 dnscrypt-shared-secret-cache-size{COLON}	{
534 		YDVAR(1, VAR_DNSCRYPT_SHARED_SECRET_CACHE_SIZE) }
535 dnscrypt-shared-secret-cache-slabs{COLON}	{
536 		YDVAR(1, VAR_DNSCRYPT_SHARED_SECRET_CACHE_SLABS) }
537 dnscrypt-nonce-cache-size{COLON}	{ YDVAR(1, VAR_DNSCRYPT_NONCE_CACHE_SIZE) }
538 dnscrypt-nonce-cache-slabs{COLON}	{ YDVAR(1, VAR_DNSCRYPT_NONCE_CACHE_SLABS) }
539 pad-responses{COLON}		{ YDVAR(1, VAR_PAD_RESPONSES) }
540 pad-responses-block-size{COLON}	{ YDVAR(1, VAR_PAD_RESPONSES_BLOCK_SIZE) }
541 pad-queries{COLON}		{ YDVAR(1, VAR_PAD_QUERIES) }
542 pad-queries-block-size{COLON}	{ YDVAR(1, VAR_PAD_QUERIES_BLOCK_SIZE) }
543 ipsecmod-enabled{COLON}		{ YDVAR(1, VAR_IPSECMOD_ENABLED) }
544 ipsecmod-ignore-bogus{COLON}	{ YDVAR(1, VAR_IPSECMOD_IGNORE_BOGUS) }
545 ipsecmod-hook{COLON}		{ YDVAR(1, VAR_IPSECMOD_HOOK) }
546 ipsecmod-max-ttl{COLON}		{ YDVAR(1, VAR_IPSECMOD_MAX_TTL) }
547 ipsecmod-whitelist{COLON}	{ YDVAR(1, VAR_IPSECMOD_WHITELIST) }
548 ipsecmod-allow{COLON}		{ YDVAR(1, VAR_IPSECMOD_WHITELIST) }
549 ipsecmod-strict{COLON}		{ YDVAR(1, VAR_IPSECMOD_STRICT) }
550 cachedb{COLON}			{ YDVAR(0, VAR_CACHEDB) }
551 backend{COLON}			{ YDVAR(1, VAR_CACHEDB_BACKEND) }
552 secret-seed{COLON}		{ YDVAR(1, VAR_CACHEDB_SECRETSEED) }
553 redis-server-host{COLON}	{ YDVAR(1, VAR_CACHEDB_REDISHOST) }
554 redis-server-port{COLON}	{ YDVAR(1, VAR_CACHEDB_REDISPORT) }
555 redis-timeout{COLON}		{ YDVAR(1, VAR_CACHEDB_REDISTIMEOUT) }
556 redis-expire-records{COLON}	{ YDVAR(1, VAR_CACHEDB_REDISEXPIRERECORDS) }
557 ipset{COLON}			{ YDVAR(0, VAR_IPSET) }
558 name-v4{COLON}			{ YDVAR(1, VAR_IPSET_NAME_V4) }
559 name-v6{COLON}			{ YDVAR(1, VAR_IPSET_NAME_V6) }
560 udp-upstream-without-downstream{COLON} { YDVAR(1, VAR_UDP_UPSTREAM_WITHOUT_DOWNSTREAM) }
561 tcp-connection-limit{COLON}	{ YDVAR(2, VAR_TCP_CONNECTION_LIMIT) }
562 edns-client-string{COLON}	{ YDVAR(2, VAR_EDNS_CLIENT_STRING) }
563 edns-client-string-opcode{COLON} { YDVAR(1, VAR_EDNS_CLIENT_STRING_OPCODE) }
564 nsid{COLON}			{ YDVAR(1, VAR_NSID ) }
565 ede{COLON}			{ YDVAR(1, VAR_EDE ) }
566 proxy-protocol-port{COLON}	{ YDVAR(1, VAR_PROXY_PROTOCOL_PORT) }
567 <INITIAL,val>{NEWLINE}		{ LEXOUT(("NL\n")); cfg_parser->line++; }
568 
569 	/* Quoted strings. Strip leading and ending quotes */
570 <val>\"			{ BEGIN(quotedstring); LEXOUT(("QS ")); }
571 <quotedstring><<EOF>>   {
572         ub_c_error("EOF inside quoted string");
573 	if(--num_args == 0) { BEGIN(INITIAL); }
574 	else		    { BEGIN(val); }
575 }
576 <quotedstring>{DQANY}*  { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); }
577 <quotedstring>{NEWLINE} { ub_c_error("newline inside quoted string, no end \"");
578 			  cfg_parser->line++; BEGIN(INITIAL); }
579 <quotedstring>\" {
580         LEXOUT(("QE "));
581 	if(--num_args == 0) { BEGIN(INITIAL); }
582 	else		    { BEGIN(val); }
583         ub_c_text[ub_c_leng - 1] = '\0';
584 	ub_c_lval.str = strdup(ub_c_text);
585 	if(!ub_c_lval.str)
586 		ub_c_error("out of memory");
587         return STRING_ARG;
588 }
589 
590 	/* Single Quoted strings. Strip leading and ending quotes */
591 <val>\'			{ BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
592 <singlequotedstr><<EOF>>   {
593         ub_c_error("EOF inside quoted string");
594 	if(--num_args == 0) { BEGIN(INITIAL); }
595 	else		    { BEGIN(val); }
596 }
597 <singlequotedstr>{SQANY}*  { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); }
598 <singlequotedstr>{NEWLINE} { ub_c_error("newline inside quoted string, no end '");
599 			     cfg_parser->line++; BEGIN(INITIAL); }
600 <singlequotedstr>\' {
601         LEXOUT(("SQE "));
602 	if(--num_args == 0) { BEGIN(INITIAL); }
603 	else		    { BEGIN(val); }
604         ub_c_text[ub_c_leng - 1] = '\0';
605 	ub_c_lval.str = strdup(ub_c_text);
606 	if(!ub_c_lval.str)
607 		ub_c_error("out of memory");
608         return STRING_ARG;
609 }
610 
611 	/* include: directive */
612 <INITIAL,val>include{COLON}	{
613 	LEXOUT(("v(%s) ", ub_c_text)); inc_prev = YYSTATE; BEGIN(include); }
614 <include><<EOF>>	{
615         ub_c_error("EOF inside include directive");
616         BEGIN(inc_prev);
617 }
618 <include>{SPACE}*	{ LEXOUT(("ISP ")); /* ignore */ }
619 <include>{NEWLINE}	{ LEXOUT(("NL\n")); cfg_parser->line++;}
620 <include>\"		{ LEXOUT(("IQS ")); BEGIN(include_quoted); }
621 <include>{UNQUOTEDLETTER}*	{
622 	LEXOUT(("Iunquotedstr(%s) ", ub_c_text));
623 	config_start_include_glob(ub_c_text, 0);
624 	BEGIN(inc_prev);
625 }
626 <include_quoted><<EOF>>	{
627         ub_c_error("EOF inside quoted string");
628         BEGIN(inc_prev);
629 }
630 <include_quoted>{DQANY}*	{ LEXOUT(("ISTR(%s) ", ub_c_text)); yymore(); }
631 <include_quoted>{NEWLINE}	{ ub_c_error("newline before \" in include name");
632 				  cfg_parser->line++; BEGIN(inc_prev); }
633 <include_quoted>\"	{
634 	LEXOUT(("IQE "));
635 	ub_c_text[ub_c_leng - 1] = '\0';
636 	config_start_include_glob(ub_c_text,0);
637 	BEGIN(inc_prev);
638 }
639 <INITIAL,val><<EOF>>	{
640 	LEXOUT(("LEXEOF "));
641 	yy_set_bol(1); /* Set beginning of line, so "^" rules match.  */
642 	if (!config_include_stack) {
643 		yyterminate();
644 	} else {
645 		fclose(yyin);
646 		int prev_toplevel = inc_toplevel;
647 		fclose(ub_c_in);
648 		config_end_include();
649 		if(prev_toplevel) return (VAR_FORCE_TOPLEVEL);
650 	}
651 }
652 
653 	/* include-toplevel: directive */
654 <INITIAL,val>include-toplevel{COLON} {
655 	LEXOUT(("v(%s) ", ub_c_text)); inc_prev = YYSTATE; BEGIN(include_toplevel);
656 }
657 <include_toplevel><<EOF>> {
658 	ub_c_error("EOF inside include_toplevel directive");
659 	BEGIN(inc_prev);
660 }
661 <include_toplevel>{SPACE}* { LEXOUT(("ITSP ")); /* ignore */ }
662 <include_toplevel>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
663 <include_toplevel>\" { LEXOUT(("ITQS ")); BEGIN(include_toplevel_quoted); }
664 <include_toplevel>{UNQUOTEDLETTER}* {
665 	LEXOUT(("ITunquotedstr(%s) ", ub_c_text));
666 	config_start_include_glob(ub_c_text, 1);
667 	BEGIN(inc_prev);
668 	return (VAR_FORCE_TOPLEVEL);
669 }
670 <include_toplevel_quoted><<EOF>> {
671 	ub_c_error("EOF inside quoted string");
672 	BEGIN(inc_prev);
673 }
674 <include_toplevel_quoted>{DQANY}* { LEXOUT(("ITSTR(%s) ", ub_c_text)); yymore(); }
675 <include_toplevel_quoted>{NEWLINE} {
676 	ub_c_error("newline before \" in include name");
677 	cfg_parser->line++; BEGIN(inc_prev);
678 }
679 <include_toplevel_quoted>\" {
680 	LEXOUT(("ITQE "));
681 	ub_c_text[yyleng - 1] = '\0';
682 	config_start_include_glob(ub_c_text, 1);
683 	BEGIN(inc_prev);
684 	return (VAR_FORCE_TOPLEVEL);
685 }
686 
687 <val>{UNQUOTEDLETTER}*	{ LEXOUT(("unquotedstr(%s) ", ub_c_text));
688 			if(--num_args == 0) { BEGIN(INITIAL); }
689 			ub_c_lval.str = strdup(ub_c_text); return STRING_ARG; }
690 
691 {UNQUOTEDLETTER_NOCOLON}*	{
692 	ub_c_error_msg("unknown keyword '%s'", ub_c_text);
693 	}
694 
695 <*>.	{
696 	ub_c_error_msg("stray '%s'", ub_c_text);
697 	}
698 
699 %%
700