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