xref: /freebsd/contrib/unbound/util/configparser.y (revision 325151a3)
1 /*
2  * configparser.y -- yacc grammar for unbound configuration files
3  *
4  * Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
5  *
6  * Copyright (c) 2007, NLnet Labs. All rights reserved.
7  *
8  * This software is open source.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  *
17  * Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * Neither the name of the NLNET LABS nor the names of its contributors may
22  * be used to endorse or promote products derived from this software without
23  * specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
31  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 %{
39 #include "config.h"
40 
41 #include <stdarg.h>
42 #include <stdio.h>
43 #include <string.h>
44 #include <stdlib.h>
45 #include <assert.h>
46 
47 #include "util/configyyrename.h"
48 #include "util/config_file.h"
49 #include "util/net_help.h"
50 
51 int ub_c_lex(void);
52 void ub_c_error(const char *message);
53 
54 /* these need to be global, otherwise they cannot be used inside yacc */
55 extern struct config_parser_state* cfg_parser;
56 
57 #if 0
58 #define OUTYY(s)  printf s /* used ONLY when debugging */
59 #else
60 #define OUTYY(s)
61 #endif
62 
63 %}
64 %union {
65 	char*	str;
66 };
67 
68 %token SPACE LETTER NEWLINE COMMENT COLON ANY ZONESTR
69 %token <str> STRING_ARG
70 %token VAR_SERVER VAR_VERBOSITY VAR_NUM_THREADS VAR_PORT
71 %token VAR_OUTGOING_RANGE VAR_INTERFACE
72 %token VAR_DO_IP4 VAR_DO_IP6 VAR_DO_UDP VAR_DO_TCP
73 %token VAR_CHROOT VAR_USERNAME VAR_DIRECTORY VAR_LOGFILE VAR_PIDFILE
74 %token VAR_MSG_CACHE_SIZE VAR_MSG_CACHE_SLABS VAR_NUM_QUERIES_PER_THREAD
75 %token VAR_RRSET_CACHE_SIZE VAR_RRSET_CACHE_SLABS VAR_OUTGOING_NUM_TCP
76 %token VAR_INFRA_HOST_TTL VAR_INFRA_LAME_TTL VAR_INFRA_CACHE_SLABS
77 %token VAR_INFRA_CACHE_NUMHOSTS VAR_INFRA_CACHE_LAME_SIZE VAR_NAME
78 %token VAR_STUB_ZONE VAR_STUB_HOST VAR_STUB_ADDR VAR_TARGET_FETCH_POLICY
79 %token VAR_HARDEN_SHORT_BUFSIZE VAR_HARDEN_LARGE_QUERIES
80 %token VAR_FORWARD_ZONE VAR_FORWARD_HOST VAR_FORWARD_ADDR
81 %token VAR_DO_NOT_QUERY_ADDRESS VAR_HIDE_IDENTITY VAR_HIDE_VERSION
82 %token VAR_IDENTITY VAR_VERSION VAR_HARDEN_GLUE VAR_MODULE_CONF
83 %token VAR_TRUST_ANCHOR_FILE VAR_TRUST_ANCHOR VAR_VAL_OVERRIDE_DATE
84 %token VAR_BOGUS_TTL VAR_VAL_CLEAN_ADDITIONAL VAR_VAL_PERMISSIVE_MODE
85 %token VAR_INCOMING_NUM_TCP VAR_MSG_BUFFER_SIZE VAR_KEY_CACHE_SIZE
86 %token VAR_KEY_CACHE_SLABS VAR_TRUSTED_KEYS_FILE
87 %token VAR_VAL_NSEC3_KEYSIZE_ITERATIONS VAR_USE_SYSLOG
88 %token VAR_OUTGOING_INTERFACE VAR_ROOT_HINTS VAR_DO_NOT_QUERY_LOCALHOST
89 %token VAR_CACHE_MAX_TTL VAR_HARDEN_DNSSEC_STRIPPED VAR_ACCESS_CONTROL
90 %token VAR_LOCAL_ZONE VAR_LOCAL_DATA VAR_INTERFACE_AUTOMATIC
91 %token VAR_STATISTICS_INTERVAL VAR_DO_DAEMONIZE VAR_USE_CAPS_FOR_ID
92 %token VAR_STATISTICS_CUMULATIVE VAR_OUTGOING_PORT_PERMIT
93 %token VAR_OUTGOING_PORT_AVOID VAR_DLV_ANCHOR_FILE VAR_DLV_ANCHOR
94 %token VAR_NEG_CACHE_SIZE VAR_HARDEN_REFERRAL_PATH VAR_PRIVATE_ADDRESS
95 %token VAR_PRIVATE_DOMAIN VAR_REMOTE_CONTROL VAR_CONTROL_ENABLE
96 %token VAR_CONTROL_INTERFACE VAR_CONTROL_PORT VAR_SERVER_KEY_FILE
97 %token VAR_SERVER_CERT_FILE VAR_CONTROL_KEY_FILE VAR_CONTROL_CERT_FILE
98 %token VAR_CONTROL_USE_CERT
99 %token VAR_EXTENDED_STATISTICS VAR_LOCAL_DATA_PTR VAR_JOSTLE_TIMEOUT
100 %token VAR_STUB_PRIME VAR_UNWANTED_REPLY_THRESHOLD VAR_LOG_TIME_ASCII
101 %token VAR_DOMAIN_INSECURE VAR_PYTHON VAR_PYTHON_SCRIPT VAR_VAL_SIG_SKEW_MIN
102 %token VAR_VAL_SIG_SKEW_MAX VAR_CACHE_MIN_TTL VAR_VAL_LOG_LEVEL
103 %token VAR_AUTO_TRUST_ANCHOR_FILE VAR_KEEP_MISSING VAR_ADD_HOLDDOWN
104 %token VAR_DEL_HOLDDOWN VAR_SO_RCVBUF VAR_EDNS_BUFFER_SIZE VAR_PREFETCH
105 %token VAR_PREFETCH_KEY VAR_SO_SNDBUF VAR_SO_REUSEPORT VAR_HARDEN_BELOW_NXDOMAIN
106 %token VAR_IGNORE_CD_FLAG VAR_LOG_QUERIES VAR_TCP_UPSTREAM VAR_SSL_UPSTREAM
107 %token VAR_SSL_SERVICE_KEY VAR_SSL_SERVICE_PEM VAR_SSL_PORT VAR_FORWARD_FIRST
108 %token VAR_STUB_FIRST VAR_MINIMAL_RESPONSES VAR_RRSET_ROUNDROBIN
109 %token VAR_MAX_UDP_SIZE VAR_DELAY_CLOSE VAR_UNBLOCK_LAN_ZONES
110 %token VAR_INFRA_CACHE_MIN_RTT
111 %token VAR_DNS64_PREFIX VAR_DNS64_SYNTHALL
112 %token VAR_DNSTAP VAR_DNSTAP_ENABLE VAR_DNSTAP_SOCKET_PATH
113 %token VAR_DNSTAP_SEND_IDENTITY VAR_DNSTAP_SEND_VERSION
114 %token VAR_DNSTAP_IDENTITY VAR_DNSTAP_VERSION
115 %token VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES
116 %token VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES
117 %token VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES
118 %token VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES
119 %token VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES
120 %token VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES
121 %token VAR_HARDEN_ALGO_DOWNGRADE VAR_IP_TRANSPARENT
122 %token VAR_RATELIMIT VAR_RATELIMIT_SLABS VAR_RATELIMIT_SIZE
123 %token VAR_RATELIMIT_FOR_DOMAIN VAR_RATELIMIT_BELOW_DOMAIN VAR_RATELIMIT_FACTOR
124 %token VAR_CAPS_WHITELIST VAR_CACHE_MAX_NEGATIVE_TTL VAR_PERMIT_SMALL_HOLDDOWN
125 
126 %%
127 toplevelvars: /* empty */ | toplevelvars toplevelvar ;
128 toplevelvar: serverstart contents_server | stubstart contents_stub |
129 	forwardstart contents_forward | pythonstart contents_py |
130 	rcstart contents_rc | dtstart contents_dt
131 	;
132 
133 /* server: declaration */
134 serverstart: VAR_SERVER
135 	{
136 		OUTYY(("\nP(server:)\n"));
137 	}
138 	;
139 contents_server: contents_server content_server
140 	| ;
141 content_server: server_num_threads | server_verbosity | server_port |
142 	server_outgoing_range | server_do_ip4 |
143 	server_do_ip6 | server_do_udp | server_do_tcp |
144 	server_interface | server_chroot | server_username |
145 	server_directory | server_logfile | server_pidfile |
146 	server_msg_cache_size | server_msg_cache_slabs |
147 	server_num_queries_per_thread | server_rrset_cache_size |
148 	server_rrset_cache_slabs | server_outgoing_num_tcp |
149 	server_infra_host_ttl | server_infra_lame_ttl |
150 	server_infra_cache_slabs | server_infra_cache_numhosts |
151 	server_infra_cache_lame_size | server_target_fetch_policy |
152 	server_harden_short_bufsize | server_harden_large_queries |
153 	server_do_not_query_address | server_hide_identity |
154 	server_hide_version | server_identity | server_version |
155 	server_harden_glue | server_module_conf | server_trust_anchor_file |
156 	server_trust_anchor | server_val_override_date | server_bogus_ttl |
157 	server_val_clean_additional | server_val_permissive_mode |
158 	server_incoming_num_tcp | server_msg_buffer_size |
159 	server_key_cache_size | server_key_cache_slabs |
160 	server_trusted_keys_file | server_val_nsec3_keysize_iterations |
161 	server_use_syslog | server_outgoing_interface | server_root_hints |
162 	server_do_not_query_localhost | server_cache_max_ttl |
163 	server_harden_dnssec_stripped | server_access_control |
164 	server_local_zone | server_local_data | server_interface_automatic |
165 	server_statistics_interval | server_do_daemonize |
166 	server_use_caps_for_id | server_statistics_cumulative |
167 	server_outgoing_port_permit | server_outgoing_port_avoid |
168 	server_dlv_anchor_file | server_dlv_anchor | server_neg_cache_size |
169 	server_harden_referral_path | server_private_address |
170 	server_private_domain | server_extended_statistics |
171 	server_local_data_ptr | server_jostle_timeout |
172 	server_unwanted_reply_threshold | server_log_time_ascii |
173 	server_domain_insecure | server_val_sig_skew_min |
174 	server_val_sig_skew_max | server_cache_min_ttl | server_val_log_level |
175 	server_auto_trust_anchor_file | server_add_holddown |
176 	server_del_holddown | server_keep_missing | server_so_rcvbuf |
177 	server_edns_buffer_size | server_prefetch | server_prefetch_key |
178 	server_so_sndbuf | server_harden_below_nxdomain | server_ignore_cd_flag |
179 	server_log_queries | server_tcp_upstream | server_ssl_upstream |
180 	server_ssl_service_key | server_ssl_service_pem | server_ssl_port |
181 	server_minimal_responses | server_rrset_roundrobin | server_max_udp_size |
182 	server_so_reuseport | server_delay_close | server_unblock_lan_zones |
183 	server_dns64_prefix | server_dns64_synthall |
184 	server_infra_cache_min_rtt | server_harden_algo_downgrade |
185 	server_ip_transparent | server_ratelimit | server_ratelimit_slabs |
186 	server_ratelimit_size | server_ratelimit_for_domain |
187 	server_ratelimit_below_domain | server_ratelimit_factor |
188 	server_caps_whitelist | server_cache_max_negative_ttl |
189 	server_permit_small_holddown
190 	;
191 stubstart: VAR_STUB_ZONE
192 	{
193 		struct config_stub* s;
194 		OUTYY(("\nP(stub_zone:)\n"));
195 		s = (struct config_stub*)calloc(1, sizeof(struct config_stub));
196 		if(s) {
197 			s->next = cfg_parser->cfg->stubs;
198 			cfg_parser->cfg->stubs = s;
199 		} else
200 			yyerror("out of memory");
201 	}
202 	;
203 contents_stub: contents_stub content_stub
204 	| ;
205 content_stub: stub_name | stub_host | stub_addr | stub_prime | stub_first
206 	;
207 forwardstart: VAR_FORWARD_ZONE
208 	{
209 		struct config_stub* s;
210 		OUTYY(("\nP(forward_zone:)\n"));
211 		s = (struct config_stub*)calloc(1, sizeof(struct config_stub));
212 		if(s) {
213 			s->next = cfg_parser->cfg->forwards;
214 			cfg_parser->cfg->forwards = s;
215 		} else
216 			yyerror("out of memory");
217 	}
218 	;
219 contents_forward: contents_forward content_forward
220 	| ;
221 content_forward: forward_name | forward_host | forward_addr | forward_first
222 	;
223 server_num_threads: VAR_NUM_THREADS STRING_ARG
224 	{
225 		OUTYY(("P(server_num_threads:%s)\n", $2));
226 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
227 			yyerror("number expected");
228 		else cfg_parser->cfg->num_threads = atoi($2);
229 		free($2);
230 	}
231 	;
232 server_verbosity: VAR_VERBOSITY STRING_ARG
233 	{
234 		OUTYY(("P(server_verbosity:%s)\n", $2));
235 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
236 			yyerror("number expected");
237 		else cfg_parser->cfg->verbosity = atoi($2);
238 		free($2);
239 	}
240 	;
241 server_statistics_interval: VAR_STATISTICS_INTERVAL STRING_ARG
242 	{
243 		OUTYY(("P(server_statistics_interval:%s)\n", $2));
244 		if(strcmp($2, "") == 0 || strcmp($2, "0") == 0)
245 			cfg_parser->cfg->stat_interval = 0;
246 		else if(atoi($2) == 0)
247 			yyerror("number expected");
248 		else cfg_parser->cfg->stat_interval = atoi($2);
249 		free($2);
250 	}
251 	;
252 server_statistics_cumulative: VAR_STATISTICS_CUMULATIVE STRING_ARG
253 	{
254 		OUTYY(("P(server_statistics_cumulative:%s)\n", $2));
255 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
256 			yyerror("expected yes or no.");
257 		else cfg_parser->cfg->stat_cumulative = (strcmp($2, "yes")==0);
258 		free($2);
259 	}
260 	;
261 server_extended_statistics: VAR_EXTENDED_STATISTICS STRING_ARG
262 	{
263 		OUTYY(("P(server_extended_statistics:%s)\n", $2));
264 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
265 			yyerror("expected yes or no.");
266 		else cfg_parser->cfg->stat_extended = (strcmp($2, "yes")==0);
267 		free($2);
268 	}
269 	;
270 server_port: VAR_PORT STRING_ARG
271 	{
272 		OUTYY(("P(server_port:%s)\n", $2));
273 		if(atoi($2) == 0)
274 			yyerror("port number expected");
275 		else cfg_parser->cfg->port = atoi($2);
276 		free($2);
277 	}
278 	;
279 server_interface: VAR_INTERFACE STRING_ARG
280 	{
281 		OUTYY(("P(server_interface:%s)\n", $2));
282 		if(cfg_parser->cfg->num_ifs == 0)
283 			cfg_parser->cfg->ifs = calloc(1, sizeof(char*));
284 		else 	cfg_parser->cfg->ifs = realloc(cfg_parser->cfg->ifs,
285 				(cfg_parser->cfg->num_ifs+1)*sizeof(char*));
286 		if(!cfg_parser->cfg->ifs)
287 			yyerror("out of memory");
288 		else
289 			cfg_parser->cfg->ifs[cfg_parser->cfg->num_ifs++] = $2;
290 	}
291 	;
292 server_outgoing_interface: VAR_OUTGOING_INTERFACE STRING_ARG
293 	{
294 		OUTYY(("P(server_outgoing_interface:%s)\n", $2));
295 		if(cfg_parser->cfg->num_out_ifs == 0)
296 			cfg_parser->cfg->out_ifs = calloc(1, sizeof(char*));
297 		else 	cfg_parser->cfg->out_ifs = realloc(
298 			cfg_parser->cfg->out_ifs,
299 			(cfg_parser->cfg->num_out_ifs+1)*sizeof(char*));
300 		if(!cfg_parser->cfg->out_ifs)
301 			yyerror("out of memory");
302 		else
303 			cfg_parser->cfg->out_ifs[
304 				cfg_parser->cfg->num_out_ifs++] = $2;
305 	}
306 	;
307 server_outgoing_range: VAR_OUTGOING_RANGE STRING_ARG
308 	{
309 		OUTYY(("P(server_outgoing_range:%s)\n", $2));
310 		if(atoi($2) == 0)
311 			yyerror("number expected");
312 		else cfg_parser->cfg->outgoing_num_ports = atoi($2);
313 		free($2);
314 	}
315 	;
316 server_outgoing_port_permit: VAR_OUTGOING_PORT_PERMIT STRING_ARG
317 	{
318 		OUTYY(("P(server_outgoing_port_permit:%s)\n", $2));
319 		if(!cfg_mark_ports($2, 1,
320 			cfg_parser->cfg->outgoing_avail_ports, 65536))
321 			yyerror("port number or range (\"low-high\") expected");
322 		free($2);
323 	}
324 	;
325 server_outgoing_port_avoid: VAR_OUTGOING_PORT_AVOID STRING_ARG
326 	{
327 		OUTYY(("P(server_outgoing_port_avoid:%s)\n", $2));
328 		if(!cfg_mark_ports($2, 0,
329 			cfg_parser->cfg->outgoing_avail_ports, 65536))
330 			yyerror("port number or range (\"low-high\") expected");
331 		free($2);
332 	}
333 	;
334 server_outgoing_num_tcp: VAR_OUTGOING_NUM_TCP STRING_ARG
335 	{
336 		OUTYY(("P(server_outgoing_num_tcp:%s)\n", $2));
337 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
338 			yyerror("number expected");
339 		else cfg_parser->cfg->outgoing_num_tcp = atoi($2);
340 		free($2);
341 	}
342 	;
343 server_incoming_num_tcp: VAR_INCOMING_NUM_TCP STRING_ARG
344 	{
345 		OUTYY(("P(server_incoming_num_tcp:%s)\n", $2));
346 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
347 			yyerror("number expected");
348 		else cfg_parser->cfg->incoming_num_tcp = atoi($2);
349 		free($2);
350 	}
351 	;
352 server_interface_automatic: VAR_INTERFACE_AUTOMATIC STRING_ARG
353 	{
354 		OUTYY(("P(server_interface_automatic:%s)\n", $2));
355 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
356 			yyerror("expected yes or no.");
357 		else cfg_parser->cfg->if_automatic = (strcmp($2, "yes")==0);
358 		free($2);
359 	}
360 	;
361 server_do_ip4: VAR_DO_IP4 STRING_ARG
362 	{
363 		OUTYY(("P(server_do_ip4:%s)\n", $2));
364 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
365 			yyerror("expected yes or no.");
366 		else cfg_parser->cfg->do_ip4 = (strcmp($2, "yes")==0);
367 		free($2);
368 	}
369 	;
370 server_do_ip6: VAR_DO_IP6 STRING_ARG
371 	{
372 		OUTYY(("P(server_do_ip6:%s)\n", $2));
373 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
374 			yyerror("expected yes or no.");
375 		else cfg_parser->cfg->do_ip6 = (strcmp($2, "yes")==0);
376 		free($2);
377 	}
378 	;
379 server_do_udp: VAR_DO_UDP STRING_ARG
380 	{
381 		OUTYY(("P(server_do_udp:%s)\n", $2));
382 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
383 			yyerror("expected yes or no.");
384 		else cfg_parser->cfg->do_udp = (strcmp($2, "yes")==0);
385 		free($2);
386 	}
387 	;
388 server_do_tcp: VAR_DO_TCP STRING_ARG
389 	{
390 		OUTYY(("P(server_do_tcp:%s)\n", $2));
391 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
392 			yyerror("expected yes or no.");
393 		else cfg_parser->cfg->do_tcp = (strcmp($2, "yes")==0);
394 		free($2);
395 	}
396 	;
397 server_tcp_upstream: VAR_TCP_UPSTREAM STRING_ARG
398 	{
399 		OUTYY(("P(server_tcp_upstream:%s)\n", $2));
400 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
401 			yyerror("expected yes or no.");
402 		else cfg_parser->cfg->tcp_upstream = (strcmp($2, "yes")==0);
403 		free($2);
404 	}
405 	;
406 server_ssl_upstream: VAR_SSL_UPSTREAM STRING_ARG
407 	{
408 		OUTYY(("P(server_ssl_upstream:%s)\n", $2));
409 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
410 			yyerror("expected yes or no.");
411 		else cfg_parser->cfg->ssl_upstream = (strcmp($2, "yes")==0);
412 		free($2);
413 	}
414 	;
415 server_ssl_service_key: VAR_SSL_SERVICE_KEY STRING_ARG
416 	{
417 		OUTYY(("P(server_ssl_service_key:%s)\n", $2));
418 		free(cfg_parser->cfg->ssl_service_key);
419 		cfg_parser->cfg->ssl_service_key = $2;
420 	}
421 	;
422 server_ssl_service_pem: VAR_SSL_SERVICE_PEM STRING_ARG
423 	{
424 		OUTYY(("P(server_ssl_service_pem:%s)\n", $2));
425 		free(cfg_parser->cfg->ssl_service_pem);
426 		cfg_parser->cfg->ssl_service_pem = $2;
427 	}
428 	;
429 server_ssl_port: VAR_SSL_PORT STRING_ARG
430 	{
431 		OUTYY(("P(server_ssl_port:%s)\n", $2));
432 		if(atoi($2) == 0)
433 			yyerror("port number expected");
434 		else cfg_parser->cfg->ssl_port = atoi($2);
435 		free($2);
436 	}
437 	;
438 server_do_daemonize: VAR_DO_DAEMONIZE STRING_ARG
439 	{
440 		OUTYY(("P(server_do_daemonize:%s)\n", $2));
441 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
442 			yyerror("expected yes or no.");
443 		else cfg_parser->cfg->do_daemonize = (strcmp($2, "yes")==0);
444 		free($2);
445 	}
446 	;
447 server_use_syslog: VAR_USE_SYSLOG STRING_ARG
448 	{
449 		OUTYY(("P(server_use_syslog:%s)\n", $2));
450 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
451 			yyerror("expected yes or no.");
452 		else cfg_parser->cfg->use_syslog = (strcmp($2, "yes")==0);
453 #if !defined(HAVE_SYSLOG_H) && !defined(UB_ON_WINDOWS)
454 		if(strcmp($2, "yes") == 0)
455 			yyerror("no syslog services are available. "
456 				"(reconfigure and compile to add)");
457 #endif
458 		free($2);
459 	}
460 	;
461 server_log_time_ascii: VAR_LOG_TIME_ASCII STRING_ARG
462 	{
463 		OUTYY(("P(server_log_time_ascii:%s)\n", $2));
464 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
465 			yyerror("expected yes or no.");
466 		else cfg_parser->cfg->log_time_ascii = (strcmp($2, "yes")==0);
467 		free($2);
468 	}
469 	;
470 server_log_queries: VAR_LOG_QUERIES STRING_ARG
471 	{
472 		OUTYY(("P(server_log_queries:%s)\n", $2));
473 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
474 			yyerror("expected yes or no.");
475 		else cfg_parser->cfg->log_queries = (strcmp($2, "yes")==0);
476 		free($2);
477 	}
478 	;
479 server_chroot: VAR_CHROOT STRING_ARG
480 	{
481 		OUTYY(("P(server_chroot:%s)\n", $2));
482 		free(cfg_parser->cfg->chrootdir);
483 		cfg_parser->cfg->chrootdir = $2;
484 	}
485 	;
486 server_username: VAR_USERNAME STRING_ARG
487 	{
488 		OUTYY(("P(server_username:%s)\n", $2));
489 		free(cfg_parser->cfg->username);
490 		cfg_parser->cfg->username = $2;
491 	}
492 	;
493 server_directory: VAR_DIRECTORY STRING_ARG
494 	{
495 		OUTYY(("P(server_directory:%s)\n", $2));
496 		free(cfg_parser->cfg->directory);
497 		cfg_parser->cfg->directory = $2;
498 	}
499 	;
500 server_logfile: VAR_LOGFILE STRING_ARG
501 	{
502 		OUTYY(("P(server_logfile:%s)\n", $2));
503 		free(cfg_parser->cfg->logfile);
504 		cfg_parser->cfg->logfile = $2;
505 		cfg_parser->cfg->use_syslog = 0;
506 	}
507 	;
508 server_pidfile: VAR_PIDFILE STRING_ARG
509 	{
510 		OUTYY(("P(server_pidfile:%s)\n", $2));
511 		free(cfg_parser->cfg->pidfile);
512 		cfg_parser->cfg->pidfile = $2;
513 	}
514 	;
515 server_root_hints: VAR_ROOT_HINTS STRING_ARG
516 	{
517 		OUTYY(("P(server_root_hints:%s)\n", $2));
518 		if(!cfg_strlist_insert(&cfg_parser->cfg->root_hints, $2))
519 			yyerror("out of memory");
520 	}
521 	;
522 server_dlv_anchor_file: VAR_DLV_ANCHOR_FILE STRING_ARG
523 	{
524 		OUTYY(("P(server_dlv_anchor_file:%s)\n", $2));
525 		free(cfg_parser->cfg->dlv_anchor_file);
526 		cfg_parser->cfg->dlv_anchor_file = $2;
527 	}
528 	;
529 server_dlv_anchor: VAR_DLV_ANCHOR STRING_ARG
530 	{
531 		OUTYY(("P(server_dlv_anchor:%s)\n", $2));
532 		if(!cfg_strlist_insert(&cfg_parser->cfg->dlv_anchor_list, $2))
533 			yyerror("out of memory");
534 	}
535 	;
536 server_auto_trust_anchor_file: VAR_AUTO_TRUST_ANCHOR_FILE STRING_ARG
537 	{
538 		OUTYY(("P(server_auto_trust_anchor_file:%s)\n", $2));
539 		if(!cfg_strlist_insert(&cfg_parser->cfg->
540 			auto_trust_anchor_file_list, $2))
541 			yyerror("out of memory");
542 	}
543 	;
544 server_trust_anchor_file: VAR_TRUST_ANCHOR_FILE STRING_ARG
545 	{
546 		OUTYY(("P(server_trust_anchor_file:%s)\n", $2));
547 		if(!cfg_strlist_insert(&cfg_parser->cfg->
548 			trust_anchor_file_list, $2))
549 			yyerror("out of memory");
550 	}
551 	;
552 server_trusted_keys_file: VAR_TRUSTED_KEYS_FILE STRING_ARG
553 	{
554 		OUTYY(("P(server_trusted_keys_file:%s)\n", $2));
555 		if(!cfg_strlist_insert(&cfg_parser->cfg->
556 			trusted_keys_file_list, $2))
557 			yyerror("out of memory");
558 	}
559 	;
560 server_trust_anchor: VAR_TRUST_ANCHOR STRING_ARG
561 	{
562 		OUTYY(("P(server_trust_anchor:%s)\n", $2));
563 		if(!cfg_strlist_insert(&cfg_parser->cfg->trust_anchor_list, $2))
564 			yyerror("out of memory");
565 	}
566 	;
567 server_domain_insecure: VAR_DOMAIN_INSECURE STRING_ARG
568 	{
569 		OUTYY(("P(server_domain_insecure:%s)\n", $2));
570 		if(!cfg_strlist_insert(&cfg_parser->cfg->domain_insecure, $2))
571 			yyerror("out of memory");
572 	}
573 	;
574 server_hide_identity: VAR_HIDE_IDENTITY STRING_ARG
575 	{
576 		OUTYY(("P(server_hide_identity:%s)\n", $2));
577 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
578 			yyerror("expected yes or no.");
579 		else cfg_parser->cfg->hide_identity = (strcmp($2, "yes")==0);
580 		free($2);
581 	}
582 	;
583 server_hide_version: VAR_HIDE_VERSION STRING_ARG
584 	{
585 		OUTYY(("P(server_hide_version:%s)\n", $2));
586 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
587 			yyerror("expected yes or no.");
588 		else cfg_parser->cfg->hide_version = (strcmp($2, "yes")==0);
589 		free($2);
590 	}
591 	;
592 server_identity: VAR_IDENTITY STRING_ARG
593 	{
594 		OUTYY(("P(server_identity:%s)\n", $2));
595 		free(cfg_parser->cfg->identity);
596 		cfg_parser->cfg->identity = $2;
597 	}
598 	;
599 server_version: VAR_VERSION STRING_ARG
600 	{
601 		OUTYY(("P(server_version:%s)\n", $2));
602 		free(cfg_parser->cfg->version);
603 		cfg_parser->cfg->version = $2;
604 	}
605 	;
606 server_so_rcvbuf: VAR_SO_RCVBUF STRING_ARG
607 	{
608 		OUTYY(("P(server_so_rcvbuf:%s)\n", $2));
609 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->so_rcvbuf))
610 			yyerror("buffer size expected");
611 		free($2);
612 	}
613 	;
614 server_so_sndbuf: VAR_SO_SNDBUF STRING_ARG
615 	{
616 		OUTYY(("P(server_so_sndbuf:%s)\n", $2));
617 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->so_sndbuf))
618 			yyerror("buffer size expected");
619 		free($2);
620 	}
621 	;
622 server_so_reuseport: VAR_SO_REUSEPORT STRING_ARG
623     {
624         OUTYY(("P(server_so_reuseport:%s)\n", $2));
625         if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
626             yyerror("expected yes or no.");
627         else cfg_parser->cfg->so_reuseport =
628             (strcmp($2, "yes")==0);
629         free($2);
630     }
631     ;
632 server_ip_transparent: VAR_IP_TRANSPARENT STRING_ARG
633     {
634         OUTYY(("P(server_ip_transparent:%s)\n", $2));
635         if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
636             yyerror("expected yes or no.");
637         else cfg_parser->cfg->ip_transparent =
638             (strcmp($2, "yes")==0);
639         free($2);
640     }
641     ;
642 server_edns_buffer_size: VAR_EDNS_BUFFER_SIZE STRING_ARG
643 	{
644 		OUTYY(("P(server_edns_buffer_size:%s)\n", $2));
645 		if(atoi($2) == 0)
646 			yyerror("number expected");
647 		else if (atoi($2) < 12)
648 			yyerror("edns buffer size too small");
649 		else if (atoi($2) > 65535)
650 			cfg_parser->cfg->edns_buffer_size = 65535;
651 		else cfg_parser->cfg->edns_buffer_size = atoi($2);
652 		free($2);
653 	}
654 	;
655 server_msg_buffer_size: VAR_MSG_BUFFER_SIZE STRING_ARG
656 	{
657 		OUTYY(("P(server_msg_buffer_size:%s)\n", $2));
658 		if(atoi($2) == 0)
659 			yyerror("number expected");
660 		else if (atoi($2) < 4096)
661 			yyerror("message buffer size too small (use 4096)");
662 		else cfg_parser->cfg->msg_buffer_size = atoi($2);
663 		free($2);
664 	}
665 	;
666 server_msg_cache_size: VAR_MSG_CACHE_SIZE STRING_ARG
667 	{
668 		OUTYY(("P(server_msg_cache_size:%s)\n", $2));
669 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->msg_cache_size))
670 			yyerror("memory size expected");
671 		free($2);
672 	}
673 	;
674 server_msg_cache_slabs: VAR_MSG_CACHE_SLABS STRING_ARG
675 	{
676 		OUTYY(("P(server_msg_cache_slabs:%s)\n", $2));
677 		if(atoi($2) == 0)
678 			yyerror("number expected");
679 		else {
680 			cfg_parser->cfg->msg_cache_slabs = atoi($2);
681 			if(!is_pow2(cfg_parser->cfg->msg_cache_slabs))
682 				yyerror("must be a power of 2");
683 		}
684 		free($2);
685 	}
686 	;
687 server_num_queries_per_thread: VAR_NUM_QUERIES_PER_THREAD STRING_ARG
688 	{
689 		OUTYY(("P(server_num_queries_per_thread:%s)\n", $2));
690 		if(atoi($2) == 0)
691 			yyerror("number expected");
692 		else cfg_parser->cfg->num_queries_per_thread = atoi($2);
693 		free($2);
694 	}
695 	;
696 server_jostle_timeout: VAR_JOSTLE_TIMEOUT STRING_ARG
697 	{
698 		OUTYY(("P(server_jostle_timeout:%s)\n", $2));
699 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
700 			yyerror("number expected");
701 		else cfg_parser->cfg->jostle_time = atoi($2);
702 		free($2);
703 	}
704 	;
705 server_delay_close: VAR_DELAY_CLOSE STRING_ARG
706 	{
707 		OUTYY(("P(server_delay_close:%s)\n", $2));
708 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
709 			yyerror("number expected");
710 		else cfg_parser->cfg->delay_close = atoi($2);
711 		free($2);
712 	}
713 	;
714 server_unblock_lan_zones: VAR_UNBLOCK_LAN_ZONES STRING_ARG
715 	{
716 		OUTYY(("P(server_unblock_lan_zones:%s)\n", $2));
717 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
718 			yyerror("expected yes or no.");
719 		else cfg_parser->cfg->unblock_lan_zones =
720 			(strcmp($2, "yes")==0);
721 		free($2);
722 	}
723 	;
724 server_rrset_cache_size: VAR_RRSET_CACHE_SIZE STRING_ARG
725 	{
726 		OUTYY(("P(server_rrset_cache_size:%s)\n", $2));
727 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->rrset_cache_size))
728 			yyerror("memory size expected");
729 		free($2);
730 	}
731 	;
732 server_rrset_cache_slabs: VAR_RRSET_CACHE_SLABS STRING_ARG
733 	{
734 		OUTYY(("P(server_rrset_cache_slabs:%s)\n", $2));
735 		if(atoi($2) == 0)
736 			yyerror("number expected");
737 		else {
738 			cfg_parser->cfg->rrset_cache_slabs = atoi($2);
739 			if(!is_pow2(cfg_parser->cfg->rrset_cache_slabs))
740 				yyerror("must be a power of 2");
741 		}
742 		free($2);
743 	}
744 	;
745 server_infra_host_ttl: VAR_INFRA_HOST_TTL STRING_ARG
746 	{
747 		OUTYY(("P(server_infra_host_ttl:%s)\n", $2));
748 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
749 			yyerror("number expected");
750 		else cfg_parser->cfg->host_ttl = atoi($2);
751 		free($2);
752 	}
753 	;
754 server_infra_lame_ttl: VAR_INFRA_LAME_TTL STRING_ARG
755 	{
756 		OUTYY(("P(server_infra_lame_ttl:%s)\n", $2));
757 		verbose(VERB_DETAIL, "ignored infra-lame-ttl: %s (option "
758 			"removed, use infra-host-ttl)", $2);
759 		free($2);
760 	}
761 	;
762 server_infra_cache_numhosts: VAR_INFRA_CACHE_NUMHOSTS STRING_ARG
763 	{
764 		OUTYY(("P(server_infra_cache_numhosts:%s)\n", $2));
765 		if(atoi($2) == 0)
766 			yyerror("number expected");
767 		else cfg_parser->cfg->infra_cache_numhosts = atoi($2);
768 		free($2);
769 	}
770 	;
771 server_infra_cache_lame_size: VAR_INFRA_CACHE_LAME_SIZE STRING_ARG
772 	{
773 		OUTYY(("P(server_infra_cache_lame_size:%s)\n", $2));
774 		verbose(VERB_DETAIL, "ignored infra-cache-lame-size: %s "
775 			"(option removed, use infra-cache-numhosts)", $2);
776 		free($2);
777 	}
778 	;
779 server_infra_cache_slabs: VAR_INFRA_CACHE_SLABS STRING_ARG
780 	{
781 		OUTYY(("P(server_infra_cache_slabs:%s)\n", $2));
782 		if(atoi($2) == 0)
783 			yyerror("number expected");
784 		else {
785 			cfg_parser->cfg->infra_cache_slabs = atoi($2);
786 			if(!is_pow2(cfg_parser->cfg->infra_cache_slabs))
787 				yyerror("must be a power of 2");
788 		}
789 		free($2);
790 	}
791 	;
792 server_infra_cache_min_rtt: VAR_INFRA_CACHE_MIN_RTT STRING_ARG
793 	{
794 		OUTYY(("P(server_infra_cache_min_rtt:%s)\n", $2));
795 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
796 			yyerror("number expected");
797 		else cfg_parser->cfg->infra_cache_min_rtt = atoi($2);
798 		free($2);
799 	}
800 	;
801 server_target_fetch_policy: VAR_TARGET_FETCH_POLICY STRING_ARG
802 	{
803 		OUTYY(("P(server_target_fetch_policy:%s)\n", $2));
804 		free(cfg_parser->cfg->target_fetch_policy);
805 		cfg_parser->cfg->target_fetch_policy = $2;
806 	}
807 	;
808 server_harden_short_bufsize: VAR_HARDEN_SHORT_BUFSIZE STRING_ARG
809 	{
810 		OUTYY(("P(server_harden_short_bufsize:%s)\n", $2));
811 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
812 			yyerror("expected yes or no.");
813 		else cfg_parser->cfg->harden_short_bufsize =
814 			(strcmp($2, "yes")==0);
815 		free($2);
816 	}
817 	;
818 server_harden_large_queries: VAR_HARDEN_LARGE_QUERIES STRING_ARG
819 	{
820 		OUTYY(("P(server_harden_large_queries:%s)\n", $2));
821 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
822 			yyerror("expected yes or no.");
823 		else cfg_parser->cfg->harden_large_queries =
824 			(strcmp($2, "yes")==0);
825 		free($2);
826 	}
827 	;
828 server_harden_glue: VAR_HARDEN_GLUE STRING_ARG
829 	{
830 		OUTYY(("P(server_harden_glue:%s)\n", $2));
831 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
832 			yyerror("expected yes or no.");
833 		else cfg_parser->cfg->harden_glue =
834 			(strcmp($2, "yes")==0);
835 		free($2);
836 	}
837 	;
838 server_harden_dnssec_stripped: VAR_HARDEN_DNSSEC_STRIPPED STRING_ARG
839 	{
840 		OUTYY(("P(server_harden_dnssec_stripped:%s)\n", $2));
841 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
842 			yyerror("expected yes or no.");
843 		else cfg_parser->cfg->harden_dnssec_stripped =
844 			(strcmp($2, "yes")==0);
845 		free($2);
846 	}
847 	;
848 server_harden_below_nxdomain: VAR_HARDEN_BELOW_NXDOMAIN STRING_ARG
849 	{
850 		OUTYY(("P(server_harden_below_nxdomain:%s)\n", $2));
851 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
852 			yyerror("expected yes or no.");
853 		else cfg_parser->cfg->harden_below_nxdomain =
854 			(strcmp($2, "yes")==0);
855 		free($2);
856 	}
857 	;
858 server_harden_referral_path: VAR_HARDEN_REFERRAL_PATH STRING_ARG
859 	{
860 		OUTYY(("P(server_harden_referral_path:%s)\n", $2));
861 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
862 			yyerror("expected yes or no.");
863 		else cfg_parser->cfg->harden_referral_path =
864 			(strcmp($2, "yes")==0);
865 		free($2);
866 	}
867 	;
868 server_harden_algo_downgrade: VAR_HARDEN_ALGO_DOWNGRADE STRING_ARG
869 	{
870 		OUTYY(("P(server_harden_algo_downgrade:%s)\n", $2));
871 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
872 			yyerror("expected yes or no.");
873 		else cfg_parser->cfg->harden_algo_downgrade =
874 			(strcmp($2, "yes")==0);
875 		free($2);
876 	}
877 	;
878 server_use_caps_for_id: VAR_USE_CAPS_FOR_ID STRING_ARG
879 	{
880 		OUTYY(("P(server_use_caps_for_id:%s)\n", $2));
881 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
882 			yyerror("expected yes or no.");
883 		else cfg_parser->cfg->use_caps_bits_for_id =
884 			(strcmp($2, "yes")==0);
885 		free($2);
886 	}
887 	;
888 server_caps_whitelist: VAR_CAPS_WHITELIST STRING_ARG
889 	{
890 		OUTYY(("P(server_caps_whitelist:%s)\n", $2));
891 		if(!cfg_strlist_insert(&cfg_parser->cfg->caps_whitelist, $2))
892 			yyerror("out of memory");
893 	}
894 	;
895 server_private_address: VAR_PRIVATE_ADDRESS STRING_ARG
896 	{
897 		OUTYY(("P(server_private_address:%s)\n", $2));
898 		if(!cfg_strlist_insert(&cfg_parser->cfg->private_address, $2))
899 			yyerror("out of memory");
900 	}
901 	;
902 server_private_domain: VAR_PRIVATE_DOMAIN STRING_ARG
903 	{
904 		OUTYY(("P(server_private_domain:%s)\n", $2));
905 		if(!cfg_strlist_insert(&cfg_parser->cfg->private_domain, $2))
906 			yyerror("out of memory");
907 	}
908 	;
909 server_prefetch: VAR_PREFETCH STRING_ARG
910 	{
911 		OUTYY(("P(server_prefetch:%s)\n", $2));
912 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
913 			yyerror("expected yes or no.");
914 		else cfg_parser->cfg->prefetch = (strcmp($2, "yes")==0);
915 		free($2);
916 	}
917 	;
918 server_prefetch_key: VAR_PREFETCH_KEY STRING_ARG
919 	{
920 		OUTYY(("P(server_prefetch_key:%s)\n", $2));
921 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
922 			yyerror("expected yes or no.");
923 		else cfg_parser->cfg->prefetch_key = (strcmp($2, "yes")==0);
924 		free($2);
925 	}
926 	;
927 server_unwanted_reply_threshold: VAR_UNWANTED_REPLY_THRESHOLD STRING_ARG
928 	{
929 		OUTYY(("P(server_unwanted_reply_threshold:%s)\n", $2));
930 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
931 			yyerror("number expected");
932 		else cfg_parser->cfg->unwanted_threshold = atoi($2);
933 		free($2);
934 	}
935 	;
936 server_do_not_query_address: VAR_DO_NOT_QUERY_ADDRESS STRING_ARG
937 	{
938 		OUTYY(("P(server_do_not_query_address:%s)\n", $2));
939 		if(!cfg_strlist_insert(&cfg_parser->cfg->donotqueryaddrs, $2))
940 			yyerror("out of memory");
941 	}
942 	;
943 server_do_not_query_localhost: VAR_DO_NOT_QUERY_LOCALHOST STRING_ARG
944 	{
945 		OUTYY(("P(server_do_not_query_localhost:%s)\n", $2));
946 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
947 			yyerror("expected yes or no.");
948 		else cfg_parser->cfg->donotquery_localhost =
949 			(strcmp($2, "yes")==0);
950 		free($2);
951 	}
952 	;
953 server_access_control: VAR_ACCESS_CONTROL STRING_ARG STRING_ARG
954 	{
955 		OUTYY(("P(server_access_control:%s %s)\n", $2, $3));
956 		if(strcmp($3, "deny")!=0 && strcmp($3, "refuse")!=0 &&
957 			strcmp($3, "deny_non_local")!=0 &&
958 			strcmp($3, "refuse_non_local")!=0 &&
959 			strcmp($3, "allow")!=0 &&
960 			strcmp($3, "allow_snoop")!=0) {
961 			yyerror("expected deny, refuse, deny_non_local, "
962 				"refuse_non_local, allow or allow_snoop "
963 				"in access control action");
964 		} else {
965 			if(!cfg_str2list_insert(&cfg_parser->cfg->acls, $2, $3))
966 				fatal_exit("out of memory adding acl");
967 		}
968 	}
969 	;
970 server_module_conf: VAR_MODULE_CONF STRING_ARG
971 	{
972 		OUTYY(("P(server_module_conf:%s)\n", $2));
973 		free(cfg_parser->cfg->module_conf);
974 		cfg_parser->cfg->module_conf = $2;
975 	}
976 	;
977 server_val_override_date: VAR_VAL_OVERRIDE_DATE STRING_ARG
978 	{
979 		OUTYY(("P(server_val_override_date:%s)\n", $2));
980 		if(strlen($2) == 0 || strcmp($2, "0") == 0) {
981 			cfg_parser->cfg->val_date_override = 0;
982 		} else if(strlen($2) == 14) {
983 			cfg_parser->cfg->val_date_override =
984 				cfg_convert_timeval($2);
985 			if(!cfg_parser->cfg->val_date_override)
986 				yyerror("bad date/time specification");
987 		} else {
988 			if(atoi($2) == 0)
989 				yyerror("number expected");
990 			cfg_parser->cfg->val_date_override = atoi($2);
991 		}
992 		free($2);
993 	}
994 	;
995 server_val_sig_skew_min: VAR_VAL_SIG_SKEW_MIN STRING_ARG
996 	{
997 		OUTYY(("P(server_val_sig_skew_min:%s)\n", $2));
998 		if(strlen($2) == 0 || strcmp($2, "0") == 0) {
999 			cfg_parser->cfg->val_sig_skew_min = 0;
1000 		} else {
1001 			cfg_parser->cfg->val_sig_skew_min = atoi($2);
1002 			if(!cfg_parser->cfg->val_sig_skew_min)
1003 				yyerror("number expected");
1004 		}
1005 		free($2);
1006 	}
1007 	;
1008 server_val_sig_skew_max: VAR_VAL_SIG_SKEW_MAX STRING_ARG
1009 	{
1010 		OUTYY(("P(server_val_sig_skew_max:%s)\n", $2));
1011 		if(strlen($2) == 0 || strcmp($2, "0") == 0) {
1012 			cfg_parser->cfg->val_sig_skew_max = 0;
1013 		} else {
1014 			cfg_parser->cfg->val_sig_skew_max = atoi($2);
1015 			if(!cfg_parser->cfg->val_sig_skew_max)
1016 				yyerror("number expected");
1017 		}
1018 		free($2);
1019 	}
1020 	;
1021 server_cache_max_ttl: VAR_CACHE_MAX_TTL STRING_ARG
1022 	{
1023 		OUTYY(("P(server_cache_max_ttl:%s)\n", $2));
1024 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1025 			yyerror("number expected");
1026 		else cfg_parser->cfg->max_ttl = atoi($2);
1027 		free($2);
1028 	}
1029 	;
1030 server_cache_max_negative_ttl: VAR_CACHE_MAX_NEGATIVE_TTL STRING_ARG
1031 	{
1032 		OUTYY(("P(server_cache_max_negative_ttl:%s)\n", $2));
1033 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1034 			yyerror("number expected");
1035 		else cfg_parser->cfg->max_negative_ttl = atoi($2);
1036 		free($2);
1037 	}
1038 	;
1039 server_cache_min_ttl: VAR_CACHE_MIN_TTL STRING_ARG
1040 	{
1041 		OUTYY(("P(server_cache_min_ttl:%s)\n", $2));
1042 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1043 			yyerror("number expected");
1044 		else cfg_parser->cfg->min_ttl = atoi($2);
1045 		free($2);
1046 	}
1047 	;
1048 server_bogus_ttl: VAR_BOGUS_TTL STRING_ARG
1049 	{
1050 		OUTYY(("P(server_bogus_ttl:%s)\n", $2));
1051 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1052 			yyerror("number expected");
1053 		else cfg_parser->cfg->bogus_ttl = atoi($2);
1054 		free($2);
1055 	}
1056 	;
1057 server_val_clean_additional: VAR_VAL_CLEAN_ADDITIONAL STRING_ARG
1058 	{
1059 		OUTYY(("P(server_val_clean_additional:%s)\n", $2));
1060 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1061 			yyerror("expected yes or no.");
1062 		else cfg_parser->cfg->val_clean_additional =
1063 			(strcmp($2, "yes")==0);
1064 		free($2);
1065 	}
1066 	;
1067 server_val_permissive_mode: VAR_VAL_PERMISSIVE_MODE STRING_ARG
1068 	{
1069 		OUTYY(("P(server_val_permissive_mode:%s)\n", $2));
1070 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1071 			yyerror("expected yes or no.");
1072 		else cfg_parser->cfg->val_permissive_mode =
1073 			(strcmp($2, "yes")==0);
1074 		free($2);
1075 	}
1076 	;
1077 server_ignore_cd_flag: VAR_IGNORE_CD_FLAG STRING_ARG
1078 	{
1079 		OUTYY(("P(server_ignore_cd_flag:%s)\n", $2));
1080 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1081 			yyerror("expected yes or no.");
1082 		else cfg_parser->cfg->ignore_cd = (strcmp($2, "yes")==0);
1083 		free($2);
1084 	}
1085 	;
1086 server_val_log_level: VAR_VAL_LOG_LEVEL STRING_ARG
1087 	{
1088 		OUTYY(("P(server_val_log_level:%s)\n", $2));
1089 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1090 			yyerror("number expected");
1091 		else cfg_parser->cfg->val_log_level = atoi($2);
1092 		free($2);
1093 	}
1094 	;
1095 server_val_nsec3_keysize_iterations: VAR_VAL_NSEC3_KEYSIZE_ITERATIONS STRING_ARG
1096 	{
1097 		OUTYY(("P(server_val_nsec3_keysize_iterations:%s)\n", $2));
1098 		free(cfg_parser->cfg->val_nsec3_key_iterations);
1099 		cfg_parser->cfg->val_nsec3_key_iterations = $2;
1100 	}
1101 	;
1102 server_add_holddown: VAR_ADD_HOLDDOWN STRING_ARG
1103 	{
1104 		OUTYY(("P(server_add_holddown:%s)\n", $2));
1105 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1106 			yyerror("number expected");
1107 		else cfg_parser->cfg->add_holddown = atoi($2);
1108 		free($2);
1109 	}
1110 	;
1111 server_del_holddown: VAR_DEL_HOLDDOWN STRING_ARG
1112 	{
1113 		OUTYY(("P(server_del_holddown:%s)\n", $2));
1114 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1115 			yyerror("number expected");
1116 		else cfg_parser->cfg->del_holddown = atoi($2);
1117 		free($2);
1118 	}
1119 	;
1120 server_keep_missing: VAR_KEEP_MISSING STRING_ARG
1121 	{
1122 		OUTYY(("P(server_keep_missing:%s)\n", $2));
1123 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1124 			yyerror("number expected");
1125 		else cfg_parser->cfg->keep_missing = atoi($2);
1126 		free($2);
1127 	}
1128 	;
1129 server_permit_small_holddown: VAR_PERMIT_SMALL_HOLDDOWN STRING_ARG
1130 	{
1131 		OUTYY(("P(server_permit_small_holddown:%s)\n", $2));
1132 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1133 			yyerror("expected yes or no.");
1134 		else cfg_parser->cfg->permit_small_holddown =
1135 			(strcmp($2, "yes")==0);
1136 		free($2);
1137 	}
1138 server_key_cache_size: VAR_KEY_CACHE_SIZE STRING_ARG
1139 	{
1140 		OUTYY(("P(server_key_cache_size:%s)\n", $2));
1141 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->key_cache_size))
1142 			yyerror("memory size expected");
1143 		free($2);
1144 	}
1145 	;
1146 server_key_cache_slabs: VAR_KEY_CACHE_SLABS STRING_ARG
1147 	{
1148 		OUTYY(("P(server_key_cache_slabs:%s)\n", $2));
1149 		if(atoi($2) == 0)
1150 			yyerror("number expected");
1151 		else {
1152 			cfg_parser->cfg->key_cache_slabs = atoi($2);
1153 			if(!is_pow2(cfg_parser->cfg->key_cache_slabs))
1154 				yyerror("must be a power of 2");
1155 		}
1156 		free($2);
1157 	}
1158 	;
1159 server_neg_cache_size: VAR_NEG_CACHE_SIZE STRING_ARG
1160 	{
1161 		OUTYY(("P(server_neg_cache_size:%s)\n", $2));
1162 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->neg_cache_size))
1163 			yyerror("memory size expected");
1164 		free($2);
1165 	}
1166 	;
1167 server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
1168 	{
1169 		OUTYY(("P(server_local_zone:%s %s)\n", $2, $3));
1170 		if(strcmp($3, "static")!=0 && strcmp($3, "deny")!=0 &&
1171 		   strcmp($3, "refuse")!=0 && strcmp($3, "redirect")!=0 &&
1172 		   strcmp($3, "transparent")!=0 && strcmp($3, "nodefault")!=0
1173 		   && strcmp($3, "typetransparent")!=0 &&
1174 		   strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0)
1175 			yyerror("local-zone type: expected static, deny, "
1176 				"refuse, redirect, transparent, "
1177 				"typetransparent, inform, inform_deny "
1178 				"or nodefault");
1179 		else if(strcmp($3, "nodefault")==0) {
1180 			if(!cfg_strlist_insert(&cfg_parser->cfg->
1181 				local_zones_nodefault, $2))
1182 				fatal_exit("out of memory adding local-zone");
1183 			free($3);
1184 		} else {
1185 			if(!cfg_str2list_insert(&cfg_parser->cfg->local_zones,
1186 				$2, $3))
1187 				fatal_exit("out of memory adding local-zone");
1188 		}
1189 	}
1190 	;
1191 server_local_data: VAR_LOCAL_DATA STRING_ARG
1192 	{
1193 		OUTYY(("P(server_local_data:%s)\n", $2));
1194 		if(!cfg_strlist_insert(&cfg_parser->cfg->local_data, $2))
1195 			fatal_exit("out of memory adding local-data");
1196 	}
1197 	;
1198 server_local_data_ptr: VAR_LOCAL_DATA_PTR STRING_ARG
1199 	{
1200 		char* ptr;
1201 		OUTYY(("P(server_local_data_ptr:%s)\n", $2));
1202 		ptr = cfg_ptr_reverse($2);
1203 		free($2);
1204 		if(ptr) {
1205 			if(!cfg_strlist_insert(&cfg_parser->cfg->
1206 				local_data, ptr))
1207 				fatal_exit("out of memory adding local-data");
1208 		} else {
1209 			yyerror("local-data-ptr could not be reversed");
1210 		}
1211 	}
1212 	;
1213 server_minimal_responses: VAR_MINIMAL_RESPONSES STRING_ARG
1214 	{
1215 		OUTYY(("P(server_minimal_responses:%s)\n", $2));
1216 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1217 			yyerror("expected yes or no.");
1218 		else cfg_parser->cfg->minimal_responses =
1219 			(strcmp($2, "yes")==0);
1220 		free($2);
1221 	}
1222 	;
1223 server_rrset_roundrobin: VAR_RRSET_ROUNDROBIN STRING_ARG
1224 	{
1225 		OUTYY(("P(server_rrset_roundrobin:%s)\n", $2));
1226 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1227 			yyerror("expected yes or no.");
1228 		else cfg_parser->cfg->rrset_roundrobin =
1229 			(strcmp($2, "yes")==0);
1230 		free($2);
1231 	}
1232 	;
1233 server_max_udp_size: VAR_MAX_UDP_SIZE STRING_ARG
1234 	{
1235 		OUTYY(("P(server_max_udp_size:%s)\n", $2));
1236 		cfg_parser->cfg->max_udp_size = atoi($2);
1237 		free($2);
1238 	}
1239 	;
1240 server_dns64_prefix: VAR_DNS64_PREFIX STRING_ARG
1241 	{
1242 		OUTYY(("P(dns64_prefix:%s)\n", $2));
1243 		free(cfg_parser->cfg->dns64_prefix);
1244 		cfg_parser->cfg->dns64_prefix = $2;
1245 	}
1246 	;
1247 server_dns64_synthall: VAR_DNS64_SYNTHALL STRING_ARG
1248 	{
1249 		OUTYY(("P(server_dns64_synthall:%s)\n", $2));
1250 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1251 			yyerror("expected yes or no.");
1252 		else cfg_parser->cfg->dns64_synthall = (strcmp($2, "yes")==0);
1253 		free($2);
1254 	}
1255 	;
1256 server_ratelimit: VAR_RATELIMIT STRING_ARG
1257 	{
1258 		OUTYY(("P(server_ratelimit:%s)\n", $2));
1259 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1260 			yyerror("number expected");
1261 		else cfg_parser->cfg->ratelimit = atoi($2);
1262 		free($2);
1263 	}
1264 	;
1265 server_ratelimit_size: VAR_RATELIMIT_SIZE STRING_ARG
1266 	{
1267 		OUTYY(("P(server_ratelimit_size:%s)\n", $2));
1268 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->ratelimit_size))
1269 			yyerror("memory size expected");
1270 		free($2);
1271 	}
1272 	;
1273 server_ratelimit_slabs: VAR_RATELIMIT_SLABS STRING_ARG
1274 	{
1275 		OUTYY(("P(server_ratelimit_slabs:%s)\n", $2));
1276 		if(atoi($2) == 0)
1277 			yyerror("number expected");
1278 		else {
1279 			cfg_parser->cfg->ratelimit_slabs = atoi($2);
1280 			if(!is_pow2(cfg_parser->cfg->ratelimit_slabs))
1281 				yyerror("must be a power of 2");
1282 		}
1283 		free($2);
1284 	}
1285 	;
1286 server_ratelimit_for_domain: VAR_RATELIMIT_FOR_DOMAIN STRING_ARG STRING_ARG
1287 	{
1288 		OUTYY(("P(server_ratelimit_for_domain:%s %s)\n", $2, $3));
1289 		if(atoi($3) == 0 && strcmp($3, "0") != 0) {
1290 			yyerror("number expected");
1291 		} else {
1292 			if(!cfg_str2list_insert(&cfg_parser->cfg->
1293 				ratelimit_for_domain, $2, $3))
1294 				fatal_exit("out of memory adding "
1295 					"ratelimit-for-domain");
1296 		}
1297 	}
1298 	;
1299 server_ratelimit_below_domain: VAR_RATELIMIT_BELOW_DOMAIN STRING_ARG STRING_ARG
1300 	{
1301 		OUTYY(("P(server_ratelimit_below_domain:%s %s)\n", $2, $3));
1302 		if(atoi($3) == 0 && strcmp($3, "0") != 0) {
1303 			yyerror("number expected");
1304 		} else {
1305 			if(!cfg_str2list_insert(&cfg_parser->cfg->
1306 				ratelimit_below_domain, $2, $3))
1307 				fatal_exit("out of memory adding "
1308 					"ratelimit-below-domain");
1309 		}
1310 	}
1311 	;
1312 server_ratelimit_factor: VAR_RATELIMIT_FACTOR STRING_ARG
1313 	{
1314 		OUTYY(("P(server_ratelimit_factor:%s)\n", $2));
1315 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1316 			yyerror("number expected");
1317 		else cfg_parser->cfg->ratelimit_factor = atoi($2);
1318 		free($2);
1319 	}
1320 	;
1321 stub_name: VAR_NAME STRING_ARG
1322 	{
1323 		OUTYY(("P(name:%s)\n", $2));
1324 		if(cfg_parser->cfg->stubs->name)
1325 			yyerror("stub name override, there must be one name "
1326 				"for one stub-zone");
1327 		free(cfg_parser->cfg->stubs->name);
1328 		cfg_parser->cfg->stubs->name = $2;
1329 	}
1330 	;
1331 stub_host: VAR_STUB_HOST STRING_ARG
1332 	{
1333 		OUTYY(("P(stub-host:%s)\n", $2));
1334 		if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->hosts, $2))
1335 			yyerror("out of memory");
1336 	}
1337 	;
1338 stub_addr: VAR_STUB_ADDR STRING_ARG
1339 	{
1340 		OUTYY(("P(stub-addr:%s)\n", $2));
1341 		if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->addrs, $2))
1342 			yyerror("out of memory");
1343 	}
1344 	;
1345 stub_first: VAR_STUB_FIRST STRING_ARG
1346 	{
1347 		OUTYY(("P(stub-first:%s)\n", $2));
1348 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1349 			yyerror("expected yes or no.");
1350 		else cfg_parser->cfg->stubs->isfirst=(strcmp($2, "yes")==0);
1351 		free($2);
1352 	}
1353 	;
1354 stub_prime: VAR_STUB_PRIME STRING_ARG
1355 	{
1356 		OUTYY(("P(stub-prime:%s)\n", $2));
1357 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1358 			yyerror("expected yes or no.");
1359 		else cfg_parser->cfg->stubs->isprime =
1360 			(strcmp($2, "yes")==0);
1361 		free($2);
1362 	}
1363 	;
1364 forward_name: VAR_NAME STRING_ARG
1365 	{
1366 		OUTYY(("P(name:%s)\n", $2));
1367 		if(cfg_parser->cfg->forwards->name)
1368 			yyerror("forward name override, there must be one "
1369 				"name for one forward-zone");
1370 		free(cfg_parser->cfg->forwards->name);
1371 		cfg_parser->cfg->forwards->name = $2;
1372 	}
1373 	;
1374 forward_host: VAR_FORWARD_HOST STRING_ARG
1375 	{
1376 		OUTYY(("P(forward-host:%s)\n", $2));
1377 		if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->hosts, $2))
1378 			yyerror("out of memory");
1379 	}
1380 	;
1381 forward_addr: VAR_FORWARD_ADDR STRING_ARG
1382 	{
1383 		OUTYY(("P(forward-addr:%s)\n", $2));
1384 		if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->addrs, $2))
1385 			yyerror("out of memory");
1386 	}
1387 	;
1388 forward_first: VAR_FORWARD_FIRST STRING_ARG
1389 	{
1390 		OUTYY(("P(forward-first:%s)\n", $2));
1391 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1392 			yyerror("expected yes or no.");
1393 		else cfg_parser->cfg->forwards->isfirst=(strcmp($2, "yes")==0);
1394 		free($2);
1395 	}
1396 	;
1397 rcstart: VAR_REMOTE_CONTROL
1398 	{
1399 		OUTYY(("\nP(remote-control:)\n"));
1400 	}
1401 	;
1402 contents_rc: contents_rc content_rc
1403 	| ;
1404 content_rc: rc_control_enable | rc_control_interface | rc_control_port |
1405 	rc_server_key_file | rc_server_cert_file | rc_control_key_file |
1406 	rc_control_cert_file | rc_control_use_cert
1407 	;
1408 rc_control_enable: VAR_CONTROL_ENABLE STRING_ARG
1409 	{
1410 		OUTYY(("P(control_enable:%s)\n", $2));
1411 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1412 			yyerror("expected yes or no.");
1413 		else cfg_parser->cfg->remote_control_enable =
1414 			(strcmp($2, "yes")==0);
1415 		free($2);
1416 	}
1417 	;
1418 rc_control_port: VAR_CONTROL_PORT STRING_ARG
1419 	{
1420 		OUTYY(("P(control_port:%s)\n", $2));
1421 		if(atoi($2) == 0)
1422 			yyerror("control port number expected");
1423 		else cfg_parser->cfg->control_port = atoi($2);
1424 		free($2);
1425 	}
1426 	;
1427 rc_control_interface: VAR_CONTROL_INTERFACE STRING_ARG
1428 	{
1429 		OUTYY(("P(control_interface:%s)\n", $2));
1430 		if(!cfg_strlist_insert(&cfg_parser->cfg->control_ifs, $2))
1431 			yyerror("out of memory");
1432 	}
1433 	;
1434 rc_control_use_cert: VAR_CONTROL_USE_CERT STRING_ARG
1435 	{
1436 		OUTYY(("P(control_use_cert:%s)\n", $2));
1437 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1438 			yyerror("expected yes or no.");
1439 		else cfg_parser->cfg->remote_control_use_cert =
1440 			(strcmp($2, "yes")==0);
1441 		free($2);
1442 	}
1443 	;
1444 rc_server_key_file: VAR_SERVER_KEY_FILE STRING_ARG
1445 	{
1446 		OUTYY(("P(rc_server_key_file:%s)\n", $2));
1447 		free(cfg_parser->cfg->server_key_file);
1448 		cfg_parser->cfg->server_key_file = $2;
1449 	}
1450 	;
1451 rc_server_cert_file: VAR_SERVER_CERT_FILE STRING_ARG
1452 	{
1453 		OUTYY(("P(rc_server_cert_file:%s)\n", $2));
1454 		free(cfg_parser->cfg->server_cert_file);
1455 		cfg_parser->cfg->server_cert_file = $2;
1456 	}
1457 	;
1458 rc_control_key_file: VAR_CONTROL_KEY_FILE STRING_ARG
1459 	{
1460 		OUTYY(("P(rc_control_key_file:%s)\n", $2));
1461 		free(cfg_parser->cfg->control_key_file);
1462 		cfg_parser->cfg->control_key_file = $2;
1463 	}
1464 	;
1465 rc_control_cert_file: VAR_CONTROL_CERT_FILE STRING_ARG
1466 	{
1467 		OUTYY(("P(rc_control_cert_file:%s)\n", $2));
1468 		free(cfg_parser->cfg->control_cert_file);
1469 		cfg_parser->cfg->control_cert_file = $2;
1470 	}
1471 	;
1472 dtstart: VAR_DNSTAP
1473 	{
1474 		OUTYY(("\nP(dnstap:)\n"));
1475 	}
1476 	;
1477 contents_dt: contents_dt content_dt
1478 	| ;
1479 content_dt: dt_dnstap_enable | dt_dnstap_socket_path |
1480 	dt_dnstap_send_identity | dt_dnstap_send_version |
1481 	dt_dnstap_identity | dt_dnstap_version |
1482 	dt_dnstap_log_resolver_query_messages |
1483 	dt_dnstap_log_resolver_response_messages |
1484 	dt_dnstap_log_client_query_messages |
1485 	dt_dnstap_log_client_response_messages |
1486 	dt_dnstap_log_forwarder_query_messages |
1487 	dt_dnstap_log_forwarder_response_messages
1488 	;
1489 dt_dnstap_enable: VAR_DNSTAP_ENABLE STRING_ARG
1490 	{
1491 		OUTYY(("P(dt_dnstap_enable:%s)\n", $2));
1492 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1493 			yyerror("expected yes or no.");
1494 		else cfg_parser->cfg->dnstap = (strcmp($2, "yes")==0);
1495 	}
1496 	;
1497 dt_dnstap_socket_path: VAR_DNSTAP_SOCKET_PATH STRING_ARG
1498 	{
1499 		OUTYY(("P(dt_dnstap_socket_path:%s)\n", $2));
1500 		free(cfg_parser->cfg->dnstap_socket_path);
1501 		cfg_parser->cfg->dnstap_socket_path = $2;
1502 	}
1503 	;
1504 dt_dnstap_send_identity: VAR_DNSTAP_SEND_IDENTITY STRING_ARG
1505 	{
1506 		OUTYY(("P(dt_dnstap_send_identity:%s)\n", $2));
1507 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1508 			yyerror("expected yes or no.");
1509 		else cfg_parser->cfg->dnstap_send_identity = (strcmp($2, "yes")==0);
1510 	}
1511 	;
1512 dt_dnstap_send_version: VAR_DNSTAP_SEND_VERSION STRING_ARG
1513 	{
1514 		OUTYY(("P(dt_dnstap_send_version:%s)\n", $2));
1515 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1516 			yyerror("expected yes or no.");
1517 		else cfg_parser->cfg->dnstap_send_version = (strcmp($2, "yes")==0);
1518 	}
1519 	;
1520 dt_dnstap_identity: VAR_DNSTAP_IDENTITY STRING_ARG
1521 	{
1522 		OUTYY(("P(dt_dnstap_identity:%s)\n", $2));
1523 		free(cfg_parser->cfg->dnstap_identity);
1524 		cfg_parser->cfg->dnstap_identity = $2;
1525 	}
1526 	;
1527 dt_dnstap_version: VAR_DNSTAP_VERSION STRING_ARG
1528 	{
1529 		OUTYY(("P(dt_dnstap_version:%s)\n", $2));
1530 		free(cfg_parser->cfg->dnstap_version);
1531 		cfg_parser->cfg->dnstap_version = $2;
1532 	}
1533 	;
1534 dt_dnstap_log_resolver_query_messages: VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES STRING_ARG
1535 	{
1536 		OUTYY(("P(dt_dnstap_log_resolver_query_messages:%s)\n", $2));
1537 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1538 			yyerror("expected yes or no.");
1539 		else cfg_parser->cfg->dnstap_log_resolver_query_messages =
1540 			(strcmp($2, "yes")==0);
1541 	}
1542 	;
1543 dt_dnstap_log_resolver_response_messages: VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES STRING_ARG
1544 	{
1545 		OUTYY(("P(dt_dnstap_log_resolver_response_messages:%s)\n", $2));
1546 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1547 			yyerror("expected yes or no.");
1548 		else cfg_parser->cfg->dnstap_log_resolver_response_messages =
1549 			(strcmp($2, "yes")==0);
1550 	}
1551 	;
1552 dt_dnstap_log_client_query_messages: VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES STRING_ARG
1553 	{
1554 		OUTYY(("P(dt_dnstap_log_client_query_messages:%s)\n", $2));
1555 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1556 			yyerror("expected yes or no.");
1557 		else cfg_parser->cfg->dnstap_log_client_query_messages =
1558 			(strcmp($2, "yes")==0);
1559 	}
1560 	;
1561 dt_dnstap_log_client_response_messages: VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES STRING_ARG
1562 	{
1563 		OUTYY(("P(dt_dnstap_log_client_response_messages:%s)\n", $2));
1564 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1565 			yyerror("expected yes or no.");
1566 		else cfg_parser->cfg->dnstap_log_client_response_messages =
1567 			(strcmp($2, "yes")==0);
1568 	}
1569 	;
1570 dt_dnstap_log_forwarder_query_messages: VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES STRING_ARG
1571 	{
1572 		OUTYY(("P(dt_dnstap_log_forwarder_query_messages:%s)\n", $2));
1573 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1574 			yyerror("expected yes or no.");
1575 		else cfg_parser->cfg->dnstap_log_forwarder_query_messages =
1576 			(strcmp($2, "yes")==0);
1577 	}
1578 	;
1579 dt_dnstap_log_forwarder_response_messages: VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES STRING_ARG
1580 	{
1581 		OUTYY(("P(dt_dnstap_log_forwarder_response_messages:%s)\n", $2));
1582 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1583 			yyerror("expected yes or no.");
1584 		else cfg_parser->cfg->dnstap_log_forwarder_response_messages =
1585 			(strcmp($2, "yes")==0);
1586 	}
1587 	;
1588 pythonstart: VAR_PYTHON
1589 	{
1590 		OUTYY(("\nP(python:)\n"));
1591 	}
1592 	;
1593 contents_py: contents_py content_py
1594 	| ;
1595 content_py: py_script
1596 	;
1597 py_script: VAR_PYTHON_SCRIPT STRING_ARG
1598 	{
1599 		OUTYY(("P(python-script:%s)\n", $2));
1600 		free(cfg_parser->cfg->python_script);
1601 		cfg_parser->cfg->python_script = $2;
1602 	}
1603 %%
1604 
1605 /* parse helper routines could be here */
1606