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