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