xref: /freebsd/contrib/unbound/util/configparser.y (revision 1f1e2261e341e6ca6862f82261066ef1705f0a7a)
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 static void validate_respip_action(const char* action);
55 
56 /* these need to be global, otherwise they cannot be used inside yacc */
57 extern struct config_parser_state* cfg_parser;
58 
59 #if 0
60 #define OUTYY(s)  printf s /* used ONLY when debugging */
61 #else
62 #define OUTYY(s)
63 #endif
64 
65 %}
66 %union {
67 	char*	str;
68 };
69 
70 %token SPACE LETTER NEWLINE COMMENT COLON ANY ZONESTR
71 %token <str> STRING_ARG
72 %token VAR_FORCE_TOPLEVEL
73 %token VAR_SERVER VAR_VERBOSITY VAR_NUM_THREADS VAR_PORT
74 %token VAR_OUTGOING_RANGE VAR_INTERFACE VAR_PREFER_IP4
75 %token VAR_DO_IP4 VAR_DO_IP6 VAR_PREFER_IP6 VAR_DO_UDP VAR_DO_TCP
76 %token VAR_TCP_MSS VAR_OUTGOING_TCP_MSS VAR_TCP_IDLE_TIMEOUT
77 %token VAR_EDNS_TCP_KEEPALIVE VAR_EDNS_TCP_KEEPALIVE_TIMEOUT
78 %token VAR_CHROOT VAR_USERNAME VAR_DIRECTORY VAR_LOGFILE VAR_PIDFILE
79 %token VAR_MSG_CACHE_SIZE VAR_MSG_CACHE_SLABS VAR_NUM_QUERIES_PER_THREAD
80 %token VAR_RRSET_CACHE_SIZE VAR_RRSET_CACHE_SLABS VAR_OUTGOING_NUM_TCP
81 %token VAR_INFRA_HOST_TTL VAR_INFRA_LAME_TTL VAR_INFRA_CACHE_SLABS
82 %token VAR_INFRA_CACHE_NUMHOSTS VAR_INFRA_CACHE_LAME_SIZE VAR_NAME
83 %token VAR_STUB_ZONE VAR_STUB_HOST VAR_STUB_ADDR VAR_TARGET_FETCH_POLICY
84 %token VAR_HARDEN_SHORT_BUFSIZE VAR_HARDEN_LARGE_QUERIES
85 %token VAR_FORWARD_ZONE VAR_FORWARD_HOST VAR_FORWARD_ADDR
86 %token VAR_DO_NOT_QUERY_ADDRESS VAR_HIDE_IDENTITY VAR_HIDE_VERSION
87 %token VAR_IDENTITY VAR_VERSION VAR_HARDEN_GLUE VAR_MODULE_CONF
88 %token VAR_TRUST_ANCHOR_FILE VAR_TRUST_ANCHOR VAR_VAL_OVERRIDE_DATE
89 %token VAR_BOGUS_TTL VAR_VAL_CLEAN_ADDITIONAL VAR_VAL_PERMISSIVE_MODE
90 %token VAR_INCOMING_NUM_TCP VAR_MSG_BUFFER_SIZE VAR_KEY_CACHE_SIZE
91 %token VAR_KEY_CACHE_SLABS VAR_TRUSTED_KEYS_FILE
92 %token VAR_VAL_NSEC3_KEYSIZE_ITERATIONS VAR_USE_SYSLOG
93 %token VAR_OUTGOING_INTERFACE VAR_ROOT_HINTS VAR_DO_NOT_QUERY_LOCALHOST
94 %token VAR_CACHE_MAX_TTL VAR_HARDEN_DNSSEC_STRIPPED VAR_ACCESS_CONTROL
95 %token VAR_LOCAL_ZONE VAR_LOCAL_DATA VAR_INTERFACE_AUTOMATIC
96 %token VAR_STATISTICS_INTERVAL VAR_DO_DAEMONIZE VAR_USE_CAPS_FOR_ID
97 %token VAR_STATISTICS_CUMULATIVE VAR_OUTGOING_PORT_PERMIT
98 %token VAR_OUTGOING_PORT_AVOID VAR_DLV_ANCHOR_FILE VAR_DLV_ANCHOR
99 %token VAR_NEG_CACHE_SIZE VAR_HARDEN_REFERRAL_PATH VAR_PRIVATE_ADDRESS
100 %token VAR_PRIVATE_DOMAIN VAR_REMOTE_CONTROL VAR_CONTROL_ENABLE
101 %token VAR_CONTROL_INTERFACE VAR_CONTROL_PORT VAR_SERVER_KEY_FILE
102 %token VAR_SERVER_CERT_FILE VAR_CONTROL_KEY_FILE VAR_CONTROL_CERT_FILE
103 %token VAR_CONTROL_USE_CERT VAR_TCP_REUSE_TIMEOUT VAR_MAX_REUSE_TCP_QUERIES
104 %token VAR_EXTENDED_STATISTICS VAR_LOCAL_DATA_PTR VAR_JOSTLE_TIMEOUT
105 %token VAR_STUB_PRIME VAR_UNWANTED_REPLY_THRESHOLD VAR_LOG_TIME_ASCII
106 %token VAR_DOMAIN_INSECURE VAR_PYTHON VAR_PYTHON_SCRIPT VAR_VAL_SIG_SKEW_MIN
107 %token VAR_VAL_SIG_SKEW_MAX VAR_VAL_MAX_RESTART VAR_CACHE_MIN_TTL
108 %token VAR_VAL_LOG_LEVEL VAR_AUTO_TRUST_ANCHOR_FILE VAR_KEEP_MISSING
109 %token VAR_ADD_HOLDDOWN VAR_DEL_HOLDDOWN VAR_SO_RCVBUF VAR_EDNS_BUFFER_SIZE
110 %token VAR_PREFETCH VAR_PREFETCH_KEY VAR_SO_SNDBUF VAR_SO_REUSEPORT
111 %token VAR_HARDEN_BELOW_NXDOMAIN VAR_IGNORE_CD_FLAG VAR_LOG_QUERIES
112 %token VAR_LOG_REPLIES VAR_LOG_LOCAL_ACTIONS VAR_TCP_UPSTREAM
113 %token VAR_SSL_UPSTREAM VAR_TCP_AUTH_QUERY_TIMEOUT VAR_SSL_SERVICE_KEY
114 %token VAR_SSL_SERVICE_PEM VAR_SSL_PORT VAR_FORWARD_FIRST
115 %token VAR_STUB_SSL_UPSTREAM VAR_FORWARD_SSL_UPSTREAM VAR_TLS_CERT_BUNDLE
116 %token VAR_STUB_TCP_UPSTREAM VAR_FORWARD_TCP_UPSTREAM
117 %token VAR_HTTPS_PORT VAR_HTTP_ENDPOINT VAR_HTTP_MAX_STREAMS
118 %token VAR_HTTP_QUERY_BUFFER_SIZE VAR_HTTP_RESPONSE_BUFFER_SIZE
119 %token VAR_HTTP_NODELAY VAR_HTTP_NOTLS_DOWNSTREAM
120 %token VAR_STUB_FIRST VAR_MINIMAL_RESPONSES VAR_RRSET_ROUNDROBIN
121 %token VAR_MAX_UDP_SIZE VAR_DELAY_CLOSE VAR_UDP_CONNECT
122 %token VAR_UNBLOCK_LAN_ZONES VAR_INSECURE_LAN_ZONES
123 %token VAR_INFRA_CACHE_MIN_RTT VAR_INFRA_KEEP_PROBING
124 %token VAR_DNS64_PREFIX VAR_DNS64_SYNTHALL VAR_DNS64_IGNORE_AAAA
125 %token VAR_DNSTAP VAR_DNSTAP_ENABLE VAR_DNSTAP_SOCKET_PATH VAR_DNSTAP_IP
126 %token VAR_DNSTAP_TLS VAR_DNSTAP_TLS_SERVER_NAME VAR_DNSTAP_TLS_CERT_BUNDLE
127 %token VAR_DNSTAP_TLS_CLIENT_KEY_FILE VAR_DNSTAP_TLS_CLIENT_CERT_FILE
128 %token VAR_DNSTAP_SEND_IDENTITY VAR_DNSTAP_SEND_VERSION VAR_DNSTAP_BIDIRECTIONAL
129 %token VAR_DNSTAP_IDENTITY VAR_DNSTAP_VERSION
130 %token VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES
131 %token VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES
132 %token VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES
133 %token VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES
134 %token VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES
135 %token VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES
136 %token VAR_RESPONSE_IP_TAG VAR_RESPONSE_IP VAR_RESPONSE_IP_DATA
137 %token VAR_HARDEN_ALGO_DOWNGRADE VAR_IP_TRANSPARENT
138 %token VAR_IP_DSCP
139 %token VAR_DISABLE_DNSSEC_LAME_CHECK
140 %token VAR_IP_RATELIMIT VAR_IP_RATELIMIT_SLABS VAR_IP_RATELIMIT_SIZE
141 %token VAR_RATELIMIT VAR_RATELIMIT_SLABS VAR_RATELIMIT_SIZE
142 %token VAR_OUTBOUND_MSG_RETRY
143 %token VAR_RATELIMIT_FOR_DOMAIN VAR_RATELIMIT_BELOW_DOMAIN
144 %token VAR_IP_RATELIMIT_FACTOR VAR_RATELIMIT_FACTOR
145 %token VAR_IP_RATELIMIT_BACKOFF VAR_RATELIMIT_BACKOFF
146 %token VAR_SEND_CLIENT_SUBNET VAR_CLIENT_SUBNET_ZONE
147 %token VAR_CLIENT_SUBNET_ALWAYS_FORWARD VAR_CLIENT_SUBNET_OPCODE
148 %token VAR_MAX_CLIENT_SUBNET_IPV4 VAR_MAX_CLIENT_SUBNET_IPV6
149 %token VAR_MIN_CLIENT_SUBNET_IPV4 VAR_MIN_CLIENT_SUBNET_IPV6
150 %token VAR_MAX_ECS_TREE_SIZE_IPV4 VAR_MAX_ECS_TREE_SIZE_IPV6
151 %token VAR_CAPS_WHITELIST VAR_CACHE_MAX_NEGATIVE_TTL VAR_PERMIT_SMALL_HOLDDOWN
152 %token VAR_QNAME_MINIMISATION VAR_QNAME_MINIMISATION_STRICT VAR_IP_FREEBIND
153 %token VAR_DEFINE_TAG VAR_LOCAL_ZONE_TAG VAR_ACCESS_CONTROL_TAG
154 %token VAR_LOCAL_ZONE_OVERRIDE VAR_ACCESS_CONTROL_TAG_ACTION
155 %token VAR_ACCESS_CONTROL_TAG_DATA VAR_VIEW VAR_ACCESS_CONTROL_VIEW
156 %token VAR_VIEW_FIRST VAR_SERVE_EXPIRED VAR_SERVE_EXPIRED_TTL
157 %token VAR_SERVE_EXPIRED_TTL_RESET VAR_SERVE_EXPIRED_REPLY_TTL
158 %token VAR_SERVE_EXPIRED_CLIENT_TIMEOUT VAR_EDE_SERVE_EXPIRED
159 %token VAR_SERVE_ORIGINAL_TTL VAR_FAKE_DSA
160 %token VAR_FAKE_SHA1 VAR_LOG_IDENTITY VAR_HIDE_TRUSTANCHOR
161 %token VAR_HIDE_HTTP_USER_AGENT VAR_HTTP_USER_AGENT
162 %token VAR_TRUST_ANCHOR_SIGNALING VAR_AGGRESSIVE_NSEC VAR_USE_SYSTEMD
163 %token VAR_SHM_ENABLE VAR_SHM_KEY VAR_ROOT_KEY_SENTINEL
164 %token VAR_DNSCRYPT VAR_DNSCRYPT_ENABLE VAR_DNSCRYPT_PORT VAR_DNSCRYPT_PROVIDER
165 %token VAR_DNSCRYPT_SECRET_KEY VAR_DNSCRYPT_PROVIDER_CERT
166 %token VAR_DNSCRYPT_PROVIDER_CERT_ROTATED
167 %token VAR_DNSCRYPT_SHARED_SECRET_CACHE_SIZE
168 %token VAR_DNSCRYPT_SHARED_SECRET_CACHE_SLABS
169 %token VAR_DNSCRYPT_NONCE_CACHE_SIZE
170 %token VAR_DNSCRYPT_NONCE_CACHE_SLABS
171 %token VAR_PAD_RESPONSES VAR_PAD_RESPONSES_BLOCK_SIZE
172 %token VAR_PAD_QUERIES VAR_PAD_QUERIES_BLOCK_SIZE
173 %token VAR_IPSECMOD_ENABLED VAR_IPSECMOD_HOOK VAR_IPSECMOD_IGNORE_BOGUS
174 %token VAR_IPSECMOD_MAX_TTL VAR_IPSECMOD_WHITELIST VAR_IPSECMOD_STRICT
175 %token VAR_CACHEDB VAR_CACHEDB_BACKEND VAR_CACHEDB_SECRETSEED
176 %token VAR_CACHEDB_REDISHOST VAR_CACHEDB_REDISPORT VAR_CACHEDB_REDISTIMEOUT
177 %token VAR_CACHEDB_REDISEXPIRERECORDS
178 %token VAR_UDP_UPSTREAM_WITHOUT_DOWNSTREAM VAR_FOR_UPSTREAM
179 %token VAR_AUTH_ZONE VAR_ZONEFILE VAR_MASTER VAR_URL VAR_FOR_DOWNSTREAM
180 %token VAR_FALLBACK_ENABLED VAR_TLS_ADDITIONAL_PORT VAR_LOW_RTT VAR_LOW_RTT_PERMIL
181 %token VAR_FAST_SERVER_PERMIL VAR_FAST_SERVER_NUM
182 %token VAR_ALLOW_NOTIFY VAR_TLS_WIN_CERT VAR_TCP_CONNECTION_LIMIT
183 %token VAR_FORWARD_NO_CACHE VAR_STUB_NO_CACHE VAR_LOG_SERVFAIL VAR_DENY_ANY
184 %token VAR_UNKNOWN_SERVER_TIME_LIMIT VAR_LOG_TAG_QUERYREPLY
185 %token VAR_STREAM_WAIT_SIZE VAR_TLS_CIPHERS VAR_TLS_CIPHERSUITES VAR_TLS_USE_SNI
186 %token VAR_IPSET VAR_IPSET_NAME_V4 VAR_IPSET_NAME_V6
187 %token VAR_TLS_SESSION_TICKET_KEYS VAR_RPZ VAR_TAGS VAR_RPZ_ACTION_OVERRIDE
188 %token VAR_RPZ_CNAME_OVERRIDE VAR_RPZ_LOG VAR_RPZ_LOG_NAME
189 %token VAR_DYNLIB VAR_DYNLIB_FILE VAR_EDNS_CLIENT_STRING
190 %token VAR_EDNS_CLIENT_STRING_OPCODE VAR_NSID
191 %token VAR_ZONEMD_PERMISSIVE_MODE VAR_ZONEMD_CHECK VAR_ZONEMD_REJECT_ABSENCE
192 %token VAR_RPZ_SIGNAL_NXDOMAIN_RA VAR_INTERFACE_AUTOMATIC_PORTS VAR_EDE
193 
194 %%
195 toplevelvars: /* empty */ | toplevelvars toplevelvar ;
196 toplevelvar: serverstart contents_server | stubstart contents_stub |
197 	forwardstart contents_forward | pythonstart contents_py |
198 	rcstart contents_rc | dtstart contents_dt | viewstart contents_view |
199 	dnscstart contents_dnsc | cachedbstart contents_cachedb |
200 	ipsetstart contents_ipset | authstart contents_auth |
201 	rpzstart contents_rpz | dynlibstart contents_dl |
202 	force_toplevel
203 	;
204 force_toplevel: VAR_FORCE_TOPLEVEL
205 	{
206 		OUTYY(("\nP(force-toplevel)\n"));
207 	}
208 	;
209 /* server: declaration */
210 serverstart: VAR_SERVER
211 	{
212 		OUTYY(("\nP(server:)\n"));
213 	}
214 	;
215 contents_server: contents_server content_server
216 	| ;
217 content_server: server_num_threads | server_verbosity | server_port |
218 	server_outgoing_range | server_do_ip4 |
219 	server_do_ip6 | server_prefer_ip4 | server_prefer_ip6 |
220 	server_do_udp | server_do_tcp |
221 	server_tcp_mss | server_outgoing_tcp_mss | server_tcp_idle_timeout |
222 	server_tcp_keepalive | server_tcp_keepalive_timeout |
223 	server_interface | server_chroot | server_username |
224 	server_directory | server_logfile | server_pidfile |
225 	server_msg_cache_size | server_msg_cache_slabs |
226 	server_num_queries_per_thread | server_rrset_cache_size |
227 	server_rrset_cache_slabs | server_outgoing_num_tcp |
228 	server_infra_host_ttl | server_infra_lame_ttl |
229 	server_infra_cache_slabs | server_infra_cache_numhosts |
230 	server_infra_cache_lame_size | server_target_fetch_policy |
231 	server_harden_short_bufsize | server_harden_large_queries |
232 	server_do_not_query_address | server_hide_identity |
233 	server_hide_version | server_identity | server_version |
234 	server_hide_http_user_agent | server_http_user_agent |
235 	server_harden_glue | server_module_conf | server_trust_anchor_file |
236 	server_trust_anchor | server_val_override_date | server_bogus_ttl |
237 	server_val_clean_additional | server_val_permissive_mode |
238 	server_incoming_num_tcp | server_msg_buffer_size |
239 	server_key_cache_size | server_key_cache_slabs |
240 	server_trusted_keys_file | server_val_nsec3_keysize_iterations |
241 	server_use_syslog | server_outgoing_interface | server_root_hints |
242 	server_do_not_query_localhost | server_cache_max_ttl |
243 	server_harden_dnssec_stripped | server_access_control |
244 	server_local_zone | server_local_data | server_interface_automatic |
245 	server_statistics_interval | server_do_daemonize |
246 	server_use_caps_for_id | server_statistics_cumulative |
247 	server_outgoing_port_permit | server_outgoing_port_avoid |
248 	server_dlv_anchor_file | server_dlv_anchor | server_neg_cache_size |
249 	server_harden_referral_path | server_private_address |
250 	server_private_domain | server_extended_statistics |
251 	server_local_data_ptr | server_jostle_timeout |
252 	server_unwanted_reply_threshold | server_log_time_ascii |
253 	server_domain_insecure | server_val_sig_skew_min |
254 	server_val_sig_skew_max | server_val_max_restart |
255 	server_cache_min_ttl | server_val_log_level |
256 	server_auto_trust_anchor_file |	server_add_holddown |
257 	server_del_holddown | server_keep_missing | server_so_rcvbuf |
258 	server_edns_buffer_size | server_prefetch | server_prefetch_key |
259 	server_so_sndbuf | server_harden_below_nxdomain | server_ignore_cd_flag |
260 	server_log_queries | server_log_replies | server_tcp_upstream | server_ssl_upstream |
261 	server_log_local_actions |
262 	server_ssl_service_key | server_ssl_service_pem | server_ssl_port |
263 	server_https_port | server_http_endpoint | server_http_max_streams |
264 	server_http_query_buffer_size | server_http_response_buffer_size |
265 	server_http_nodelay | server_http_notls_downstream |
266 	server_minimal_responses | server_rrset_roundrobin | server_max_udp_size |
267 	server_so_reuseport | server_delay_close | server_udp_connect |
268 	server_unblock_lan_zones | server_insecure_lan_zones |
269 	server_dns64_prefix | server_dns64_synthall | server_dns64_ignore_aaaa |
270 	server_infra_cache_min_rtt | server_harden_algo_downgrade |
271 	server_ip_transparent | server_ip_ratelimit | server_ratelimit |
272 	server_ip_dscp | server_infra_keep_probing |
273 	server_ip_ratelimit_slabs | server_ratelimit_slabs |
274 	server_ip_ratelimit_size | server_ratelimit_size |
275 	server_ratelimit_for_domain |
276 	server_ratelimit_below_domain | server_ratelimit_factor |
277 	server_ip_ratelimit_factor | server_ratelimit_backoff |
278 	server_ip_ratelimit_backoff | server_outbound_msg_retry |
279 	server_send_client_subnet | server_client_subnet_zone |
280 	server_client_subnet_always_forward | server_client_subnet_opcode |
281 	server_max_client_subnet_ipv4 | server_max_client_subnet_ipv6 |
282 	server_min_client_subnet_ipv4 | server_min_client_subnet_ipv6 |
283 	server_max_ecs_tree_size_ipv4 | server_max_ecs_tree_size_ipv6 |
284 	server_caps_whitelist | server_cache_max_negative_ttl |
285 	server_permit_small_holddown | server_qname_minimisation |
286 	server_ip_freebind | server_define_tag | server_local_zone_tag |
287 	server_disable_dnssec_lame_check | server_access_control_tag |
288 	server_local_zone_override | server_access_control_tag_action |
289 	server_access_control_tag_data | server_access_control_view |
290 	server_qname_minimisation_strict |
291 	server_pad_responses | server_pad_responses_block_size |
292 	server_pad_queries | server_pad_queries_block_size |
293 	server_serve_expired |
294 	server_serve_expired_ttl | server_serve_expired_ttl_reset |
295 	server_serve_expired_reply_ttl | server_serve_expired_client_timeout |
296 	server_ede_serve_expired | server_serve_original_ttl | server_fake_dsa |
297 	server_log_identity | server_use_systemd |
298 	server_response_ip_tag | server_response_ip | server_response_ip_data |
299 	server_shm_enable | server_shm_key | server_fake_sha1 |
300 	server_hide_trustanchor | server_trust_anchor_signaling |
301 	server_root_key_sentinel |
302 	server_ipsecmod_enabled | server_ipsecmod_hook |
303 	server_ipsecmod_ignore_bogus | server_ipsecmod_max_ttl |
304 	server_ipsecmod_whitelist | server_ipsecmod_strict |
305 	server_udp_upstream_without_downstream | server_aggressive_nsec |
306 	server_tls_cert_bundle | server_tls_additional_port | server_low_rtt |
307 	server_fast_server_permil | server_fast_server_num  | server_tls_win_cert |
308 	server_tcp_connection_limit | server_log_servfail | server_deny_any |
309 	server_unknown_server_time_limit | server_log_tag_queryreply |
310 	server_stream_wait_size | server_tls_ciphers |
311 	server_tls_ciphersuites | server_tls_session_ticket_keys |
312 	server_tls_use_sni | server_edns_client_string |
313 	server_edns_client_string_opcode | server_nsid |
314 	server_zonemd_permissive_mode | server_max_reuse_tcp_queries |
315 	server_tcp_reuse_timeout | server_tcp_auth_query_timeout |
316 	server_interface_automatic_ports | server_ede
317 
318 	;
319 stubstart: VAR_STUB_ZONE
320 	{
321 		struct config_stub* s;
322 		OUTYY(("\nP(stub_zone:)\n"));
323 		s = (struct config_stub*)calloc(1, sizeof(struct config_stub));
324 		if(s) {
325 			s->next = cfg_parser->cfg->stubs;
326 			cfg_parser->cfg->stubs = s;
327 		} else {
328 			yyerror("out of memory");
329 		}
330 	}
331 	;
332 contents_stub: contents_stub content_stub
333 	| ;
334 content_stub: stub_name | stub_host | stub_addr | stub_prime | stub_first |
335 	stub_no_cache | stub_ssl_upstream | stub_tcp_upstream
336 	;
337 forwardstart: VAR_FORWARD_ZONE
338 	{
339 		struct config_stub* s;
340 		OUTYY(("\nP(forward_zone:)\n"));
341 		s = (struct config_stub*)calloc(1, sizeof(struct config_stub));
342 		if(s) {
343 			s->next = cfg_parser->cfg->forwards;
344 			cfg_parser->cfg->forwards = s;
345 		} else {
346 			yyerror("out of memory");
347 		}
348 	}
349 	;
350 contents_forward: contents_forward content_forward
351 	| ;
352 content_forward: forward_name | forward_host | forward_addr | forward_first |
353 	forward_no_cache | forward_ssl_upstream | forward_tcp_upstream
354 	;
355 viewstart: VAR_VIEW
356 	{
357 		struct config_view* s;
358 		OUTYY(("\nP(view:)\n"));
359 		s = (struct config_view*)calloc(1, sizeof(struct config_view));
360 		if(s) {
361 			s->next = cfg_parser->cfg->views;
362 			if(s->next && !s->next->name)
363 				yyerror("view without name");
364 			cfg_parser->cfg->views = s;
365 		} else {
366 			yyerror("out of memory");
367 		}
368 	}
369 	;
370 contents_view: contents_view content_view
371 	| ;
372 content_view: view_name | view_local_zone | view_local_data | view_first |
373 		view_response_ip | view_response_ip_data | view_local_data_ptr
374 	;
375 authstart: VAR_AUTH_ZONE
376 	{
377 		struct config_auth* s;
378 		OUTYY(("\nP(auth_zone:)\n"));
379 		s = (struct config_auth*)calloc(1, sizeof(struct config_auth));
380 		if(s) {
381 			s->next = cfg_parser->cfg->auths;
382 			cfg_parser->cfg->auths = s;
383 			/* defaults for auth zone */
384 			s->for_downstream = 1;
385 			s->for_upstream = 1;
386 			s->fallback_enabled = 0;
387 			s->zonemd_check = 0;
388 			s->zonemd_reject_absence = 0;
389 			s->isrpz = 0;
390 		} else {
391 			yyerror("out of memory");
392 		}
393 	}
394 	;
395 contents_auth: contents_auth content_auth
396 	| ;
397 content_auth: auth_name | auth_zonefile | auth_master | auth_url |
398 	auth_for_downstream | auth_for_upstream | auth_fallback_enabled |
399 	auth_allow_notify | auth_zonemd_check | auth_zonemd_reject_absence
400 	;
401 
402 rpz_tag: VAR_TAGS STRING_ARG
403 	{
404 		uint8_t* bitlist;
405 		size_t len = 0;
406 		OUTYY(("P(server_local_zone_tag:%s)\n", $2));
407 		bitlist = config_parse_taglist(cfg_parser->cfg, $2,
408 			&len);
409 		free($2);
410 		if(!bitlist) {
411 			yyerror("could not parse tags, (define-tag them first)");
412 		}
413 		if(bitlist) {
414 			cfg_parser->cfg->auths->rpz_taglist = bitlist;
415 			cfg_parser->cfg->auths->rpz_taglistlen = len;
416 
417 		}
418 	}
419 	;
420 
421 rpz_action_override: VAR_RPZ_ACTION_OVERRIDE STRING_ARG
422 	{
423 		OUTYY(("P(rpz_action_override:%s)\n", $2));
424 		if(strcmp($2, "nxdomain")!=0 && strcmp($2, "nodata")!=0 &&
425 		   strcmp($2, "passthru")!=0 && strcmp($2, "drop")!=0 &&
426 		   strcmp($2, "cname")!=0 && strcmp($2, "disabled")!=0) {
427 			yyerror("rpz-action-override action: expected nxdomain, "
428 				"nodata, passthru, drop, cname or disabled");
429 			free($2);
430 			cfg_parser->cfg->auths->rpz_action_override = NULL;
431 		}
432 		else {
433 			cfg_parser->cfg->auths->rpz_action_override = $2;
434 		}
435 	}
436 	;
437 
438 rpz_cname_override: VAR_RPZ_CNAME_OVERRIDE STRING_ARG
439 	{
440 		OUTYY(("P(rpz_cname_override:%s)\n", $2));
441 		free(cfg_parser->cfg->auths->rpz_cname);
442 		cfg_parser->cfg->auths->rpz_cname = $2;
443 	}
444 	;
445 
446 rpz_log: VAR_RPZ_LOG STRING_ARG
447 	{
448 		OUTYY(("P(rpz_log:%s)\n", $2));
449 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
450 			yyerror("expected yes or no.");
451 		else cfg_parser->cfg->auths->rpz_log = (strcmp($2, "yes")==0);
452 		free($2);
453 	}
454 	;
455 
456 rpz_log_name: VAR_RPZ_LOG_NAME STRING_ARG
457 	{
458 		OUTYY(("P(rpz_log_name:%s)\n", $2));
459 		free(cfg_parser->cfg->auths->rpz_log_name);
460 		cfg_parser->cfg->auths->rpz_log_name = $2;
461 	}
462 	;
463 rpz_signal_nxdomain_ra: VAR_RPZ_SIGNAL_NXDOMAIN_RA STRING_ARG
464 	{
465 		OUTYY(("P(rpz_signal_nxdomain_ra:%s)\n", $2));
466 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
467 			yyerror("expected yes or no.");
468 		else cfg_parser->cfg->auths->rpz_signal_nxdomain_ra = (strcmp($2, "yes")==0);
469 		free($2);
470 	}
471 	;
472 
473 rpzstart: VAR_RPZ
474 	{
475 		struct config_auth* s;
476 		OUTYY(("\nP(rpz:)\n"));
477 		s = (struct config_auth*)calloc(1, sizeof(struct config_auth));
478 		if(s) {
479 			s->next = cfg_parser->cfg->auths;
480 			cfg_parser->cfg->auths = s;
481 			/* defaults for RPZ auth zone */
482 			s->for_downstream = 0;
483 			s->for_upstream = 0;
484 			s->fallback_enabled = 0;
485 			s->isrpz = 1;
486 		} else {
487 			yyerror("out of memory");
488 		}
489 	}
490 	;
491 contents_rpz: contents_rpz content_rpz
492 	| ;
493 content_rpz: auth_name | auth_zonefile | rpz_tag | auth_master | auth_url |
494 	   auth_allow_notify | rpz_action_override | rpz_cname_override |
495 	   rpz_log | rpz_log_name | rpz_signal_nxdomain_ra | auth_for_downstream
496 	;
497 server_num_threads: VAR_NUM_THREADS STRING_ARG
498 	{
499 		OUTYY(("P(server_num_threads:%s)\n", $2));
500 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
501 			yyerror("number expected");
502 		else cfg_parser->cfg->num_threads = atoi($2);
503 		free($2);
504 	}
505 	;
506 server_verbosity: VAR_VERBOSITY STRING_ARG
507 	{
508 		OUTYY(("P(server_verbosity:%s)\n", $2));
509 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
510 			yyerror("number expected");
511 		else cfg_parser->cfg->verbosity = atoi($2);
512 		free($2);
513 	}
514 	;
515 server_statistics_interval: VAR_STATISTICS_INTERVAL STRING_ARG
516 	{
517 		OUTYY(("P(server_statistics_interval:%s)\n", $2));
518 		if(strcmp($2, "") == 0 || strcmp($2, "0") == 0)
519 			cfg_parser->cfg->stat_interval = 0;
520 		else if(atoi($2) == 0)
521 			yyerror("number expected");
522 		else cfg_parser->cfg->stat_interval = atoi($2);
523 		free($2);
524 	}
525 	;
526 server_statistics_cumulative: VAR_STATISTICS_CUMULATIVE STRING_ARG
527 	{
528 		OUTYY(("P(server_statistics_cumulative:%s)\n", $2));
529 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
530 			yyerror("expected yes or no.");
531 		else cfg_parser->cfg->stat_cumulative = (strcmp($2, "yes")==0);
532 		free($2);
533 	}
534 	;
535 server_extended_statistics: VAR_EXTENDED_STATISTICS STRING_ARG
536 	{
537 		OUTYY(("P(server_extended_statistics:%s)\n", $2));
538 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
539 			yyerror("expected yes or no.");
540 		else cfg_parser->cfg->stat_extended = (strcmp($2, "yes")==0);
541 		free($2);
542 	}
543 	;
544 server_shm_enable: VAR_SHM_ENABLE STRING_ARG
545 	{
546 		OUTYY(("P(server_shm_enable:%s)\n", $2));
547 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
548 			yyerror("expected yes or no.");
549 		else cfg_parser->cfg->shm_enable = (strcmp($2, "yes")==0);
550 		free($2);
551 	}
552 	;
553 server_shm_key: VAR_SHM_KEY STRING_ARG
554 	{
555 		OUTYY(("P(server_shm_key:%s)\n", $2));
556 		if(strcmp($2, "") == 0 || strcmp($2, "0") == 0)
557 			cfg_parser->cfg->shm_key = 0;
558 		else if(atoi($2) == 0)
559 			yyerror("number expected");
560 		else cfg_parser->cfg->shm_key = atoi($2);
561 		free($2);
562 	}
563 	;
564 server_port: VAR_PORT STRING_ARG
565 	{
566 		OUTYY(("P(server_port:%s)\n", $2));
567 		if(atoi($2) == 0)
568 			yyerror("port number expected");
569 		else cfg_parser->cfg->port = atoi($2);
570 		free($2);
571 	}
572 	;
573 server_send_client_subnet: VAR_SEND_CLIENT_SUBNET STRING_ARG
574 	{
575 	#ifdef CLIENT_SUBNET
576 		OUTYY(("P(server_send_client_subnet:%s)\n", $2));
577 		if(!cfg_strlist_insert(&cfg_parser->cfg->client_subnet, $2))
578 			fatal_exit("out of memory adding client-subnet");
579 	#else
580 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
581 		free($2);
582 	#endif
583 	}
584 	;
585 server_client_subnet_zone: VAR_CLIENT_SUBNET_ZONE STRING_ARG
586 	{
587 	#ifdef CLIENT_SUBNET
588 		OUTYY(("P(server_client_subnet_zone:%s)\n", $2));
589 		if(!cfg_strlist_insert(&cfg_parser->cfg->client_subnet_zone,
590 			$2))
591 			fatal_exit("out of memory adding client-subnet-zone");
592 	#else
593 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
594 		free($2);
595 	#endif
596 	}
597 	;
598 server_client_subnet_always_forward:
599 	VAR_CLIENT_SUBNET_ALWAYS_FORWARD STRING_ARG
600 	{
601 	#ifdef CLIENT_SUBNET
602 		OUTYY(("P(server_client_subnet_always_forward:%s)\n", $2));
603 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
604 			yyerror("expected yes or no.");
605 		else
606 			cfg_parser->cfg->client_subnet_always_forward =
607 				(strcmp($2, "yes")==0);
608 	#else
609 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
610 	#endif
611 		free($2);
612 	}
613 	;
614 server_client_subnet_opcode: VAR_CLIENT_SUBNET_OPCODE STRING_ARG
615 	{
616 	#ifdef CLIENT_SUBNET
617 		OUTYY(("P(client_subnet_opcode:%s)\n", $2));
618 		OUTYY(("P(Deprecated option, ignoring)\n"));
619 	#else
620 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
621 	#endif
622 		free($2);
623 	}
624 	;
625 server_max_client_subnet_ipv4: VAR_MAX_CLIENT_SUBNET_IPV4 STRING_ARG
626 	{
627 	#ifdef CLIENT_SUBNET
628 		OUTYY(("P(max_client_subnet_ipv4:%s)\n", $2));
629 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
630 			yyerror("IPv4 subnet length expected");
631 		else if (atoi($2) > 32)
632 			cfg_parser->cfg->max_client_subnet_ipv4 = 32;
633 		else if (atoi($2) < 0)
634 			cfg_parser->cfg->max_client_subnet_ipv4 = 0;
635 		else cfg_parser->cfg->max_client_subnet_ipv4 = (uint8_t)atoi($2);
636 	#else
637 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
638 	#endif
639 		free($2);
640 	}
641 	;
642 server_max_client_subnet_ipv6: VAR_MAX_CLIENT_SUBNET_IPV6 STRING_ARG
643 	{
644 	#ifdef CLIENT_SUBNET
645 		OUTYY(("P(max_client_subnet_ipv6:%s)\n", $2));
646 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
647 			yyerror("Ipv6 subnet length expected");
648 		else if (atoi($2) > 128)
649 			cfg_parser->cfg->max_client_subnet_ipv6 = 128;
650 		else if (atoi($2) < 0)
651 			cfg_parser->cfg->max_client_subnet_ipv6 = 0;
652 		else cfg_parser->cfg->max_client_subnet_ipv6 = (uint8_t)atoi($2);
653 	#else
654 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
655 	#endif
656 		free($2);
657 	}
658 	;
659 server_min_client_subnet_ipv4: VAR_MIN_CLIENT_SUBNET_IPV4 STRING_ARG
660 	{
661 	#ifdef CLIENT_SUBNET
662 		OUTYY(("P(min_client_subnet_ipv4:%s)\n", $2));
663 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
664 			yyerror("IPv4 subnet length expected");
665 		else if (atoi($2) > 32)
666 			cfg_parser->cfg->min_client_subnet_ipv4 = 32;
667 		else if (atoi($2) < 0)
668 			cfg_parser->cfg->min_client_subnet_ipv4 = 0;
669 		else cfg_parser->cfg->min_client_subnet_ipv4 = (uint8_t)atoi($2);
670 	#else
671 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
672 	#endif
673 		free($2);
674 	}
675 	;
676 server_min_client_subnet_ipv6: VAR_MIN_CLIENT_SUBNET_IPV6 STRING_ARG
677 	{
678 	#ifdef CLIENT_SUBNET
679 		OUTYY(("P(min_client_subnet_ipv6:%s)\n", $2));
680 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
681 			yyerror("Ipv6 subnet length expected");
682 		else if (atoi($2) > 128)
683 			cfg_parser->cfg->min_client_subnet_ipv6 = 128;
684 		else if (atoi($2) < 0)
685 			cfg_parser->cfg->min_client_subnet_ipv6 = 0;
686 		else cfg_parser->cfg->min_client_subnet_ipv6 = (uint8_t)atoi($2);
687 	#else
688 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
689 	#endif
690 		free($2);
691 	}
692 	;
693 server_max_ecs_tree_size_ipv4: VAR_MAX_ECS_TREE_SIZE_IPV4 STRING_ARG
694 	{
695 	#ifdef CLIENT_SUBNET
696 		OUTYY(("P(max_ecs_tree_size_ipv4:%s)\n", $2));
697 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
698 			yyerror("IPv4 ECS tree size expected");
699 		else if (atoi($2) < 0)
700 			cfg_parser->cfg->max_ecs_tree_size_ipv4 = 0;
701 		else cfg_parser->cfg->max_ecs_tree_size_ipv4 = (uint32_t)atoi($2);
702 	#else
703 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
704 	#endif
705 		free($2);
706 	}
707 	;
708 server_max_ecs_tree_size_ipv6: VAR_MAX_ECS_TREE_SIZE_IPV6 STRING_ARG
709 	{
710 	#ifdef CLIENT_SUBNET
711 		OUTYY(("P(max_ecs_tree_size_ipv6:%s)\n", $2));
712 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
713 			yyerror("IPv6 ECS tree size expected");
714 		else if (atoi($2) < 0)
715 			cfg_parser->cfg->max_ecs_tree_size_ipv6 = 0;
716 		else cfg_parser->cfg->max_ecs_tree_size_ipv6 = (uint32_t)atoi($2);
717 	#else
718 		OUTYY(("P(Compiled without edns subnet option, ignoring)\n"));
719 	#endif
720 		free($2);
721 	}
722 	;
723 server_interface: VAR_INTERFACE STRING_ARG
724 	{
725 		OUTYY(("P(server_interface:%s)\n", $2));
726 		if(cfg_parser->cfg->num_ifs == 0)
727 			cfg_parser->cfg->ifs = calloc(1, sizeof(char*));
728 		else cfg_parser->cfg->ifs = realloc(cfg_parser->cfg->ifs,
729 				(cfg_parser->cfg->num_ifs+1)*sizeof(char*));
730 		if(!cfg_parser->cfg->ifs)
731 			yyerror("out of memory");
732 		else
733 			cfg_parser->cfg->ifs[cfg_parser->cfg->num_ifs++] = $2;
734 	}
735 	;
736 server_outgoing_interface: VAR_OUTGOING_INTERFACE STRING_ARG
737 	{
738 		OUTYY(("P(server_outgoing_interface:%s)\n", $2));
739 		if(cfg_parser->cfg->num_out_ifs == 0)
740 			cfg_parser->cfg->out_ifs = calloc(1, sizeof(char*));
741 		else cfg_parser->cfg->out_ifs = realloc(
742 			cfg_parser->cfg->out_ifs,
743 			(cfg_parser->cfg->num_out_ifs+1)*sizeof(char*));
744 		if(!cfg_parser->cfg->out_ifs)
745 			yyerror("out of memory");
746 		else
747 			cfg_parser->cfg->out_ifs[
748 				cfg_parser->cfg->num_out_ifs++] = $2;
749 	}
750 	;
751 server_outgoing_range: VAR_OUTGOING_RANGE STRING_ARG
752 	{
753 		OUTYY(("P(server_outgoing_range:%s)\n", $2));
754 		if(atoi($2) == 0)
755 			yyerror("number expected");
756 		else cfg_parser->cfg->outgoing_num_ports = atoi($2);
757 		free($2);
758 	}
759 	;
760 server_outgoing_port_permit: VAR_OUTGOING_PORT_PERMIT STRING_ARG
761 	{
762 		OUTYY(("P(server_outgoing_port_permit:%s)\n", $2));
763 		if(!cfg_mark_ports($2, 1,
764 			cfg_parser->cfg->outgoing_avail_ports, 65536))
765 			yyerror("port number or range (\"low-high\") expected");
766 		free($2);
767 	}
768 	;
769 server_outgoing_port_avoid: VAR_OUTGOING_PORT_AVOID STRING_ARG
770 	{
771 		OUTYY(("P(server_outgoing_port_avoid:%s)\n", $2));
772 		if(!cfg_mark_ports($2, 0,
773 			cfg_parser->cfg->outgoing_avail_ports, 65536))
774 			yyerror("port number or range (\"low-high\") expected");
775 		free($2);
776 	}
777 	;
778 server_outgoing_num_tcp: VAR_OUTGOING_NUM_TCP STRING_ARG
779 	{
780 		OUTYY(("P(server_outgoing_num_tcp:%s)\n", $2));
781 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
782 			yyerror("number expected");
783 		else cfg_parser->cfg->outgoing_num_tcp = atoi($2);
784 		free($2);
785 	}
786 	;
787 server_incoming_num_tcp: VAR_INCOMING_NUM_TCP STRING_ARG
788 	{
789 		OUTYY(("P(server_incoming_num_tcp:%s)\n", $2));
790 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
791 			yyerror("number expected");
792 		else cfg_parser->cfg->incoming_num_tcp = atoi($2);
793 		free($2);
794 	}
795 	;
796 server_interface_automatic: VAR_INTERFACE_AUTOMATIC STRING_ARG
797 	{
798 		OUTYY(("P(server_interface_automatic:%s)\n", $2));
799 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
800 			yyerror("expected yes or no.");
801 		else cfg_parser->cfg->if_automatic = (strcmp($2, "yes")==0);
802 		free($2);
803 	}
804 	;
805 server_interface_automatic_ports: VAR_INTERFACE_AUTOMATIC_PORTS STRING_ARG
806 	{
807 		OUTYY(("P(server_interface_automatic_ports:%s)\n", $2));
808 		free(cfg_parser->cfg->if_automatic_ports);
809 		cfg_parser->cfg->if_automatic_ports = $2;
810 	}
811 	;
812 server_do_ip4: VAR_DO_IP4 STRING_ARG
813 	{
814 		OUTYY(("P(server_do_ip4:%s)\n", $2));
815 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
816 			yyerror("expected yes or no.");
817 		else cfg_parser->cfg->do_ip4 = (strcmp($2, "yes")==0);
818 		free($2);
819 	}
820 	;
821 server_do_ip6: VAR_DO_IP6 STRING_ARG
822 	{
823 		OUTYY(("P(server_do_ip6:%s)\n", $2));
824 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
825 			yyerror("expected yes or no.");
826 		else cfg_parser->cfg->do_ip6 = (strcmp($2, "yes")==0);
827 		free($2);
828 	}
829 	;
830 server_do_udp: VAR_DO_UDP STRING_ARG
831 	{
832 		OUTYY(("P(server_do_udp:%s)\n", $2));
833 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
834 			yyerror("expected yes or no.");
835 		else cfg_parser->cfg->do_udp = (strcmp($2, "yes")==0);
836 		free($2);
837 	}
838 	;
839 server_do_tcp: VAR_DO_TCP STRING_ARG
840 	{
841 		OUTYY(("P(server_do_tcp:%s)\n", $2));
842 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
843 			yyerror("expected yes or no.");
844 		else cfg_parser->cfg->do_tcp = (strcmp($2, "yes")==0);
845 		free($2);
846 	}
847 	;
848 server_prefer_ip4: VAR_PREFER_IP4 STRING_ARG
849 	{
850 		OUTYY(("P(server_prefer_ip4:%s)\n", $2));
851 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
852 			yyerror("expected yes or no.");
853 		else cfg_parser->cfg->prefer_ip4 = (strcmp($2, "yes")==0);
854 		free($2);
855 	}
856 	;
857 server_prefer_ip6: VAR_PREFER_IP6 STRING_ARG
858 	{
859 		OUTYY(("P(server_prefer_ip6:%s)\n", $2));
860 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
861 			yyerror("expected yes or no.");
862 		else cfg_parser->cfg->prefer_ip6 = (strcmp($2, "yes")==0);
863 		free($2);
864 	}
865 	;
866 server_tcp_mss: VAR_TCP_MSS STRING_ARG
867 	{
868 		OUTYY(("P(server_tcp_mss:%s)\n", $2));
869 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
870 				yyerror("number expected");
871 		else cfg_parser->cfg->tcp_mss = atoi($2);
872 		free($2);
873 	}
874 	;
875 server_outgoing_tcp_mss: VAR_OUTGOING_TCP_MSS STRING_ARG
876 	{
877 		OUTYY(("P(server_outgoing_tcp_mss:%s)\n", $2));
878 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
879 			yyerror("number expected");
880 		else cfg_parser->cfg->outgoing_tcp_mss = atoi($2);
881 		free($2);
882 	}
883 	;
884 server_tcp_idle_timeout: VAR_TCP_IDLE_TIMEOUT STRING_ARG
885 	{
886 		OUTYY(("P(server_tcp_idle_timeout:%s)\n", $2));
887 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
888 			yyerror("number expected");
889 		else if (atoi($2) > 120000)
890 			cfg_parser->cfg->tcp_idle_timeout = 120000;
891 		else if (atoi($2) < 1)
892 			cfg_parser->cfg->tcp_idle_timeout = 1;
893 		else cfg_parser->cfg->tcp_idle_timeout = atoi($2);
894 		free($2);
895 	}
896 	;
897 server_max_reuse_tcp_queries: VAR_MAX_REUSE_TCP_QUERIES STRING_ARG
898 	{
899 		OUTYY(("P(server_max_reuse_tcp_queries:%s)\n", $2));
900 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
901 			yyerror("number expected");
902 		else if (atoi($2) < 1)
903 			cfg_parser->cfg->max_reuse_tcp_queries = 0;
904 		else cfg_parser->cfg->max_reuse_tcp_queries = atoi($2);
905 		free($2);
906 	}
907 	;
908 server_tcp_reuse_timeout: VAR_TCP_REUSE_TIMEOUT STRING_ARG
909 	{
910 		OUTYY(("P(server_tcp_reuse_timeout:%s)\n", $2));
911 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
912 			yyerror("number expected");
913 		else if (atoi($2) < 1)
914 			cfg_parser->cfg->tcp_reuse_timeout = 0;
915 		else cfg_parser->cfg->tcp_reuse_timeout = atoi($2);
916 		free($2);
917 	}
918 	;
919 server_tcp_auth_query_timeout: VAR_TCP_AUTH_QUERY_TIMEOUT STRING_ARG
920 	{
921 		OUTYY(("P(server_tcp_auth_query_timeout:%s)\n", $2));
922 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
923 			yyerror("number expected");
924 		else if (atoi($2) < 1)
925 			cfg_parser->cfg->tcp_auth_query_timeout = 0;
926 		else cfg_parser->cfg->tcp_auth_query_timeout = atoi($2);
927 		free($2);
928 	}
929 	;
930 server_tcp_keepalive: VAR_EDNS_TCP_KEEPALIVE STRING_ARG
931 	{
932 		OUTYY(("P(server_tcp_keepalive:%s)\n", $2));
933 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
934 			yyerror("expected yes or no.");
935 		else cfg_parser->cfg->do_tcp_keepalive = (strcmp($2, "yes")==0);
936 		free($2);
937 	}
938 	;
939 server_tcp_keepalive_timeout: VAR_EDNS_TCP_KEEPALIVE_TIMEOUT STRING_ARG
940 	{
941 		OUTYY(("P(server_tcp_keepalive_timeout:%s)\n", $2));
942 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
943 			yyerror("number expected");
944 		else if (atoi($2) > 6553500)
945 			cfg_parser->cfg->tcp_keepalive_timeout = 6553500;
946 		else if (atoi($2) < 1)
947 			cfg_parser->cfg->tcp_keepalive_timeout = 0;
948 		else cfg_parser->cfg->tcp_keepalive_timeout = atoi($2);
949 		free($2);
950 	}
951 	;
952 server_tcp_upstream: VAR_TCP_UPSTREAM STRING_ARG
953 	{
954 		OUTYY(("P(server_tcp_upstream:%s)\n", $2));
955 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
956 			yyerror("expected yes or no.");
957 		else cfg_parser->cfg->tcp_upstream = (strcmp($2, "yes")==0);
958 		free($2);
959 	}
960 	;
961 server_udp_upstream_without_downstream: VAR_UDP_UPSTREAM_WITHOUT_DOWNSTREAM STRING_ARG
962 	{
963 		OUTYY(("P(server_udp_upstream_without_downstream:%s)\n", $2));
964 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
965 			yyerror("expected yes or no.");
966 		else cfg_parser->cfg->udp_upstream_without_downstream = (strcmp($2, "yes")==0);
967 		free($2);
968 	}
969 	;
970 server_ssl_upstream: VAR_SSL_UPSTREAM STRING_ARG
971 	{
972 		OUTYY(("P(server_ssl_upstream:%s)\n", $2));
973 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
974 			yyerror("expected yes or no.");
975 		else cfg_parser->cfg->ssl_upstream = (strcmp($2, "yes")==0);
976 		free($2);
977 	}
978 	;
979 server_ssl_service_key: VAR_SSL_SERVICE_KEY STRING_ARG
980 	{
981 		OUTYY(("P(server_ssl_service_key:%s)\n", $2));
982 		free(cfg_parser->cfg->ssl_service_key);
983 		cfg_parser->cfg->ssl_service_key = $2;
984 	}
985 	;
986 server_ssl_service_pem: VAR_SSL_SERVICE_PEM STRING_ARG
987 	{
988 		OUTYY(("P(server_ssl_service_pem:%s)\n", $2));
989 		free(cfg_parser->cfg->ssl_service_pem);
990 		cfg_parser->cfg->ssl_service_pem = $2;
991 	}
992 	;
993 server_ssl_port: VAR_SSL_PORT STRING_ARG
994 	{
995 		OUTYY(("P(server_ssl_port:%s)\n", $2));
996 		if(atoi($2) == 0)
997 			yyerror("port number expected");
998 		else cfg_parser->cfg->ssl_port = atoi($2);
999 		free($2);
1000 	}
1001 	;
1002 server_tls_cert_bundle: VAR_TLS_CERT_BUNDLE STRING_ARG
1003 	{
1004 		OUTYY(("P(server_tls_cert_bundle:%s)\n", $2));
1005 		free(cfg_parser->cfg->tls_cert_bundle);
1006 		cfg_parser->cfg->tls_cert_bundle = $2;
1007 	}
1008 	;
1009 server_tls_win_cert: VAR_TLS_WIN_CERT STRING_ARG
1010 	{
1011 		OUTYY(("P(server_tls_win_cert:%s)\n", $2));
1012 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1013 			yyerror("expected yes or no.");
1014 		else cfg_parser->cfg->tls_win_cert = (strcmp($2, "yes")==0);
1015 		free($2);
1016 	}
1017 	;
1018 server_tls_additional_port: VAR_TLS_ADDITIONAL_PORT STRING_ARG
1019 	{
1020 		OUTYY(("P(server_tls_additional_port:%s)\n", $2));
1021 		if(!cfg_strlist_insert(&cfg_parser->cfg->tls_additional_port,
1022 			$2))
1023 			yyerror("out of memory");
1024 	}
1025 	;
1026 server_tls_ciphers: VAR_TLS_CIPHERS STRING_ARG
1027 	{
1028 		OUTYY(("P(server_tls_ciphers:%s)\n", $2));
1029 		free(cfg_parser->cfg->tls_ciphers);
1030 		cfg_parser->cfg->tls_ciphers = $2;
1031 	}
1032 	;
1033 server_tls_ciphersuites: VAR_TLS_CIPHERSUITES STRING_ARG
1034 	{
1035 		OUTYY(("P(server_tls_ciphersuites:%s)\n", $2));
1036 		free(cfg_parser->cfg->tls_ciphersuites);
1037 		cfg_parser->cfg->tls_ciphersuites = $2;
1038 	}
1039 	;
1040 server_tls_session_ticket_keys: VAR_TLS_SESSION_TICKET_KEYS STRING_ARG
1041 	{
1042 		OUTYY(("P(server_tls_session_ticket_keys:%s)\n", $2));
1043 		if(!cfg_strlist_append(&cfg_parser->cfg->tls_session_ticket_keys,
1044 			$2))
1045 			yyerror("out of memory");
1046 	}
1047 	;
1048 server_tls_use_sni: VAR_TLS_USE_SNI STRING_ARG
1049 	{
1050 		OUTYY(("P(server_tls_use_sni:%s)\n", $2));
1051 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1052 			yyerror("expected yes or no.");
1053 		else cfg_parser->cfg->tls_use_sni = (strcmp($2, "yes")==0);
1054 		free($2);
1055 	}
1056 	;
1057 server_https_port: VAR_HTTPS_PORT STRING_ARG
1058 	{
1059 		OUTYY(("P(server_https_port:%s)\n", $2));
1060 		if(atoi($2) == 0)
1061 			yyerror("port number expected");
1062 		else cfg_parser->cfg->https_port = atoi($2);
1063 		free($2);
1064 	};
1065 server_http_endpoint: VAR_HTTP_ENDPOINT STRING_ARG
1066 	{
1067 		OUTYY(("P(server_http_endpoint:%s)\n", $2));
1068 		free(cfg_parser->cfg->http_endpoint);
1069 		if($2 && $2[0] != '/') {
1070 			cfg_parser->cfg->http_endpoint = malloc(strlen($2)+2);
1071 			if(!cfg_parser->cfg->http_endpoint)
1072 				yyerror("out of memory");
1073 			cfg_parser->cfg->http_endpoint[0] = '/';
1074 			memmove(cfg_parser->cfg->http_endpoint+1, $2,
1075 				strlen($2)+1);
1076 			free($2);
1077 		} else {
1078 			cfg_parser->cfg->http_endpoint = $2;
1079 		}
1080 	};
1081 server_http_max_streams: VAR_HTTP_MAX_STREAMS STRING_ARG
1082 	{
1083 		OUTYY(("P(server_http_max_streams:%s)\n", $2));
1084 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1085 			yyerror("number expected");
1086 		else cfg_parser->cfg->http_max_streams = atoi($2);
1087 		free($2);
1088 	};
1089 server_http_query_buffer_size: VAR_HTTP_QUERY_BUFFER_SIZE STRING_ARG
1090 	{
1091 		OUTYY(("P(server_http_query_buffer_size:%s)\n", $2));
1092 		if(!cfg_parse_memsize($2,
1093 			&cfg_parser->cfg->http_query_buffer_size))
1094 			yyerror("memory size expected");
1095 		free($2);
1096 	};
1097 server_http_response_buffer_size: VAR_HTTP_RESPONSE_BUFFER_SIZE STRING_ARG
1098 	{
1099 		OUTYY(("P(server_http_response_buffer_size:%s)\n", $2));
1100 		if(!cfg_parse_memsize($2,
1101 			&cfg_parser->cfg->http_response_buffer_size))
1102 			yyerror("memory size expected");
1103 		free($2);
1104 	};
1105 server_http_nodelay: VAR_HTTP_NODELAY STRING_ARG
1106 	{
1107 		OUTYY(("P(server_http_nodelay:%s)\n", $2));
1108 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1109 			yyerror("expected yes or no.");
1110 		else cfg_parser->cfg->http_nodelay = (strcmp($2, "yes")==0);
1111 		free($2);
1112 	}
1113 server_http_notls_downstream: VAR_HTTP_NOTLS_DOWNSTREAM STRING_ARG
1114 	{
1115 		OUTYY(("P(server_http_notls_downstream:%s)\n", $2));
1116 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1117 			yyerror("expected yes or no.");
1118 		else cfg_parser->cfg->http_notls_downstream = (strcmp($2, "yes")==0);
1119 		free($2);
1120 	};
1121 server_use_systemd: VAR_USE_SYSTEMD STRING_ARG
1122 	{
1123 		OUTYY(("P(server_use_systemd:%s)\n", $2));
1124 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1125 			yyerror("expected yes or no.");
1126 		else cfg_parser->cfg->use_systemd = (strcmp($2, "yes")==0);
1127 		free($2);
1128 	}
1129 	;
1130 server_do_daemonize: VAR_DO_DAEMONIZE STRING_ARG
1131 	{
1132 		OUTYY(("P(server_do_daemonize:%s)\n", $2));
1133 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1134 			yyerror("expected yes or no.");
1135 		else cfg_parser->cfg->do_daemonize = (strcmp($2, "yes")==0);
1136 		free($2);
1137 	}
1138 	;
1139 server_use_syslog: VAR_USE_SYSLOG STRING_ARG
1140 	{
1141 		OUTYY(("P(server_use_syslog:%s)\n", $2));
1142 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1143 			yyerror("expected yes or no.");
1144 		else cfg_parser->cfg->use_syslog = (strcmp($2, "yes")==0);
1145 #if !defined(HAVE_SYSLOG_H) && !defined(UB_ON_WINDOWS)
1146 		if(strcmp($2, "yes") == 0)
1147 			yyerror("no syslog services are available. "
1148 				"(reconfigure and compile to add)");
1149 #endif
1150 		free($2);
1151 	}
1152 	;
1153 server_log_time_ascii: VAR_LOG_TIME_ASCII STRING_ARG
1154 	{
1155 		OUTYY(("P(server_log_time_ascii:%s)\n", $2));
1156 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1157 			yyerror("expected yes or no.");
1158 		else cfg_parser->cfg->log_time_ascii = (strcmp($2, "yes")==0);
1159 		free($2);
1160 	}
1161 	;
1162 server_log_queries: VAR_LOG_QUERIES STRING_ARG
1163 	{
1164 		OUTYY(("P(server_log_queries:%s)\n", $2));
1165 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1166 			yyerror("expected yes or no.");
1167 		else cfg_parser->cfg->log_queries = (strcmp($2, "yes")==0);
1168 		free($2);
1169 	}
1170 	;
1171 server_log_replies: VAR_LOG_REPLIES STRING_ARG
1172 	{
1173 		OUTYY(("P(server_log_replies:%s)\n", $2));
1174 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1175 			yyerror("expected yes or no.");
1176 		else cfg_parser->cfg->log_replies = (strcmp($2, "yes")==0);
1177 		free($2);
1178 	}
1179 	;
1180 server_log_tag_queryreply: VAR_LOG_TAG_QUERYREPLY STRING_ARG
1181 	{
1182 		OUTYY(("P(server_log_tag_queryreply:%s)\n", $2));
1183 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1184 			yyerror("expected yes or no.");
1185 		else cfg_parser->cfg->log_tag_queryreply = (strcmp($2, "yes")==0);
1186 		free($2);
1187 	}
1188 	;
1189 server_log_servfail: VAR_LOG_SERVFAIL STRING_ARG
1190 	{
1191 		OUTYY(("P(server_log_servfail:%s)\n", $2));
1192 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1193 			yyerror("expected yes or no.");
1194 		else cfg_parser->cfg->log_servfail = (strcmp($2, "yes")==0);
1195 		free($2);
1196 	}
1197 	;
1198 server_log_local_actions: VAR_LOG_LOCAL_ACTIONS STRING_ARG
1199 	{
1200 		OUTYY(("P(server_log_local_actions:%s)\n", $2));
1201 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1202 			yyerror("expected yes or no.");
1203 		else cfg_parser->cfg->log_local_actions = (strcmp($2, "yes")==0);
1204 		free($2);
1205 	}
1206 	;
1207 server_chroot: VAR_CHROOT STRING_ARG
1208 	{
1209 		OUTYY(("P(server_chroot:%s)\n", $2));
1210 		free(cfg_parser->cfg->chrootdir);
1211 		cfg_parser->cfg->chrootdir = $2;
1212 	}
1213 	;
1214 server_username: VAR_USERNAME STRING_ARG
1215 	{
1216 		OUTYY(("P(server_username:%s)\n", $2));
1217 		free(cfg_parser->cfg->username);
1218 		cfg_parser->cfg->username = $2;
1219 	}
1220 	;
1221 server_directory: VAR_DIRECTORY STRING_ARG
1222 	{
1223 		OUTYY(("P(server_directory:%s)\n", $2));
1224 		free(cfg_parser->cfg->directory);
1225 		cfg_parser->cfg->directory = $2;
1226 		/* change there right away for includes relative to this */
1227 		if($2[0]) {
1228 			char* d;
1229 #ifdef UB_ON_WINDOWS
1230 			w_config_adjust_directory(cfg_parser->cfg);
1231 #endif
1232 			d = cfg_parser->cfg->directory;
1233 			/* adjust directory if we have already chroot,
1234 			 * like, we reread after sighup */
1235 			if(cfg_parser->chroot && cfg_parser->chroot[0] &&
1236 				strncmp(d, cfg_parser->chroot, strlen(
1237 				cfg_parser->chroot)) == 0)
1238 				d += strlen(cfg_parser->chroot);
1239 			if(d[0]) {
1240 				if(chdir(d))
1241 				log_err("cannot chdir to directory: %s (%s)",
1242 					d, strerror(errno));
1243 			}
1244 		}
1245 	}
1246 	;
1247 server_logfile: VAR_LOGFILE STRING_ARG
1248 	{
1249 		OUTYY(("P(server_logfile:%s)\n", $2));
1250 		free(cfg_parser->cfg->logfile);
1251 		cfg_parser->cfg->logfile = $2;
1252 		cfg_parser->cfg->use_syslog = 0;
1253 	}
1254 	;
1255 server_pidfile: VAR_PIDFILE STRING_ARG
1256 	{
1257 		OUTYY(("P(server_pidfile:%s)\n", $2));
1258 		free(cfg_parser->cfg->pidfile);
1259 		cfg_parser->cfg->pidfile = $2;
1260 	}
1261 	;
1262 server_root_hints: VAR_ROOT_HINTS STRING_ARG
1263 	{
1264 		OUTYY(("P(server_root_hints:%s)\n", $2));
1265 		if(!cfg_strlist_insert(&cfg_parser->cfg->root_hints, $2))
1266 			yyerror("out of memory");
1267 	}
1268 	;
1269 server_dlv_anchor_file: VAR_DLV_ANCHOR_FILE STRING_ARG
1270 	{
1271 		OUTYY(("P(server_dlv_anchor_file:%s)\n", $2));
1272 		log_warn("option dlv-anchor-file ignored: DLV is decommissioned");
1273 		free($2);
1274 	}
1275 	;
1276 server_dlv_anchor: VAR_DLV_ANCHOR STRING_ARG
1277 	{
1278 		OUTYY(("P(server_dlv_anchor:%s)\n", $2));
1279 		log_warn("option dlv-anchor ignored: DLV is decommissioned");
1280 		free($2);
1281 	}
1282 	;
1283 server_auto_trust_anchor_file: VAR_AUTO_TRUST_ANCHOR_FILE STRING_ARG
1284 	{
1285 		OUTYY(("P(server_auto_trust_anchor_file:%s)\n", $2));
1286 		if(!cfg_strlist_insert(&cfg_parser->cfg->
1287 			auto_trust_anchor_file_list, $2))
1288 			yyerror("out of memory");
1289 	}
1290 	;
1291 server_trust_anchor_file: VAR_TRUST_ANCHOR_FILE STRING_ARG
1292 	{
1293 		OUTYY(("P(server_trust_anchor_file:%s)\n", $2));
1294 		if(!cfg_strlist_insert(&cfg_parser->cfg->
1295 			trust_anchor_file_list, $2))
1296 			yyerror("out of memory");
1297 	}
1298 	;
1299 server_trusted_keys_file: VAR_TRUSTED_KEYS_FILE STRING_ARG
1300 	{
1301 		OUTYY(("P(server_trusted_keys_file:%s)\n", $2));
1302 		if(!cfg_strlist_insert(&cfg_parser->cfg->
1303 			trusted_keys_file_list, $2))
1304 			yyerror("out of memory");
1305 	}
1306 	;
1307 server_trust_anchor: VAR_TRUST_ANCHOR STRING_ARG
1308 	{
1309 		OUTYY(("P(server_trust_anchor:%s)\n", $2));
1310 		if(!cfg_strlist_insert(&cfg_parser->cfg->trust_anchor_list, $2))
1311 			yyerror("out of memory");
1312 	}
1313 	;
1314 server_trust_anchor_signaling: VAR_TRUST_ANCHOR_SIGNALING STRING_ARG
1315 	{
1316 		OUTYY(("P(server_trust_anchor_signaling:%s)\n", $2));
1317 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1318 			yyerror("expected yes or no.");
1319 		else
1320 			cfg_parser->cfg->trust_anchor_signaling =
1321 				(strcmp($2, "yes")==0);
1322 		free($2);
1323 	}
1324 	;
1325 server_root_key_sentinel: VAR_ROOT_KEY_SENTINEL STRING_ARG
1326 	{
1327 		OUTYY(("P(server_root_key_sentinel:%s)\n", $2));
1328 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1329 			yyerror("expected yes or no.");
1330 		else
1331 			cfg_parser->cfg->root_key_sentinel =
1332 				(strcmp($2, "yes")==0);
1333 		free($2);
1334 	}
1335 	;
1336 server_domain_insecure: VAR_DOMAIN_INSECURE STRING_ARG
1337 	{
1338 		OUTYY(("P(server_domain_insecure:%s)\n", $2));
1339 		if(!cfg_strlist_insert(&cfg_parser->cfg->domain_insecure, $2))
1340 			yyerror("out of memory");
1341 	}
1342 	;
1343 server_hide_identity: VAR_HIDE_IDENTITY STRING_ARG
1344 	{
1345 		OUTYY(("P(server_hide_identity:%s)\n", $2));
1346 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1347 			yyerror("expected yes or no.");
1348 		else cfg_parser->cfg->hide_identity = (strcmp($2, "yes")==0);
1349 		free($2);
1350 	}
1351 	;
1352 server_hide_version: VAR_HIDE_VERSION STRING_ARG
1353 	{
1354 		OUTYY(("P(server_hide_version:%s)\n", $2));
1355 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1356 			yyerror("expected yes or no.");
1357 		else cfg_parser->cfg->hide_version = (strcmp($2, "yes")==0);
1358 		free($2);
1359 	}
1360 	;
1361 server_hide_trustanchor: VAR_HIDE_TRUSTANCHOR STRING_ARG
1362 	{
1363 		OUTYY(("P(server_hide_trustanchor:%s)\n", $2));
1364 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1365 			yyerror("expected yes or no.");
1366 		else cfg_parser->cfg->hide_trustanchor = (strcmp($2, "yes")==0);
1367 		free($2);
1368 	}
1369 	;
1370 server_hide_http_user_agent: VAR_HIDE_HTTP_USER_AGENT STRING_ARG
1371 	{
1372 		OUTYY(("P(server_hide_user_agent:%s)\n", $2));
1373 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1374 			yyerror("expected yes or no.");
1375 		else cfg_parser->cfg->hide_http_user_agent = (strcmp($2, "yes")==0);
1376 		free($2);
1377 	}
1378 	;
1379 server_identity: VAR_IDENTITY STRING_ARG
1380 	{
1381 		OUTYY(("P(server_identity:%s)\n", $2));
1382 		free(cfg_parser->cfg->identity);
1383 		cfg_parser->cfg->identity = $2;
1384 	}
1385 	;
1386 server_version: VAR_VERSION STRING_ARG
1387 	{
1388 		OUTYY(("P(server_version:%s)\n", $2));
1389 		free(cfg_parser->cfg->version);
1390 		cfg_parser->cfg->version = $2;
1391 	}
1392 	;
1393 server_http_user_agent: VAR_HTTP_USER_AGENT STRING_ARG
1394 	{
1395 		OUTYY(("P(server_http_user_agent:%s)\n", $2));
1396 		free(cfg_parser->cfg->http_user_agent);
1397 		cfg_parser->cfg->http_user_agent = $2;
1398 	}
1399 	;
1400 server_nsid: VAR_NSID STRING_ARG
1401 	{
1402 		OUTYY(("P(server_nsid:%s)\n", $2));
1403 		free(cfg_parser->cfg->nsid_cfg_str);
1404 		cfg_parser->cfg->nsid_cfg_str = $2;
1405 		free(cfg_parser->cfg->nsid);
1406 		cfg_parser->cfg->nsid = NULL;
1407 		cfg_parser->cfg->nsid_len = 0;
1408 		if (*$2 == 0)
1409 			; /* pass; empty string is not setting nsid */
1410 		else if (!(cfg_parser->cfg->nsid = cfg_parse_nsid(
1411 					$2, &cfg_parser->cfg->nsid_len)))
1412 			yyerror("the NSID must be either a hex string or an "
1413 			    "ascii character string prepended with ascii_.");
1414 	}
1415 	;
1416 server_so_rcvbuf: VAR_SO_RCVBUF STRING_ARG
1417 	{
1418 		OUTYY(("P(server_so_rcvbuf:%s)\n", $2));
1419 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->so_rcvbuf))
1420 			yyerror("buffer size expected");
1421 		free($2);
1422 	}
1423 	;
1424 server_so_sndbuf: VAR_SO_SNDBUF STRING_ARG
1425 	{
1426 		OUTYY(("P(server_so_sndbuf:%s)\n", $2));
1427 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->so_sndbuf))
1428 			yyerror("buffer size expected");
1429 		free($2);
1430 	}
1431 	;
1432 server_so_reuseport: VAR_SO_REUSEPORT STRING_ARG
1433 	{
1434 		OUTYY(("P(server_so_reuseport:%s)\n", $2));
1435 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1436 			yyerror("expected yes or no.");
1437 		else cfg_parser->cfg->so_reuseport =
1438 			(strcmp($2, "yes")==0);
1439 		free($2);
1440 	}
1441 	;
1442 server_ip_transparent: VAR_IP_TRANSPARENT STRING_ARG
1443 	{
1444 		OUTYY(("P(server_ip_transparent:%s)\n", $2));
1445 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1446 			yyerror("expected yes or no.");
1447 		else cfg_parser->cfg->ip_transparent =
1448 			(strcmp($2, "yes")==0);
1449 		free($2);
1450 	}
1451 	;
1452 server_ip_freebind: VAR_IP_FREEBIND STRING_ARG
1453 	{
1454 		OUTYY(("P(server_ip_freebind:%s)\n", $2));
1455 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1456 			yyerror("expected yes or no.");
1457 		else cfg_parser->cfg->ip_freebind =
1458 			(strcmp($2, "yes")==0);
1459 		free($2);
1460 	}
1461 	;
1462 server_ip_dscp: VAR_IP_DSCP STRING_ARG
1463 	{
1464 		OUTYY(("P(server_ip_dscp:%s)\n", $2));
1465 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1466 			yyerror("number expected");
1467 		else if (atoi($2) > 63)
1468 			yyerror("value too large (max 63)");
1469 		else if (atoi($2) < 0)
1470 			yyerror("value too small (min 0)");
1471 		else
1472 			cfg_parser->cfg->ip_dscp = atoi($2);
1473 		free($2);
1474 	}
1475 	;
1476 server_stream_wait_size: VAR_STREAM_WAIT_SIZE STRING_ARG
1477 	{
1478 		OUTYY(("P(server_stream_wait_size:%s)\n", $2));
1479 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->stream_wait_size))
1480 			yyerror("memory size expected");
1481 		free($2);
1482 	}
1483 	;
1484 server_edns_buffer_size: VAR_EDNS_BUFFER_SIZE STRING_ARG
1485 	{
1486 		OUTYY(("P(server_edns_buffer_size:%s)\n", $2));
1487 		if(atoi($2) == 0)
1488 			yyerror("number expected");
1489 		else if (atoi($2) < 12)
1490 			yyerror("edns buffer size too small");
1491 		else if (atoi($2) > 65535)
1492 			cfg_parser->cfg->edns_buffer_size = 65535;
1493 		else cfg_parser->cfg->edns_buffer_size = atoi($2);
1494 		free($2);
1495 	}
1496 	;
1497 server_msg_buffer_size: VAR_MSG_BUFFER_SIZE STRING_ARG
1498 	{
1499 		OUTYY(("P(server_msg_buffer_size:%s)\n", $2));
1500 		if(atoi($2) == 0)
1501 			yyerror("number expected");
1502 		else if (atoi($2) < 4096)
1503 			yyerror("message buffer size too small (use 4096)");
1504 		else cfg_parser->cfg->msg_buffer_size = atoi($2);
1505 		free($2);
1506 	}
1507 	;
1508 server_msg_cache_size: VAR_MSG_CACHE_SIZE STRING_ARG
1509 	{
1510 		OUTYY(("P(server_msg_cache_size:%s)\n", $2));
1511 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->msg_cache_size))
1512 			yyerror("memory size expected");
1513 		free($2);
1514 	}
1515 	;
1516 server_msg_cache_slabs: VAR_MSG_CACHE_SLABS STRING_ARG
1517 	{
1518 		OUTYY(("P(server_msg_cache_slabs:%s)\n", $2));
1519 		if(atoi($2) == 0) {
1520 			yyerror("number expected");
1521 		} else {
1522 			cfg_parser->cfg->msg_cache_slabs = atoi($2);
1523 			if(!is_pow2(cfg_parser->cfg->msg_cache_slabs))
1524 				yyerror("must be a power of 2");
1525 		}
1526 		free($2);
1527 	}
1528 	;
1529 server_num_queries_per_thread: VAR_NUM_QUERIES_PER_THREAD STRING_ARG
1530 	{
1531 		OUTYY(("P(server_num_queries_per_thread:%s)\n", $2));
1532 		if(atoi($2) == 0)
1533 			yyerror("number expected");
1534 		else cfg_parser->cfg->num_queries_per_thread = atoi($2);
1535 		free($2);
1536 	}
1537 	;
1538 server_jostle_timeout: VAR_JOSTLE_TIMEOUT STRING_ARG
1539 	{
1540 		OUTYY(("P(server_jostle_timeout:%s)\n", $2));
1541 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1542 			yyerror("number expected");
1543 		else cfg_parser->cfg->jostle_time = atoi($2);
1544 		free($2);
1545 	}
1546 	;
1547 server_delay_close: VAR_DELAY_CLOSE STRING_ARG
1548 	{
1549 		OUTYY(("P(server_delay_close:%s)\n", $2));
1550 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1551 			yyerror("number expected");
1552 		else cfg_parser->cfg->delay_close = atoi($2);
1553 		free($2);
1554 	}
1555 	;
1556 server_udp_connect: VAR_UDP_CONNECT STRING_ARG
1557 	{
1558 		OUTYY(("P(server_udp_connect:%s)\n", $2));
1559 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1560 			yyerror("expected yes or no.");
1561 		else cfg_parser->cfg->udp_connect = (strcmp($2, "yes")==0);
1562 		free($2);
1563 	}
1564 	;
1565 server_unblock_lan_zones: VAR_UNBLOCK_LAN_ZONES STRING_ARG
1566 	{
1567 		OUTYY(("P(server_unblock_lan_zones:%s)\n", $2));
1568 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1569 			yyerror("expected yes or no.");
1570 		else cfg_parser->cfg->unblock_lan_zones =
1571 			(strcmp($2, "yes")==0);
1572 		free($2);
1573 	}
1574 	;
1575 server_insecure_lan_zones: VAR_INSECURE_LAN_ZONES STRING_ARG
1576 	{
1577 		OUTYY(("P(server_insecure_lan_zones:%s)\n", $2));
1578 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1579 			yyerror("expected yes or no.");
1580 		else cfg_parser->cfg->insecure_lan_zones =
1581 			(strcmp($2, "yes")==0);
1582 		free($2);
1583 	}
1584 	;
1585 server_rrset_cache_size: VAR_RRSET_CACHE_SIZE STRING_ARG
1586 	{
1587 		OUTYY(("P(server_rrset_cache_size:%s)\n", $2));
1588 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->rrset_cache_size))
1589 			yyerror("memory size expected");
1590 		free($2);
1591 	}
1592 	;
1593 server_rrset_cache_slabs: VAR_RRSET_CACHE_SLABS STRING_ARG
1594 	{
1595 		OUTYY(("P(server_rrset_cache_slabs:%s)\n", $2));
1596 		if(atoi($2) == 0) {
1597 			yyerror("number expected");
1598 		} else {
1599 			cfg_parser->cfg->rrset_cache_slabs = atoi($2);
1600 			if(!is_pow2(cfg_parser->cfg->rrset_cache_slabs))
1601 				yyerror("must be a power of 2");
1602 		}
1603 		free($2);
1604 	}
1605 	;
1606 server_infra_host_ttl: VAR_INFRA_HOST_TTL STRING_ARG
1607 	{
1608 		OUTYY(("P(server_infra_host_ttl:%s)\n", $2));
1609 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1610 			yyerror("number expected");
1611 		else cfg_parser->cfg->host_ttl = atoi($2);
1612 		free($2);
1613 	}
1614 	;
1615 server_infra_lame_ttl: VAR_INFRA_LAME_TTL STRING_ARG
1616 	{
1617 		OUTYY(("P(server_infra_lame_ttl:%s)\n", $2));
1618 		verbose(VERB_DETAIL, "ignored infra-lame-ttl: %s (option "
1619 			"removed, use infra-host-ttl)", $2);
1620 		free($2);
1621 	}
1622 	;
1623 server_infra_cache_numhosts: VAR_INFRA_CACHE_NUMHOSTS STRING_ARG
1624 	{
1625 		OUTYY(("P(server_infra_cache_numhosts:%s)\n", $2));
1626 		if(atoi($2) == 0)
1627 			yyerror("number expected");
1628 		else cfg_parser->cfg->infra_cache_numhosts = atoi($2);
1629 		free($2);
1630 	}
1631 	;
1632 server_infra_cache_lame_size: VAR_INFRA_CACHE_LAME_SIZE STRING_ARG
1633 	{
1634 		OUTYY(("P(server_infra_cache_lame_size:%s)\n", $2));
1635 		verbose(VERB_DETAIL, "ignored infra-cache-lame-size: %s "
1636 			"(option removed, use infra-cache-numhosts)", $2);
1637 		free($2);
1638 	}
1639 	;
1640 server_infra_cache_slabs: VAR_INFRA_CACHE_SLABS STRING_ARG
1641 	{
1642 		OUTYY(("P(server_infra_cache_slabs:%s)\n", $2));
1643 		if(atoi($2) == 0) {
1644 			yyerror("number expected");
1645 		} else {
1646 			cfg_parser->cfg->infra_cache_slabs = atoi($2);
1647 			if(!is_pow2(cfg_parser->cfg->infra_cache_slabs))
1648 				yyerror("must be a power of 2");
1649 		}
1650 		free($2);
1651 	}
1652 	;
1653 server_infra_cache_min_rtt: VAR_INFRA_CACHE_MIN_RTT STRING_ARG
1654 	{
1655 		OUTYY(("P(server_infra_cache_min_rtt:%s)\n", $2));
1656 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1657 			yyerror("number expected");
1658 		else cfg_parser->cfg->infra_cache_min_rtt = atoi($2);
1659 		free($2);
1660 	}
1661 	;
1662 server_infra_keep_probing: VAR_INFRA_KEEP_PROBING STRING_ARG
1663 	{
1664 		OUTYY(("P(server_infra_keep_probing:%s)\n", $2));
1665 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1666 			yyerror("expected yes or no.");
1667 		else cfg_parser->cfg->infra_keep_probing =
1668 			(strcmp($2, "yes")==0);
1669 		free($2);
1670 	}
1671 	;
1672 server_target_fetch_policy: VAR_TARGET_FETCH_POLICY STRING_ARG
1673 	{
1674 		OUTYY(("P(server_target_fetch_policy:%s)\n", $2));
1675 		free(cfg_parser->cfg->target_fetch_policy);
1676 		cfg_parser->cfg->target_fetch_policy = $2;
1677 	}
1678 	;
1679 server_harden_short_bufsize: VAR_HARDEN_SHORT_BUFSIZE STRING_ARG
1680 	{
1681 		OUTYY(("P(server_harden_short_bufsize:%s)\n", $2));
1682 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1683 			yyerror("expected yes or no.");
1684 		else cfg_parser->cfg->harden_short_bufsize =
1685 			(strcmp($2, "yes")==0);
1686 		free($2);
1687 	}
1688 	;
1689 server_harden_large_queries: VAR_HARDEN_LARGE_QUERIES STRING_ARG
1690 	{
1691 		OUTYY(("P(server_harden_large_queries:%s)\n", $2));
1692 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1693 			yyerror("expected yes or no.");
1694 		else cfg_parser->cfg->harden_large_queries =
1695 			(strcmp($2, "yes")==0);
1696 		free($2);
1697 	}
1698 	;
1699 server_harden_glue: VAR_HARDEN_GLUE STRING_ARG
1700 	{
1701 		OUTYY(("P(server_harden_glue:%s)\n", $2));
1702 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1703 			yyerror("expected yes or no.");
1704 		else cfg_parser->cfg->harden_glue =
1705 			(strcmp($2, "yes")==0);
1706 		free($2);
1707 	}
1708 	;
1709 server_harden_dnssec_stripped: VAR_HARDEN_DNSSEC_STRIPPED STRING_ARG
1710 	{
1711 		OUTYY(("P(server_harden_dnssec_stripped:%s)\n", $2));
1712 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1713 			yyerror("expected yes or no.");
1714 		else cfg_parser->cfg->harden_dnssec_stripped =
1715 			(strcmp($2, "yes")==0);
1716 		free($2);
1717 	}
1718 	;
1719 server_harden_below_nxdomain: VAR_HARDEN_BELOW_NXDOMAIN STRING_ARG
1720 	{
1721 		OUTYY(("P(server_harden_below_nxdomain:%s)\n", $2));
1722 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1723 			yyerror("expected yes or no.");
1724 		else cfg_parser->cfg->harden_below_nxdomain =
1725 			(strcmp($2, "yes")==0);
1726 		free($2);
1727 	}
1728 	;
1729 server_harden_referral_path: VAR_HARDEN_REFERRAL_PATH STRING_ARG
1730 	{
1731 		OUTYY(("P(server_harden_referral_path:%s)\n", $2));
1732 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1733 			yyerror("expected yes or no.");
1734 		else cfg_parser->cfg->harden_referral_path =
1735 			(strcmp($2, "yes")==0);
1736 		free($2);
1737 	}
1738 	;
1739 server_harden_algo_downgrade: VAR_HARDEN_ALGO_DOWNGRADE STRING_ARG
1740 	{
1741 		OUTYY(("P(server_harden_algo_downgrade:%s)\n", $2));
1742 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1743 			yyerror("expected yes or no.");
1744 		else cfg_parser->cfg->harden_algo_downgrade =
1745 			(strcmp($2, "yes")==0);
1746 		free($2);
1747 	}
1748 	;
1749 server_use_caps_for_id: VAR_USE_CAPS_FOR_ID STRING_ARG
1750 	{
1751 		OUTYY(("P(server_use_caps_for_id:%s)\n", $2));
1752 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1753 			yyerror("expected yes or no.");
1754 		else cfg_parser->cfg->use_caps_bits_for_id =
1755 			(strcmp($2, "yes")==0);
1756 		free($2);
1757 	}
1758 	;
1759 server_caps_whitelist: VAR_CAPS_WHITELIST STRING_ARG
1760 	{
1761 		OUTYY(("P(server_caps_whitelist:%s)\n", $2));
1762 		if(!cfg_strlist_insert(&cfg_parser->cfg->caps_whitelist, $2))
1763 			yyerror("out of memory");
1764 	}
1765 	;
1766 server_private_address: VAR_PRIVATE_ADDRESS STRING_ARG
1767 	{
1768 		OUTYY(("P(server_private_address:%s)\n", $2));
1769 		if(!cfg_strlist_insert(&cfg_parser->cfg->private_address, $2))
1770 			yyerror("out of memory");
1771 	}
1772 	;
1773 server_private_domain: VAR_PRIVATE_DOMAIN STRING_ARG
1774 	{
1775 		OUTYY(("P(server_private_domain:%s)\n", $2));
1776 		if(!cfg_strlist_insert(&cfg_parser->cfg->private_domain, $2))
1777 			yyerror("out of memory");
1778 	}
1779 	;
1780 server_prefetch: VAR_PREFETCH STRING_ARG
1781 	{
1782 		OUTYY(("P(server_prefetch:%s)\n", $2));
1783 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1784 			yyerror("expected yes or no.");
1785 		else cfg_parser->cfg->prefetch = (strcmp($2, "yes")==0);
1786 		free($2);
1787 	}
1788 	;
1789 server_prefetch_key: VAR_PREFETCH_KEY STRING_ARG
1790 	{
1791 		OUTYY(("P(server_prefetch_key:%s)\n", $2));
1792 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1793 			yyerror("expected yes or no.");
1794 		else cfg_parser->cfg->prefetch_key = (strcmp($2, "yes")==0);
1795 		free($2);
1796 	}
1797 	;
1798 server_deny_any: VAR_DENY_ANY STRING_ARG
1799 	{
1800 		OUTYY(("P(server_deny_any:%s)\n", $2));
1801 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1802 			yyerror("expected yes or no.");
1803 		else cfg_parser->cfg->deny_any = (strcmp($2, "yes")==0);
1804 		free($2);
1805 	}
1806 	;
1807 server_unwanted_reply_threshold: VAR_UNWANTED_REPLY_THRESHOLD STRING_ARG
1808 	{
1809 		OUTYY(("P(server_unwanted_reply_threshold:%s)\n", $2));
1810 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1811 			yyerror("number expected");
1812 		else cfg_parser->cfg->unwanted_threshold = atoi($2);
1813 		free($2);
1814 	}
1815 	;
1816 server_do_not_query_address: VAR_DO_NOT_QUERY_ADDRESS STRING_ARG
1817 	{
1818 		OUTYY(("P(server_do_not_query_address:%s)\n", $2));
1819 		if(!cfg_strlist_insert(&cfg_parser->cfg->donotqueryaddrs, $2))
1820 			yyerror("out of memory");
1821 	}
1822 	;
1823 server_do_not_query_localhost: VAR_DO_NOT_QUERY_LOCALHOST STRING_ARG
1824 	{
1825 		OUTYY(("P(server_do_not_query_localhost:%s)\n", $2));
1826 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1827 			yyerror("expected yes or no.");
1828 		else cfg_parser->cfg->donotquery_localhost =
1829 			(strcmp($2, "yes")==0);
1830 		free($2);
1831 	}
1832 	;
1833 server_access_control: VAR_ACCESS_CONTROL STRING_ARG STRING_ARG
1834 	{
1835 		OUTYY(("P(server_access_control:%s %s)\n", $2, $3));
1836 		if(strcmp($3, "deny")!=0 && strcmp($3, "refuse")!=0 &&
1837 			strcmp($3, "deny_non_local")!=0 &&
1838 			strcmp($3, "refuse_non_local")!=0 &&
1839 			strcmp($3, "allow_setrd")!=0 &&
1840 			strcmp($3, "allow")!=0 &&
1841 			strcmp($3, "allow_snoop")!=0) {
1842 			yyerror("expected deny, refuse, deny_non_local, "
1843 				"refuse_non_local, allow, allow_setrd or "
1844 				"allow_snoop in access control action");
1845 			free($2);
1846 			free($3);
1847 		} else {
1848 			if(!cfg_str2list_insert(&cfg_parser->cfg->acls, $2, $3))
1849 				fatal_exit("out of memory adding acl");
1850 		}
1851 	}
1852 	;
1853 server_module_conf: VAR_MODULE_CONF STRING_ARG
1854 	{
1855 		OUTYY(("P(server_module_conf:%s)\n", $2));
1856 		free(cfg_parser->cfg->module_conf);
1857 		cfg_parser->cfg->module_conf = $2;
1858 	}
1859 	;
1860 server_val_override_date: VAR_VAL_OVERRIDE_DATE STRING_ARG
1861 	{
1862 		OUTYY(("P(server_val_override_date:%s)\n", $2));
1863 		if(*$2 == '\0' || strcmp($2, "0") == 0) {
1864 			cfg_parser->cfg->val_date_override = 0;
1865 		} else if(strlen($2) == 14) {
1866 			cfg_parser->cfg->val_date_override =
1867 				cfg_convert_timeval($2);
1868 			if(!cfg_parser->cfg->val_date_override)
1869 				yyerror("bad date/time specification");
1870 		} else {
1871 			if(atoi($2) == 0)
1872 				yyerror("number expected");
1873 			cfg_parser->cfg->val_date_override = atoi($2);
1874 		}
1875 		free($2);
1876 	}
1877 	;
1878 server_val_sig_skew_min: VAR_VAL_SIG_SKEW_MIN STRING_ARG
1879 	{
1880 		OUTYY(("P(server_val_sig_skew_min:%s)\n", $2));
1881 		if(*$2 == '\0' || strcmp($2, "0") == 0) {
1882 			cfg_parser->cfg->val_sig_skew_min = 0;
1883 		} else {
1884 			cfg_parser->cfg->val_sig_skew_min = atoi($2);
1885 			if(!cfg_parser->cfg->val_sig_skew_min)
1886 				yyerror("number expected");
1887 		}
1888 		free($2);
1889 	}
1890 	;
1891 server_val_sig_skew_max: VAR_VAL_SIG_SKEW_MAX STRING_ARG
1892 	{
1893 		OUTYY(("P(server_val_sig_skew_max:%s)\n", $2));
1894 		if(*$2 == '\0' || strcmp($2, "0") == 0) {
1895 			cfg_parser->cfg->val_sig_skew_max = 0;
1896 		} else {
1897 			cfg_parser->cfg->val_sig_skew_max = atoi($2);
1898 			if(!cfg_parser->cfg->val_sig_skew_max)
1899 				yyerror("number expected");
1900 		}
1901 		free($2);
1902 	}
1903 	;
1904 server_val_max_restart: VAR_VAL_MAX_RESTART STRING_ARG
1905 	{
1906 		OUTYY(("P(server_val_max_restart:%s)\n", $2));
1907 		if(*$2 == '\0' || strcmp($2, "0") == 0) {
1908 			cfg_parser->cfg->val_max_restart = 0;
1909 		} else {
1910 			cfg_parser->cfg->val_max_restart = atoi($2);
1911 			if(!cfg_parser->cfg->val_max_restart)
1912 				yyerror("number expected");
1913 		}
1914 		free($2);
1915 	}
1916 	;
1917 server_cache_max_ttl: VAR_CACHE_MAX_TTL STRING_ARG
1918 	{
1919 		OUTYY(("P(server_cache_max_ttl:%s)\n", $2));
1920 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1921 			yyerror("number expected");
1922 		else cfg_parser->cfg->max_ttl = atoi($2);
1923 		free($2);
1924 	}
1925 	;
1926 server_cache_max_negative_ttl: VAR_CACHE_MAX_NEGATIVE_TTL STRING_ARG
1927 	{
1928 		OUTYY(("P(server_cache_max_negative_ttl:%s)\n", $2));
1929 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1930 			yyerror("number expected");
1931 		else cfg_parser->cfg->max_negative_ttl = atoi($2);
1932 		free($2);
1933 	}
1934 	;
1935 server_cache_min_ttl: VAR_CACHE_MIN_TTL STRING_ARG
1936 	{
1937 		OUTYY(("P(server_cache_min_ttl:%s)\n", $2));
1938 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1939 			yyerror("number expected");
1940 		else cfg_parser->cfg->min_ttl = atoi($2);
1941 		free($2);
1942 	}
1943 	;
1944 server_bogus_ttl: VAR_BOGUS_TTL STRING_ARG
1945 	{
1946 		OUTYY(("P(server_bogus_ttl:%s)\n", $2));
1947 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
1948 			yyerror("number expected");
1949 		else cfg_parser->cfg->bogus_ttl = atoi($2);
1950 		free($2);
1951 	}
1952 	;
1953 server_val_clean_additional: VAR_VAL_CLEAN_ADDITIONAL STRING_ARG
1954 	{
1955 		OUTYY(("P(server_val_clean_additional:%s)\n", $2));
1956 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1957 			yyerror("expected yes or no.");
1958 		else cfg_parser->cfg->val_clean_additional =
1959 			(strcmp($2, "yes")==0);
1960 		free($2);
1961 	}
1962 	;
1963 server_val_permissive_mode: VAR_VAL_PERMISSIVE_MODE STRING_ARG
1964 	{
1965 		OUTYY(("P(server_val_permissive_mode:%s)\n", $2));
1966 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1967 			yyerror("expected yes or no.");
1968 		else cfg_parser->cfg->val_permissive_mode =
1969 			(strcmp($2, "yes")==0);
1970 		free($2);
1971 	}
1972 	;
1973 server_aggressive_nsec: VAR_AGGRESSIVE_NSEC STRING_ARG
1974 	{
1975 		OUTYY(("P(server_aggressive_nsec:%s)\n", $2));
1976 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1977 			yyerror("expected yes or no.");
1978 		else
1979 			cfg_parser->cfg->aggressive_nsec =
1980 				(strcmp($2, "yes")==0);
1981 		free($2);
1982 	}
1983 	;
1984 server_ignore_cd_flag: VAR_IGNORE_CD_FLAG STRING_ARG
1985 	{
1986 		OUTYY(("P(server_ignore_cd_flag:%s)\n", $2));
1987 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1988 			yyerror("expected yes or no.");
1989 		else cfg_parser->cfg->ignore_cd = (strcmp($2, "yes")==0);
1990 		free($2);
1991 	}
1992 	;
1993 server_serve_expired: VAR_SERVE_EXPIRED STRING_ARG
1994 	{
1995 		OUTYY(("P(server_serve_expired:%s)\n", $2));
1996 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
1997 			yyerror("expected yes or no.");
1998 		else cfg_parser->cfg->serve_expired = (strcmp($2, "yes")==0);
1999 		free($2);
2000 	}
2001 	;
2002 server_serve_expired_ttl: VAR_SERVE_EXPIRED_TTL STRING_ARG
2003 	{
2004 		OUTYY(("P(server_serve_expired_ttl:%s)\n", $2));
2005 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2006 			yyerror("number expected");
2007 		else cfg_parser->cfg->serve_expired_ttl = atoi($2);
2008 		free($2);
2009 	}
2010 	;
2011 server_serve_expired_ttl_reset: VAR_SERVE_EXPIRED_TTL_RESET STRING_ARG
2012 	{
2013 		OUTYY(("P(server_serve_expired_ttl_reset:%s)\n", $2));
2014 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2015 			yyerror("expected yes or no.");
2016 		else cfg_parser->cfg->serve_expired_ttl_reset = (strcmp($2, "yes")==0);
2017 		free($2);
2018 	}
2019 	;
2020 server_serve_expired_reply_ttl: VAR_SERVE_EXPIRED_REPLY_TTL STRING_ARG
2021 	{
2022 		OUTYY(("P(server_serve_expired_reply_ttl:%s)\n", $2));
2023 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2024 			yyerror("number expected");
2025 		else cfg_parser->cfg->serve_expired_reply_ttl = atoi($2);
2026 		free($2);
2027 	}
2028 	;
2029 server_serve_expired_client_timeout: VAR_SERVE_EXPIRED_CLIENT_TIMEOUT STRING_ARG
2030 	{
2031 		OUTYY(("P(server_serve_expired_client_timeout:%s)\n", $2));
2032 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2033 			yyerror("number expected");
2034 		else cfg_parser->cfg->serve_expired_client_timeout = atoi($2);
2035 		free($2);
2036 	}
2037 	;
2038 server_ede_serve_expired: VAR_EDE_SERVE_EXPIRED STRING_ARG
2039 	{
2040 		OUTYY(("P(server_ede_serve_expired:%s)\n", $2));
2041 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2042 			yyerror("expected yes or no.");
2043 		else cfg_parser->cfg->ede_serve_expired = (strcmp($2, "yes")==0);
2044 		free($2);
2045 	}
2046 	;
2047 server_serve_original_ttl: VAR_SERVE_ORIGINAL_TTL STRING_ARG
2048 	{
2049 		OUTYY(("P(server_serve_original_ttl:%s)\n", $2));
2050 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2051 			yyerror("expected yes or no.");
2052 		else cfg_parser->cfg->serve_original_ttl = (strcmp($2, "yes")==0);
2053 		free($2);
2054 	}
2055 	;
2056 server_fake_dsa: VAR_FAKE_DSA STRING_ARG
2057 	{
2058 		OUTYY(("P(server_fake_dsa:%s)\n", $2));
2059 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2060 			yyerror("expected yes or no.");
2061 #if defined(HAVE_SSL) || defined(HAVE_NETTLE)
2062 		else fake_dsa = (strcmp($2, "yes")==0);
2063 		if(fake_dsa)
2064 			log_warn("test option fake_dsa is enabled");
2065 #endif
2066 		free($2);
2067 	}
2068 	;
2069 server_fake_sha1: VAR_FAKE_SHA1 STRING_ARG
2070 	{
2071 		OUTYY(("P(server_fake_sha1:%s)\n", $2));
2072 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2073 			yyerror("expected yes or no.");
2074 #if defined(HAVE_SSL) || defined(HAVE_NETTLE)
2075 		else fake_sha1 = (strcmp($2, "yes")==0);
2076 		if(fake_sha1)
2077 			log_warn("test option fake_sha1 is enabled");
2078 #endif
2079 		free($2);
2080 	}
2081 	;
2082 server_val_log_level: VAR_VAL_LOG_LEVEL STRING_ARG
2083 	{
2084 		OUTYY(("P(server_val_log_level:%s)\n", $2));
2085 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2086 			yyerror("number expected");
2087 		else cfg_parser->cfg->val_log_level = atoi($2);
2088 		free($2);
2089 	}
2090 	;
2091 server_val_nsec3_keysize_iterations: VAR_VAL_NSEC3_KEYSIZE_ITERATIONS STRING_ARG
2092 	{
2093 		OUTYY(("P(server_val_nsec3_keysize_iterations:%s)\n", $2));
2094 		free(cfg_parser->cfg->val_nsec3_key_iterations);
2095 		cfg_parser->cfg->val_nsec3_key_iterations = $2;
2096 	}
2097 	;
2098 server_zonemd_permissive_mode: VAR_ZONEMD_PERMISSIVE_MODE STRING_ARG
2099 	{
2100 		OUTYY(("P(server_zonemd_permissive_mode:%s)\n", $2));
2101 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2102 			yyerror("expected yes or no.");
2103 		else	cfg_parser->cfg->zonemd_permissive_mode = (strcmp($2, "yes")==0);
2104 		free($2);
2105 	}
2106 	;
2107 server_add_holddown: VAR_ADD_HOLDDOWN STRING_ARG
2108 	{
2109 		OUTYY(("P(server_add_holddown:%s)\n", $2));
2110 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2111 			yyerror("number expected");
2112 		else cfg_parser->cfg->add_holddown = atoi($2);
2113 		free($2);
2114 	}
2115 	;
2116 server_del_holddown: VAR_DEL_HOLDDOWN STRING_ARG
2117 	{
2118 		OUTYY(("P(server_del_holddown:%s)\n", $2));
2119 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2120 			yyerror("number expected");
2121 		else cfg_parser->cfg->del_holddown = atoi($2);
2122 		free($2);
2123 	}
2124 	;
2125 server_keep_missing: VAR_KEEP_MISSING STRING_ARG
2126 	{
2127 		OUTYY(("P(server_keep_missing:%s)\n", $2));
2128 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2129 			yyerror("number expected");
2130 		else cfg_parser->cfg->keep_missing = atoi($2);
2131 		free($2);
2132 	}
2133 	;
2134 server_permit_small_holddown: VAR_PERMIT_SMALL_HOLDDOWN STRING_ARG
2135 	{
2136 		OUTYY(("P(server_permit_small_holddown:%s)\n", $2));
2137 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2138 			yyerror("expected yes or no.");
2139 		else cfg_parser->cfg->permit_small_holddown =
2140 			(strcmp($2, "yes")==0);
2141 		free($2);
2142 	}
2143 server_key_cache_size: VAR_KEY_CACHE_SIZE STRING_ARG
2144 	{
2145 		OUTYY(("P(server_key_cache_size:%s)\n", $2));
2146 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->key_cache_size))
2147 			yyerror("memory size expected");
2148 		free($2);
2149 	}
2150 	;
2151 server_key_cache_slabs: VAR_KEY_CACHE_SLABS STRING_ARG
2152 	{
2153 		OUTYY(("P(server_key_cache_slabs:%s)\n", $2));
2154 		if(atoi($2) == 0) {
2155 			yyerror("number expected");
2156 		} else {
2157 			cfg_parser->cfg->key_cache_slabs = atoi($2);
2158 			if(!is_pow2(cfg_parser->cfg->key_cache_slabs))
2159 				yyerror("must be a power of 2");
2160 		}
2161 		free($2);
2162 	}
2163 	;
2164 server_neg_cache_size: VAR_NEG_CACHE_SIZE STRING_ARG
2165 	{
2166 		OUTYY(("P(server_neg_cache_size:%s)\n", $2));
2167 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->neg_cache_size))
2168 			yyerror("memory size expected");
2169 		free($2);
2170 	}
2171 	;
2172 server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
2173 	{
2174 		OUTYY(("P(server_local_zone:%s %s)\n", $2, $3));
2175 		if(strcmp($3, "static")!=0 && strcmp($3, "deny")!=0 &&
2176 		   strcmp($3, "refuse")!=0 && strcmp($3, "redirect")!=0 &&
2177 		   strcmp($3, "transparent")!=0 && strcmp($3, "nodefault")!=0
2178 		   && strcmp($3, "typetransparent")!=0
2179 		   && strcmp($3, "always_transparent")!=0
2180 		   && strcmp($3, "always_refuse")!=0
2181 		   && strcmp($3, "always_nxdomain")!=0
2182 		   && strcmp($3, "always_nodata")!=0
2183 		   && strcmp($3, "always_deny")!=0
2184 		   && strcmp($3, "always_null")!=0
2185 		   && strcmp($3, "noview")!=0
2186 		   && strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0
2187 		   && strcmp($3, "inform_redirect") != 0
2188 		   && strcmp($3, "ipset") != 0) {
2189 			yyerror("local-zone type: expected static, deny, "
2190 				"refuse, redirect, transparent, "
2191 				"typetransparent, inform, inform_deny, "
2192 				"inform_redirect, always_transparent, "
2193 				"always_refuse, always_nxdomain, "
2194 				"always_nodata, always_deny, always_null, "
2195 				"noview, nodefault or ipset");
2196 			free($2);
2197 			free($3);
2198 		} else if(strcmp($3, "nodefault")==0) {
2199 			if(!cfg_strlist_insert(&cfg_parser->cfg->
2200 				local_zones_nodefault, $2))
2201 				fatal_exit("out of memory adding local-zone");
2202 			free($3);
2203 #ifdef USE_IPSET
2204 		} else if(strcmp($3, "ipset")==0) {
2205 			size_t len = strlen($2);
2206 			/* Make sure to add the trailing dot.
2207 			 * These are str compared to domain names. */
2208 			if($2[len-1] != '.') {
2209 				if(!($2 = realloc($2, len+2))) {
2210 					fatal_exit("out of memory adding local-zone");
2211 				}
2212 				$2[len] = '.';
2213 				$2[len+1] = 0;
2214 			}
2215 			if(!cfg_strlist_insert(&cfg_parser->cfg->
2216 				local_zones_ipset, $2))
2217 				fatal_exit("out of memory adding local-zone");
2218 			free($3);
2219 #endif
2220 		} else {
2221 			if(!cfg_str2list_insert(&cfg_parser->cfg->local_zones,
2222 				$2, $3))
2223 				fatal_exit("out of memory adding local-zone");
2224 		}
2225 	}
2226 	;
2227 server_local_data: VAR_LOCAL_DATA STRING_ARG
2228 	{
2229 		OUTYY(("P(server_local_data:%s)\n", $2));
2230 		if(!cfg_strlist_insert(&cfg_parser->cfg->local_data, $2))
2231 			fatal_exit("out of memory adding local-data");
2232 	}
2233 	;
2234 server_local_data_ptr: VAR_LOCAL_DATA_PTR STRING_ARG
2235 	{
2236 		char* ptr;
2237 		OUTYY(("P(server_local_data_ptr:%s)\n", $2));
2238 		ptr = cfg_ptr_reverse($2);
2239 		free($2);
2240 		if(ptr) {
2241 			if(!cfg_strlist_insert(&cfg_parser->cfg->
2242 				local_data, ptr))
2243 				fatal_exit("out of memory adding local-data");
2244 		} else {
2245 			yyerror("local-data-ptr could not be reversed");
2246 		}
2247 	}
2248 	;
2249 server_minimal_responses: VAR_MINIMAL_RESPONSES STRING_ARG
2250 	{
2251 		OUTYY(("P(server_minimal_responses:%s)\n", $2));
2252 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2253 			yyerror("expected yes or no.");
2254 		else cfg_parser->cfg->minimal_responses =
2255 			(strcmp($2, "yes")==0);
2256 		free($2);
2257 	}
2258 	;
2259 server_rrset_roundrobin: VAR_RRSET_ROUNDROBIN STRING_ARG
2260 	{
2261 		OUTYY(("P(server_rrset_roundrobin:%s)\n", $2));
2262 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2263 			yyerror("expected yes or no.");
2264 		else cfg_parser->cfg->rrset_roundrobin =
2265 			(strcmp($2, "yes")==0);
2266 		free($2);
2267 	}
2268 	;
2269 server_unknown_server_time_limit: VAR_UNKNOWN_SERVER_TIME_LIMIT STRING_ARG
2270 	{
2271 		OUTYY(("P(server_unknown_server_time_limit:%s)\n", $2));
2272 		cfg_parser->cfg->unknown_server_time_limit = atoi($2);
2273 		free($2);
2274 	}
2275 	;
2276 server_max_udp_size: VAR_MAX_UDP_SIZE STRING_ARG
2277 	{
2278 		OUTYY(("P(server_max_udp_size:%s)\n", $2));
2279 		cfg_parser->cfg->max_udp_size = atoi($2);
2280 		free($2);
2281 	}
2282 	;
2283 server_dns64_prefix: VAR_DNS64_PREFIX STRING_ARG
2284 	{
2285 		OUTYY(("P(dns64_prefix:%s)\n", $2));
2286 		free(cfg_parser->cfg->dns64_prefix);
2287 		cfg_parser->cfg->dns64_prefix = $2;
2288 	}
2289 	;
2290 server_dns64_synthall: VAR_DNS64_SYNTHALL STRING_ARG
2291 	{
2292 		OUTYY(("P(server_dns64_synthall:%s)\n", $2));
2293 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2294 			yyerror("expected yes or no.");
2295 		else cfg_parser->cfg->dns64_synthall = (strcmp($2, "yes")==0);
2296 		free($2);
2297 	}
2298 	;
2299 server_dns64_ignore_aaaa: VAR_DNS64_IGNORE_AAAA STRING_ARG
2300 	{
2301 		OUTYY(("P(dns64_ignore_aaaa:%s)\n", $2));
2302 		if(!cfg_strlist_insert(&cfg_parser->cfg->dns64_ignore_aaaa,
2303 			$2))
2304 			fatal_exit("out of memory adding dns64-ignore-aaaa");
2305 	}
2306 	;
2307 server_define_tag: VAR_DEFINE_TAG STRING_ARG
2308 	{
2309 		char* p, *s = $2;
2310 		OUTYY(("P(server_define_tag:%s)\n", $2));
2311 		while((p=strsep(&s, " \t\n")) != NULL) {
2312 			if(*p) {
2313 				if(!config_add_tag(cfg_parser->cfg, p))
2314 					yyerror("could not define-tag, "
2315 						"out of memory");
2316 			}
2317 		}
2318 		free($2);
2319 	}
2320 	;
2321 server_local_zone_tag: VAR_LOCAL_ZONE_TAG STRING_ARG STRING_ARG
2322 	{
2323 		size_t len = 0;
2324 		uint8_t* bitlist = config_parse_taglist(cfg_parser->cfg, $3,
2325 			&len);
2326 		free($3);
2327 		OUTYY(("P(server_local_zone_tag:%s)\n", $2));
2328 		if(!bitlist) {
2329 			yyerror("could not parse tags, (define-tag them first)");
2330 			free($2);
2331 		}
2332 		if(bitlist) {
2333 			if(!cfg_strbytelist_insert(
2334 				&cfg_parser->cfg->local_zone_tags,
2335 				$2, bitlist, len)) {
2336 				yyerror("out of memory");
2337 				free($2);
2338 			}
2339 		}
2340 	}
2341 	;
2342 server_access_control_tag: VAR_ACCESS_CONTROL_TAG STRING_ARG STRING_ARG
2343 	{
2344 		size_t len = 0;
2345 		uint8_t* bitlist = config_parse_taglist(cfg_parser->cfg, $3,
2346 			&len);
2347 		free($3);
2348 		OUTYY(("P(server_access_control_tag:%s)\n", $2));
2349 		if(!bitlist) {
2350 			yyerror("could not parse tags, (define-tag them first)");
2351 			free($2);
2352 		}
2353 		if(bitlist) {
2354 			if(!cfg_strbytelist_insert(
2355 				&cfg_parser->cfg->acl_tags,
2356 				$2, bitlist, len)) {
2357 				yyerror("out of memory");
2358 				free($2);
2359 			}
2360 		}
2361 	}
2362 	;
2363 server_access_control_tag_action: VAR_ACCESS_CONTROL_TAG_ACTION STRING_ARG STRING_ARG STRING_ARG
2364 	{
2365 		OUTYY(("P(server_access_control_tag_action:%s %s %s)\n", $2, $3, $4));
2366 		if(!cfg_str3list_insert(&cfg_parser->cfg->acl_tag_actions,
2367 			$2, $3, $4)) {
2368 			yyerror("out of memory");
2369 			free($2);
2370 			free($3);
2371 			free($4);
2372 		}
2373 	}
2374 	;
2375 server_access_control_tag_data: VAR_ACCESS_CONTROL_TAG_DATA STRING_ARG STRING_ARG STRING_ARG
2376 	{
2377 		OUTYY(("P(server_access_control_tag_data:%s %s %s)\n", $2, $3, $4));
2378 		if(!cfg_str3list_insert(&cfg_parser->cfg->acl_tag_datas,
2379 			$2, $3, $4)) {
2380 			yyerror("out of memory");
2381 			free($2);
2382 			free($3);
2383 			free($4);
2384 		}
2385 	}
2386 	;
2387 server_local_zone_override: VAR_LOCAL_ZONE_OVERRIDE STRING_ARG STRING_ARG STRING_ARG
2388 	{
2389 		OUTYY(("P(server_local_zone_override:%s %s %s)\n", $2, $3, $4));
2390 		if(!cfg_str3list_insert(&cfg_parser->cfg->local_zone_overrides,
2391 			$2, $3, $4)) {
2392 			yyerror("out of memory");
2393 			free($2);
2394 			free($3);
2395 			free($4);
2396 		}
2397 	}
2398 	;
2399 server_access_control_view: VAR_ACCESS_CONTROL_VIEW STRING_ARG STRING_ARG
2400 	{
2401 		OUTYY(("P(server_access_control_view:%s %s)\n", $2, $3));
2402 		if(!cfg_str2list_insert(&cfg_parser->cfg->acl_view,
2403 			$2, $3)) {
2404 			yyerror("out of memory");
2405 		}
2406 	}
2407 	;
2408 server_response_ip_tag: VAR_RESPONSE_IP_TAG STRING_ARG STRING_ARG
2409 	{
2410 		size_t len = 0;
2411 		uint8_t* bitlist = config_parse_taglist(cfg_parser->cfg, $3,
2412 			&len);
2413 		free($3);
2414 		OUTYY(("P(response_ip_tag:%s)\n", $2));
2415 		if(!bitlist) {
2416 			yyerror("could not parse tags, (define-tag them first)");
2417 			free($2);
2418 		}
2419 		if(bitlist) {
2420 			if(!cfg_strbytelist_insert(
2421 				&cfg_parser->cfg->respip_tags,
2422 				$2, bitlist, len)) {
2423 				yyerror("out of memory");
2424 				free($2);
2425 			}
2426 		}
2427 	}
2428 	;
2429 server_ip_ratelimit: VAR_IP_RATELIMIT STRING_ARG
2430 	{
2431 		OUTYY(("P(server_ip_ratelimit:%s)\n", $2));
2432 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2433 			yyerror("number expected");
2434 		else cfg_parser->cfg->ip_ratelimit = atoi($2);
2435 		free($2);
2436 	}
2437 	;
2438 server_ratelimit: VAR_RATELIMIT STRING_ARG
2439 	{
2440 		OUTYY(("P(server_ratelimit:%s)\n", $2));
2441 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2442 			yyerror("number expected");
2443 		else cfg_parser->cfg->ratelimit = atoi($2);
2444 		free($2);
2445 	}
2446 	;
2447 server_ip_ratelimit_size: VAR_IP_RATELIMIT_SIZE STRING_ARG
2448 	{
2449 		OUTYY(("P(server_ip_ratelimit_size:%s)\n", $2));
2450 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->ip_ratelimit_size))
2451 			yyerror("memory size expected");
2452 		free($2);
2453 	}
2454 	;
2455 server_ratelimit_size: VAR_RATELIMIT_SIZE STRING_ARG
2456 	{
2457 		OUTYY(("P(server_ratelimit_size:%s)\n", $2));
2458 		if(!cfg_parse_memsize($2, &cfg_parser->cfg->ratelimit_size))
2459 			yyerror("memory size expected");
2460 		free($2);
2461 	}
2462 	;
2463 server_ip_ratelimit_slabs: VAR_IP_RATELIMIT_SLABS STRING_ARG
2464 	{
2465 		OUTYY(("P(server_ip_ratelimit_slabs:%s)\n", $2));
2466 		if(atoi($2) == 0) {
2467 			yyerror("number expected");
2468 		} else {
2469 			cfg_parser->cfg->ip_ratelimit_slabs = atoi($2);
2470 			if(!is_pow2(cfg_parser->cfg->ip_ratelimit_slabs))
2471 				yyerror("must be a power of 2");
2472 		}
2473 		free($2);
2474 	}
2475 	;
2476 server_ratelimit_slabs: VAR_RATELIMIT_SLABS STRING_ARG
2477 	{
2478 		OUTYY(("P(server_ratelimit_slabs:%s)\n", $2));
2479 		if(atoi($2) == 0) {
2480 			yyerror("number expected");
2481 		} else {
2482 			cfg_parser->cfg->ratelimit_slabs = atoi($2);
2483 			if(!is_pow2(cfg_parser->cfg->ratelimit_slabs))
2484 				yyerror("must be a power of 2");
2485 		}
2486 		free($2);
2487 	}
2488 	;
2489 server_ratelimit_for_domain: VAR_RATELIMIT_FOR_DOMAIN STRING_ARG STRING_ARG
2490 	{
2491 		OUTYY(("P(server_ratelimit_for_domain:%s %s)\n", $2, $3));
2492 		if(atoi($3) == 0 && strcmp($3, "0") != 0) {
2493 			yyerror("number expected");
2494 			free($2);
2495 			free($3);
2496 		} else {
2497 			if(!cfg_str2list_insert(&cfg_parser->cfg->
2498 				ratelimit_for_domain, $2, $3))
2499 				fatal_exit("out of memory adding "
2500 					"ratelimit-for-domain");
2501 		}
2502 	}
2503 	;
2504 server_ratelimit_below_domain: VAR_RATELIMIT_BELOW_DOMAIN STRING_ARG STRING_ARG
2505 	{
2506 		OUTYY(("P(server_ratelimit_below_domain:%s %s)\n", $2, $3));
2507 		if(atoi($3) == 0 && strcmp($3, "0") != 0) {
2508 			yyerror("number expected");
2509 			free($2);
2510 			free($3);
2511 		} else {
2512 			if(!cfg_str2list_insert(&cfg_parser->cfg->
2513 				ratelimit_below_domain, $2, $3))
2514 				fatal_exit("out of memory adding "
2515 					"ratelimit-below-domain");
2516 		}
2517 	}
2518 	;
2519 server_ip_ratelimit_factor: VAR_IP_RATELIMIT_FACTOR STRING_ARG
2520 	{
2521 		OUTYY(("P(server_ip_ratelimit_factor:%s)\n", $2));
2522 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2523 			yyerror("number expected");
2524 		else cfg_parser->cfg->ip_ratelimit_factor = atoi($2);
2525 		free($2);
2526 	}
2527 	;
2528 server_ratelimit_factor: VAR_RATELIMIT_FACTOR STRING_ARG
2529 	{
2530 		OUTYY(("P(server_ratelimit_factor:%s)\n", $2));
2531 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2532 			yyerror("number expected");
2533 		else cfg_parser->cfg->ratelimit_factor = atoi($2);
2534 		free($2);
2535 	}
2536 	;
2537 server_ip_ratelimit_backoff: VAR_IP_RATELIMIT_BACKOFF STRING_ARG
2538 	{
2539 		OUTYY(("P(server_ip_ratelimit_backoff:%s)\n", $2));
2540 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2541 			yyerror("expected yes or no.");
2542 		else cfg_parser->cfg->ip_ratelimit_backoff =
2543 			(strcmp($2, "yes")==0);
2544 		free($2);
2545 	}
2546 	;
2547 server_ratelimit_backoff: VAR_RATELIMIT_BACKOFF STRING_ARG
2548 	{
2549 		OUTYY(("P(server_ratelimit_backoff:%s)\n", $2));
2550 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2551 			yyerror("expected yes or no.");
2552 		else cfg_parser->cfg->ratelimit_backoff =
2553 			(strcmp($2, "yes")==0);
2554 		free($2);
2555 	}
2556 	;
2557 server_outbound_msg_retry: VAR_OUTBOUND_MSG_RETRY STRING_ARG
2558 	{
2559 		OUTYY(("P(server_outbound_msg_retry:%s)\n", $2));
2560 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2561 			yyerror("number expected");
2562 		else cfg_parser->cfg->outbound_msg_retry = atoi($2);
2563 		free($2);
2564 	}
2565 	;
2566 server_low_rtt: VAR_LOW_RTT STRING_ARG
2567 	{
2568 		OUTYY(("P(low-rtt option is deprecated, use fast-server-num instead)\n"));
2569 		free($2);
2570 	}
2571 	;
2572 server_fast_server_num: VAR_FAST_SERVER_NUM STRING_ARG
2573 	{
2574 		OUTYY(("P(server_fast_server_num:%s)\n", $2));
2575 		if(atoi($2) <= 0)
2576 			yyerror("number expected");
2577 		else cfg_parser->cfg->fast_server_num = atoi($2);
2578 		free($2);
2579 	}
2580 	;
2581 server_fast_server_permil: VAR_FAST_SERVER_PERMIL STRING_ARG
2582 	{
2583 		OUTYY(("P(server_fast_server_permil:%s)\n", $2));
2584 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2585 			yyerror("number expected");
2586 		else cfg_parser->cfg->fast_server_permil = atoi($2);
2587 		free($2);
2588 	}
2589 	;
2590 server_qname_minimisation: VAR_QNAME_MINIMISATION STRING_ARG
2591 	{
2592 		OUTYY(("P(server_qname_minimisation:%s)\n", $2));
2593 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2594 			yyerror("expected yes or no.");
2595 		else cfg_parser->cfg->qname_minimisation =
2596 			(strcmp($2, "yes")==0);
2597 		free($2);
2598 	}
2599 	;
2600 server_qname_minimisation_strict: VAR_QNAME_MINIMISATION_STRICT STRING_ARG
2601 	{
2602 		OUTYY(("P(server_qname_minimisation_strict:%s)\n", $2));
2603 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2604 			yyerror("expected yes or no.");
2605 		else cfg_parser->cfg->qname_minimisation_strict =
2606 			(strcmp($2, "yes")==0);
2607 		free($2);
2608 	}
2609 	;
2610 server_pad_responses: VAR_PAD_RESPONSES STRING_ARG
2611 	{
2612 		OUTYY(("P(server_pad_responses:%s)\n", $2));
2613 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2614 			yyerror("expected yes or no.");
2615 		else cfg_parser->cfg->pad_responses =
2616 			(strcmp($2, "yes")==0);
2617 		free($2);
2618 	}
2619 	;
2620 server_pad_responses_block_size: VAR_PAD_RESPONSES_BLOCK_SIZE STRING_ARG
2621 	{
2622 		OUTYY(("P(server_pad_responses_block_size:%s)\n", $2));
2623 		if(atoi($2) == 0)
2624 			yyerror("number expected");
2625 		else cfg_parser->cfg->pad_responses_block_size = atoi($2);
2626 		free($2);
2627 	}
2628 	;
2629 server_pad_queries: VAR_PAD_QUERIES STRING_ARG
2630 	{
2631 		OUTYY(("P(server_pad_queries:%s)\n", $2));
2632 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2633 			yyerror("expected yes or no.");
2634 		else cfg_parser->cfg->pad_queries =
2635 			(strcmp($2, "yes")==0);
2636 		free($2);
2637 	}
2638 	;
2639 server_pad_queries_block_size: VAR_PAD_QUERIES_BLOCK_SIZE STRING_ARG
2640 	{
2641 		OUTYY(("P(server_pad_queries_block_size:%s)\n", $2));
2642 		if(atoi($2) == 0)
2643 			yyerror("number expected");
2644 		else cfg_parser->cfg->pad_queries_block_size = atoi($2);
2645 		free($2);
2646 	}
2647 	;
2648 server_ipsecmod_enabled: VAR_IPSECMOD_ENABLED STRING_ARG
2649 	{
2650 	#ifdef USE_IPSECMOD
2651 		OUTYY(("P(server_ipsecmod_enabled:%s)\n", $2));
2652 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2653 			yyerror("expected yes or no.");
2654 		else cfg_parser->cfg->ipsecmod_enabled = (strcmp($2, "yes")==0);
2655 	#else
2656 		OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
2657 	#endif
2658 		free($2);
2659 	}
2660 	;
2661 server_ipsecmod_ignore_bogus: VAR_IPSECMOD_IGNORE_BOGUS STRING_ARG
2662 	{
2663 	#ifdef USE_IPSECMOD
2664 		OUTYY(("P(server_ipsecmod_ignore_bogus:%s)\n", $2));
2665 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2666 			yyerror("expected yes or no.");
2667 		else cfg_parser->cfg->ipsecmod_ignore_bogus = (strcmp($2, "yes")==0);
2668 	#else
2669 		OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
2670 	#endif
2671 		free($2);
2672 	}
2673 	;
2674 server_ipsecmod_hook: VAR_IPSECMOD_HOOK STRING_ARG
2675 	{
2676 	#ifdef USE_IPSECMOD
2677 		OUTYY(("P(server_ipsecmod_hook:%s)\n", $2));
2678 		free(cfg_parser->cfg->ipsecmod_hook);
2679 		cfg_parser->cfg->ipsecmod_hook = $2;
2680 	#else
2681 		OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
2682 		free($2);
2683 	#endif
2684 	}
2685 	;
2686 server_ipsecmod_max_ttl: VAR_IPSECMOD_MAX_TTL STRING_ARG
2687 	{
2688 	#ifdef USE_IPSECMOD
2689 		OUTYY(("P(server_ipsecmod_max_ttl:%s)\n", $2));
2690 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2691 			yyerror("number expected");
2692 		else cfg_parser->cfg->ipsecmod_max_ttl = atoi($2);
2693 		free($2);
2694 	#else
2695 		OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
2696 		free($2);
2697 	#endif
2698 	}
2699 	;
2700 server_ipsecmod_whitelist: VAR_IPSECMOD_WHITELIST STRING_ARG
2701 	{
2702 	#ifdef USE_IPSECMOD
2703 		OUTYY(("P(server_ipsecmod_whitelist:%s)\n", $2));
2704 		if(!cfg_strlist_insert(&cfg_parser->cfg->ipsecmod_whitelist, $2))
2705 			yyerror("out of memory");
2706 	#else
2707 		OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
2708 		free($2);
2709 	#endif
2710 	}
2711 	;
2712 server_ipsecmod_strict: VAR_IPSECMOD_STRICT STRING_ARG
2713 	{
2714 	#ifdef USE_IPSECMOD
2715 		OUTYY(("P(server_ipsecmod_strict:%s)\n", $2));
2716 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2717 			yyerror("expected yes or no.");
2718 		else cfg_parser->cfg->ipsecmod_strict = (strcmp($2, "yes")==0);
2719 		free($2);
2720 	#else
2721 		OUTYY(("P(Compiled without IPsec module, ignoring)\n"));
2722 		free($2);
2723 	#endif
2724 	}
2725 	;
2726 server_edns_client_string: VAR_EDNS_CLIENT_STRING STRING_ARG STRING_ARG
2727 	{
2728 		OUTYY(("P(server_edns_client_string:%s %s)\n", $2, $3));
2729 		if(!cfg_str2list_insert(
2730 			&cfg_parser->cfg->edns_client_strings, $2, $3))
2731 			fatal_exit("out of memory adding "
2732 				"edns-client-string");
2733 	}
2734 	;
2735 server_edns_client_string_opcode: VAR_EDNS_CLIENT_STRING_OPCODE STRING_ARG
2736 	{
2737 		OUTYY(("P(edns_client_string_opcode:%s)\n", $2));
2738 		if(atoi($2) == 0 && strcmp($2, "0") != 0)
2739 			yyerror("option code expected");
2740 		else if(atoi($2) > 65535 || atoi($2) < 0)
2741 			yyerror("option code must be in interval [0, 65535]");
2742 		else cfg_parser->cfg->edns_client_string_opcode = atoi($2);
2743 		free($2);
2744 	}
2745 	;
2746 server_ede: VAR_EDE STRING_ARG
2747 	{
2748 		OUTYY(("P(server_ede:%s)\n", $2));
2749 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2750 			yyerror("expected yes or no.");
2751 		else cfg_parser->cfg->ede = (strcmp($2, "yes")==0);
2752 		free($2);
2753 	}
2754 	;
2755 stub_name: VAR_NAME STRING_ARG
2756 	{
2757 		OUTYY(("P(name:%s)\n", $2));
2758 		if(cfg_parser->cfg->stubs->name)
2759 			yyerror("stub name override, there must be one name "
2760 				"for one stub-zone");
2761 		free(cfg_parser->cfg->stubs->name);
2762 		cfg_parser->cfg->stubs->name = $2;
2763 	}
2764 	;
2765 stub_host: VAR_STUB_HOST STRING_ARG
2766 	{
2767 		OUTYY(("P(stub-host:%s)\n", $2));
2768 		if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->hosts, $2))
2769 			yyerror("out of memory");
2770 	}
2771 	;
2772 stub_addr: VAR_STUB_ADDR STRING_ARG
2773 	{
2774 		OUTYY(("P(stub-addr:%s)\n", $2));
2775 		if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->addrs, $2))
2776 			yyerror("out of memory");
2777 	}
2778 	;
2779 stub_first: VAR_STUB_FIRST STRING_ARG
2780 	{
2781 		OUTYY(("P(stub-first:%s)\n", $2));
2782 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2783 			yyerror("expected yes or no.");
2784 		else cfg_parser->cfg->stubs->isfirst=(strcmp($2, "yes")==0);
2785 		free($2);
2786 	}
2787 	;
2788 stub_no_cache: VAR_STUB_NO_CACHE STRING_ARG
2789 	{
2790 		OUTYY(("P(stub-no-cache:%s)\n", $2));
2791 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2792 			yyerror("expected yes or no.");
2793 		else cfg_parser->cfg->stubs->no_cache=(strcmp($2, "yes")==0);
2794 		free($2);
2795 	}
2796 	;
2797 stub_ssl_upstream: VAR_STUB_SSL_UPSTREAM STRING_ARG
2798 	{
2799 		OUTYY(("P(stub-ssl-upstream:%s)\n", $2));
2800 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2801 			yyerror("expected yes or no.");
2802 		else cfg_parser->cfg->stubs->ssl_upstream =
2803 			(strcmp($2, "yes")==0);
2804 		free($2);
2805 	}
2806 	;
2807 stub_tcp_upstream: VAR_STUB_TCP_UPSTREAM STRING_ARG
2808         {
2809                 OUTYY(("P(stub-tcp-upstream:%s)\n", $2));
2810                 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2811                         yyerror("expected yes or no.");
2812                 else cfg_parser->cfg->stubs->tcp_upstream =
2813                         (strcmp($2, "yes")==0);
2814                 free($2);
2815         }
2816         ;
2817 stub_prime: VAR_STUB_PRIME STRING_ARG
2818 	{
2819 		OUTYY(("P(stub-prime:%s)\n", $2));
2820 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2821 			yyerror("expected yes or no.");
2822 		else cfg_parser->cfg->stubs->isprime =
2823 			(strcmp($2, "yes")==0);
2824 		free($2);
2825 	}
2826 	;
2827 forward_name: VAR_NAME STRING_ARG
2828 	{
2829 		OUTYY(("P(name:%s)\n", $2));
2830 		if(cfg_parser->cfg->forwards->name)
2831 			yyerror("forward name override, there must be one "
2832 				"name for one forward-zone");
2833 		free(cfg_parser->cfg->forwards->name);
2834 		cfg_parser->cfg->forwards->name = $2;
2835 	}
2836 	;
2837 forward_host: VAR_FORWARD_HOST STRING_ARG
2838 	{
2839 		OUTYY(("P(forward-host:%s)\n", $2));
2840 		if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->hosts, $2))
2841 			yyerror("out of memory");
2842 	}
2843 	;
2844 forward_addr: VAR_FORWARD_ADDR STRING_ARG
2845 	{
2846 		OUTYY(("P(forward-addr:%s)\n", $2));
2847 		if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->addrs, $2))
2848 			yyerror("out of memory");
2849 	}
2850 	;
2851 forward_first: VAR_FORWARD_FIRST STRING_ARG
2852 	{
2853 		OUTYY(("P(forward-first:%s)\n", $2));
2854 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2855 			yyerror("expected yes or no.");
2856 		else cfg_parser->cfg->forwards->isfirst=(strcmp($2, "yes")==0);
2857 		free($2);
2858 	}
2859 	;
2860 forward_no_cache: VAR_FORWARD_NO_CACHE STRING_ARG
2861 	{
2862 		OUTYY(("P(forward-no-cache:%s)\n", $2));
2863 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2864 			yyerror("expected yes or no.");
2865 		else cfg_parser->cfg->forwards->no_cache=(strcmp($2, "yes")==0);
2866 		free($2);
2867 	}
2868 	;
2869 forward_ssl_upstream: VAR_FORWARD_SSL_UPSTREAM STRING_ARG
2870 	{
2871 		OUTYY(("P(forward-ssl-upstream:%s)\n", $2));
2872 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2873 			yyerror("expected yes or no.");
2874 		else cfg_parser->cfg->forwards->ssl_upstream =
2875 			(strcmp($2, "yes")==0);
2876 		free($2);
2877 	}
2878 	;
2879 forward_tcp_upstream: VAR_FORWARD_TCP_UPSTREAM STRING_ARG
2880         {
2881                 OUTYY(("P(forward-tcp-upstream:%s)\n", $2));
2882                 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2883                         yyerror("expected yes or no.");
2884                 else cfg_parser->cfg->forwards->tcp_upstream =
2885                         (strcmp($2, "yes")==0);
2886                 free($2);
2887         }
2888         ;
2889 auth_name: VAR_NAME STRING_ARG
2890 	{
2891 		OUTYY(("P(name:%s)\n", $2));
2892 		if(cfg_parser->cfg->auths->name)
2893 			yyerror("auth name override, there must be one name "
2894 				"for one auth-zone");
2895 		free(cfg_parser->cfg->auths->name);
2896 		cfg_parser->cfg->auths->name = $2;
2897 	}
2898 	;
2899 auth_zonefile: VAR_ZONEFILE STRING_ARG
2900 	{
2901 		OUTYY(("P(zonefile:%s)\n", $2));
2902 		free(cfg_parser->cfg->auths->zonefile);
2903 		cfg_parser->cfg->auths->zonefile = $2;
2904 	}
2905 	;
2906 auth_master: VAR_MASTER STRING_ARG
2907 	{
2908 		OUTYY(("P(master:%s)\n", $2));
2909 		if(!cfg_strlist_insert(&cfg_parser->cfg->auths->masters, $2))
2910 			yyerror("out of memory");
2911 	}
2912 	;
2913 auth_url: VAR_URL STRING_ARG
2914 	{
2915 		OUTYY(("P(url:%s)\n", $2));
2916 		if(!cfg_strlist_insert(&cfg_parser->cfg->auths->urls, $2))
2917 			yyerror("out of memory");
2918 	}
2919 	;
2920 auth_allow_notify: VAR_ALLOW_NOTIFY STRING_ARG
2921 	{
2922 		OUTYY(("P(allow-notify:%s)\n", $2));
2923 		if(!cfg_strlist_insert(&cfg_parser->cfg->auths->allow_notify,
2924 			$2))
2925 			yyerror("out of memory");
2926 	}
2927 	;
2928 auth_zonemd_check: VAR_ZONEMD_CHECK STRING_ARG
2929 	{
2930 		OUTYY(("P(zonemd-check:%s)\n", $2));
2931 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2932 			yyerror("expected yes or no.");
2933 		else cfg_parser->cfg->auths->zonemd_check =
2934 			(strcmp($2, "yes")==0);
2935 		free($2);
2936 	}
2937 	;
2938 auth_zonemd_reject_absence: VAR_ZONEMD_REJECT_ABSENCE STRING_ARG
2939 	{
2940 		OUTYY(("P(zonemd-reject-absence:%s)\n", $2));
2941 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2942 			yyerror("expected yes or no.");
2943 		else cfg_parser->cfg->auths->zonemd_reject_absence =
2944 			(strcmp($2, "yes")==0);
2945 		free($2);
2946 	}
2947 	;
2948 auth_for_downstream: VAR_FOR_DOWNSTREAM STRING_ARG
2949 	{
2950 		OUTYY(("P(for-downstream:%s)\n", $2));
2951 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2952 			yyerror("expected yes or no.");
2953 		else cfg_parser->cfg->auths->for_downstream =
2954 			(strcmp($2, "yes")==0);
2955 		free($2);
2956 	}
2957 	;
2958 auth_for_upstream: VAR_FOR_UPSTREAM STRING_ARG
2959 	{
2960 		OUTYY(("P(for-upstream:%s)\n", $2));
2961 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2962 			yyerror("expected yes or no.");
2963 		else cfg_parser->cfg->auths->for_upstream =
2964 			(strcmp($2, "yes")==0);
2965 		free($2);
2966 	}
2967 	;
2968 auth_fallback_enabled: VAR_FALLBACK_ENABLED STRING_ARG
2969 	{
2970 		OUTYY(("P(fallback-enabled:%s)\n", $2));
2971 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
2972 			yyerror("expected yes or no.");
2973 		else cfg_parser->cfg->auths->fallback_enabled =
2974 			(strcmp($2, "yes")==0);
2975 		free($2);
2976 	}
2977 	;
2978 view_name: VAR_NAME STRING_ARG
2979 	{
2980 		OUTYY(("P(name:%s)\n", $2));
2981 		if(cfg_parser->cfg->views->name)
2982 			yyerror("view name override, there must be one "
2983 				"name for one view");
2984 		free(cfg_parser->cfg->views->name);
2985 		cfg_parser->cfg->views->name = $2;
2986 	}
2987 	;
2988 view_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
2989 	{
2990 		OUTYY(("P(view_local_zone:%s %s)\n", $2, $3));
2991 		if(strcmp($3, "static")!=0 && strcmp($3, "deny")!=0 &&
2992 		   strcmp($3, "refuse")!=0 && strcmp($3, "redirect")!=0 &&
2993 		   strcmp($3, "transparent")!=0 && strcmp($3, "nodefault")!=0
2994 		   && strcmp($3, "typetransparent")!=0
2995 		   && strcmp($3, "always_transparent")!=0
2996 		   && strcmp($3, "always_refuse")!=0
2997 		   && strcmp($3, "always_nxdomain")!=0
2998 		   && strcmp($3, "always_nodata")!=0
2999 		   && strcmp($3, "always_deny")!=0
3000 		   && strcmp($3, "always_null")!=0
3001 		   && strcmp($3, "noview")!=0
3002 		   && strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0
3003 		   && strcmp($3, "inform_redirect") != 0
3004 		   && strcmp($3, "ipset") != 0) {
3005 			yyerror("local-zone type: expected static, deny, "
3006 				"refuse, redirect, transparent, "
3007 				"typetransparent, inform, inform_deny, "
3008 				"inform_redirect, always_transparent, "
3009 				"always_refuse, always_nxdomain, "
3010 				"always_nodata, always_deny, always_null, "
3011 				"noview, nodefault or ipset");
3012 			free($2);
3013 			free($3);
3014 		} else if(strcmp($3, "nodefault")==0) {
3015 			if(!cfg_strlist_insert(&cfg_parser->cfg->views->
3016 				local_zones_nodefault, $2))
3017 				fatal_exit("out of memory adding local-zone");
3018 			free($3);
3019 #ifdef USE_IPSET
3020 		} else if(strcmp($3, "ipset")==0) {
3021 			size_t len = strlen($2);
3022 			/* Make sure to add the trailing dot.
3023 			 * These are str compared to domain names. */
3024 			if($2[len-1] != '.') {
3025 				if(!($2 = realloc($2, len+2))) {
3026 					fatal_exit("out of memory adding local-zone");
3027 				}
3028 				$2[len] = '.';
3029 				$2[len+1] = 0;
3030 			}
3031 			if(!cfg_strlist_insert(&cfg_parser->cfg->views->
3032 				local_zones_ipset, $2))
3033 				fatal_exit("out of memory adding local-zone");
3034 			free($3);
3035 #endif
3036 		} else {
3037 			if(!cfg_str2list_insert(
3038 				&cfg_parser->cfg->views->local_zones,
3039 				$2, $3))
3040 				fatal_exit("out of memory adding local-zone");
3041 		}
3042 	}
3043 	;
3044 view_response_ip: VAR_RESPONSE_IP STRING_ARG STRING_ARG
3045 	{
3046 		OUTYY(("P(view_response_ip:%s %s)\n", $2, $3));
3047 		validate_respip_action($3);
3048 		if(!cfg_str2list_insert(
3049 			&cfg_parser->cfg->views->respip_actions, $2, $3))
3050 			fatal_exit("out of memory adding per-view "
3051 				"response-ip action");
3052 	}
3053 	;
3054 view_response_ip_data: VAR_RESPONSE_IP_DATA STRING_ARG STRING_ARG
3055 	{
3056 		OUTYY(("P(view_response_ip_data:%s)\n", $2));
3057 		if(!cfg_str2list_insert(
3058 			&cfg_parser->cfg->views->respip_data, $2, $3))
3059 			fatal_exit("out of memory adding response-ip-data");
3060 	}
3061 	;
3062 view_local_data: VAR_LOCAL_DATA STRING_ARG
3063 	{
3064 		OUTYY(("P(view_local_data:%s)\n", $2));
3065 		if(!cfg_strlist_insert(&cfg_parser->cfg->views->local_data, $2)) {
3066 			fatal_exit("out of memory adding local-data");
3067 		}
3068 	}
3069 	;
3070 view_local_data_ptr: VAR_LOCAL_DATA_PTR STRING_ARG
3071 	{
3072 		char* ptr;
3073 		OUTYY(("P(view_local_data_ptr:%s)\n", $2));
3074 		ptr = cfg_ptr_reverse($2);
3075 		free($2);
3076 		if(ptr) {
3077 			if(!cfg_strlist_insert(&cfg_parser->cfg->views->
3078 				local_data, ptr))
3079 				fatal_exit("out of memory adding local-data");
3080 		} else {
3081 			yyerror("local-data-ptr could not be reversed");
3082 		}
3083 	}
3084 	;
3085 view_first: VAR_VIEW_FIRST STRING_ARG
3086 	{
3087 		OUTYY(("P(view-first:%s)\n", $2));
3088 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3089 			yyerror("expected yes or no.");
3090 		else cfg_parser->cfg->views->isfirst=(strcmp($2, "yes")==0);
3091 		free($2);
3092 	}
3093 	;
3094 rcstart: VAR_REMOTE_CONTROL
3095 	{
3096 		OUTYY(("\nP(remote-control:)\n"));
3097 	}
3098 	;
3099 contents_rc: contents_rc content_rc
3100 	| ;
3101 content_rc: rc_control_enable | rc_control_interface | rc_control_port |
3102 	rc_server_key_file | rc_server_cert_file | rc_control_key_file |
3103 	rc_control_cert_file | rc_control_use_cert
3104 	;
3105 rc_control_enable: VAR_CONTROL_ENABLE STRING_ARG
3106 	{
3107 		OUTYY(("P(control_enable:%s)\n", $2));
3108 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3109 			yyerror("expected yes or no.");
3110 		else cfg_parser->cfg->remote_control_enable =
3111 			(strcmp($2, "yes")==0);
3112 		free($2);
3113 	}
3114 	;
3115 rc_control_port: VAR_CONTROL_PORT STRING_ARG
3116 	{
3117 		OUTYY(("P(control_port:%s)\n", $2));
3118 		if(atoi($2) == 0)
3119 			yyerror("control port number expected");
3120 		else cfg_parser->cfg->control_port = atoi($2);
3121 		free($2);
3122 	}
3123 	;
3124 rc_control_interface: VAR_CONTROL_INTERFACE STRING_ARG
3125 	{
3126 		OUTYY(("P(control_interface:%s)\n", $2));
3127 		if(!cfg_strlist_append(&cfg_parser->cfg->control_ifs, $2))
3128 			yyerror("out of memory");
3129 	}
3130 	;
3131 rc_control_use_cert: VAR_CONTROL_USE_CERT STRING_ARG
3132 	{
3133 		OUTYY(("P(control_use_cert:%s)\n", $2));
3134 		cfg_parser->cfg->control_use_cert = (strcmp($2, "yes")==0);
3135 		free($2);
3136 	}
3137 	;
3138 rc_server_key_file: VAR_SERVER_KEY_FILE STRING_ARG
3139 	{
3140 		OUTYY(("P(rc_server_key_file:%s)\n", $2));
3141 		free(cfg_parser->cfg->server_key_file);
3142 		cfg_parser->cfg->server_key_file = $2;
3143 	}
3144 	;
3145 rc_server_cert_file: VAR_SERVER_CERT_FILE STRING_ARG
3146 	{
3147 		OUTYY(("P(rc_server_cert_file:%s)\n", $2));
3148 		free(cfg_parser->cfg->server_cert_file);
3149 		cfg_parser->cfg->server_cert_file = $2;
3150 	}
3151 	;
3152 rc_control_key_file: VAR_CONTROL_KEY_FILE STRING_ARG
3153 	{
3154 		OUTYY(("P(rc_control_key_file:%s)\n", $2));
3155 		free(cfg_parser->cfg->control_key_file);
3156 		cfg_parser->cfg->control_key_file = $2;
3157 	}
3158 	;
3159 rc_control_cert_file: VAR_CONTROL_CERT_FILE STRING_ARG
3160 	{
3161 		OUTYY(("P(rc_control_cert_file:%s)\n", $2));
3162 		free(cfg_parser->cfg->control_cert_file);
3163 		cfg_parser->cfg->control_cert_file = $2;
3164 	}
3165 	;
3166 dtstart: VAR_DNSTAP
3167 	{
3168 		OUTYY(("\nP(dnstap:)\n"));
3169 	}
3170 	;
3171 contents_dt: contents_dt content_dt
3172 	| ;
3173 content_dt: dt_dnstap_enable | dt_dnstap_socket_path | dt_dnstap_bidirectional |
3174 	dt_dnstap_ip | dt_dnstap_tls | dt_dnstap_tls_server_name |
3175 	dt_dnstap_tls_cert_bundle |
3176 	dt_dnstap_tls_client_key_file | dt_dnstap_tls_client_cert_file |
3177 	dt_dnstap_send_identity | dt_dnstap_send_version |
3178 	dt_dnstap_identity | dt_dnstap_version |
3179 	dt_dnstap_log_resolver_query_messages |
3180 	dt_dnstap_log_resolver_response_messages |
3181 	dt_dnstap_log_client_query_messages |
3182 	dt_dnstap_log_client_response_messages |
3183 	dt_dnstap_log_forwarder_query_messages |
3184 	dt_dnstap_log_forwarder_response_messages
3185 	;
3186 dt_dnstap_enable: VAR_DNSTAP_ENABLE STRING_ARG
3187 	{
3188 		OUTYY(("P(dt_dnstap_enable:%s)\n", $2));
3189 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3190 			yyerror("expected yes or no.");
3191 		else cfg_parser->cfg->dnstap = (strcmp($2, "yes")==0);
3192 		free($2);
3193 	}
3194 	;
3195 dt_dnstap_bidirectional: VAR_DNSTAP_BIDIRECTIONAL STRING_ARG
3196 	{
3197 		OUTYY(("P(dt_dnstap_bidirectional:%s)\n", $2));
3198 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3199 			yyerror("expected yes or no.");
3200 		else cfg_parser->cfg->dnstap_bidirectional =
3201 			(strcmp($2, "yes")==0);
3202 		free($2);
3203 	}
3204 	;
3205 dt_dnstap_socket_path: VAR_DNSTAP_SOCKET_PATH STRING_ARG
3206 	{
3207 		OUTYY(("P(dt_dnstap_socket_path:%s)\n", $2));
3208 		free(cfg_parser->cfg->dnstap_socket_path);
3209 		cfg_parser->cfg->dnstap_socket_path = $2;
3210 	}
3211 	;
3212 dt_dnstap_ip: VAR_DNSTAP_IP STRING_ARG
3213 	{
3214 		OUTYY(("P(dt_dnstap_ip:%s)\n", $2));
3215 		free(cfg_parser->cfg->dnstap_ip);
3216 		cfg_parser->cfg->dnstap_ip = $2;
3217 	}
3218 	;
3219 dt_dnstap_tls: VAR_DNSTAP_TLS STRING_ARG
3220 	{
3221 		OUTYY(("P(dt_dnstap_tls:%s)\n", $2));
3222 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3223 			yyerror("expected yes or no.");
3224 		else cfg_parser->cfg->dnstap_tls = (strcmp($2, "yes")==0);
3225 		free($2);
3226 	}
3227 	;
3228 dt_dnstap_tls_server_name: VAR_DNSTAP_TLS_SERVER_NAME STRING_ARG
3229 	{
3230 		OUTYY(("P(dt_dnstap_tls_server_name:%s)\n", $2));
3231 		free(cfg_parser->cfg->dnstap_tls_server_name);
3232 		cfg_parser->cfg->dnstap_tls_server_name = $2;
3233 	}
3234 	;
3235 dt_dnstap_tls_cert_bundle: VAR_DNSTAP_TLS_CERT_BUNDLE STRING_ARG
3236 	{
3237 		OUTYY(("P(dt_dnstap_tls_cert_bundle:%s)\n", $2));
3238 		free(cfg_parser->cfg->dnstap_tls_cert_bundle);
3239 		cfg_parser->cfg->dnstap_tls_cert_bundle = $2;
3240 	}
3241 	;
3242 dt_dnstap_tls_client_key_file: VAR_DNSTAP_TLS_CLIENT_KEY_FILE STRING_ARG
3243 	{
3244 		OUTYY(("P(dt_dnstap_tls_client_key_file:%s)\n", $2));
3245 		free(cfg_parser->cfg->dnstap_tls_client_key_file);
3246 		cfg_parser->cfg->dnstap_tls_client_key_file = $2;
3247 	}
3248 	;
3249 dt_dnstap_tls_client_cert_file: VAR_DNSTAP_TLS_CLIENT_CERT_FILE STRING_ARG
3250 	{
3251 		OUTYY(("P(dt_dnstap_tls_client_cert_file:%s)\n", $2));
3252 		free(cfg_parser->cfg->dnstap_tls_client_cert_file);
3253 		cfg_parser->cfg->dnstap_tls_client_cert_file = $2;
3254 	}
3255 	;
3256 dt_dnstap_send_identity: VAR_DNSTAP_SEND_IDENTITY STRING_ARG
3257 	{
3258 		OUTYY(("P(dt_dnstap_send_identity:%s)\n", $2));
3259 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3260 			yyerror("expected yes or no.");
3261 		else cfg_parser->cfg->dnstap_send_identity = (strcmp($2, "yes")==0);
3262 		free($2);
3263 	}
3264 	;
3265 dt_dnstap_send_version: VAR_DNSTAP_SEND_VERSION STRING_ARG
3266 	{
3267 		OUTYY(("P(dt_dnstap_send_version:%s)\n", $2));
3268 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3269 			yyerror("expected yes or no.");
3270 		else cfg_parser->cfg->dnstap_send_version = (strcmp($2, "yes")==0);
3271 		free($2);
3272 	}
3273 	;
3274 dt_dnstap_identity: VAR_DNSTAP_IDENTITY STRING_ARG
3275 	{
3276 		OUTYY(("P(dt_dnstap_identity:%s)\n", $2));
3277 		free(cfg_parser->cfg->dnstap_identity);
3278 		cfg_parser->cfg->dnstap_identity = $2;
3279 	}
3280 	;
3281 dt_dnstap_version: VAR_DNSTAP_VERSION STRING_ARG
3282 	{
3283 		OUTYY(("P(dt_dnstap_version:%s)\n", $2));
3284 		free(cfg_parser->cfg->dnstap_version);
3285 		cfg_parser->cfg->dnstap_version = $2;
3286 	}
3287 	;
3288 dt_dnstap_log_resolver_query_messages: VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES STRING_ARG
3289 	{
3290 		OUTYY(("P(dt_dnstap_log_resolver_query_messages:%s)\n", $2));
3291 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3292 			yyerror("expected yes or no.");
3293 		else cfg_parser->cfg->dnstap_log_resolver_query_messages =
3294 			(strcmp($2, "yes")==0);
3295 		free($2);
3296 	}
3297 	;
3298 dt_dnstap_log_resolver_response_messages: VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES STRING_ARG
3299 	{
3300 		OUTYY(("P(dt_dnstap_log_resolver_response_messages:%s)\n", $2));
3301 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3302 			yyerror("expected yes or no.");
3303 		else cfg_parser->cfg->dnstap_log_resolver_response_messages =
3304 			(strcmp($2, "yes")==0);
3305 		free($2);
3306 	}
3307 	;
3308 dt_dnstap_log_client_query_messages: VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES STRING_ARG
3309 	{
3310 		OUTYY(("P(dt_dnstap_log_client_query_messages:%s)\n", $2));
3311 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3312 			yyerror("expected yes or no.");
3313 		else cfg_parser->cfg->dnstap_log_client_query_messages =
3314 			(strcmp($2, "yes")==0);
3315 		free($2);
3316 	}
3317 	;
3318 dt_dnstap_log_client_response_messages: VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES STRING_ARG
3319 	{
3320 		OUTYY(("P(dt_dnstap_log_client_response_messages:%s)\n", $2));
3321 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3322 			yyerror("expected yes or no.");
3323 		else cfg_parser->cfg->dnstap_log_client_response_messages =
3324 			(strcmp($2, "yes")==0);
3325 		free($2);
3326 	}
3327 	;
3328 dt_dnstap_log_forwarder_query_messages: VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES STRING_ARG
3329 	{
3330 		OUTYY(("P(dt_dnstap_log_forwarder_query_messages:%s)\n", $2));
3331 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3332 			yyerror("expected yes or no.");
3333 		else cfg_parser->cfg->dnstap_log_forwarder_query_messages =
3334 			(strcmp($2, "yes")==0);
3335 		free($2);
3336 	}
3337 	;
3338 dt_dnstap_log_forwarder_response_messages: VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES STRING_ARG
3339 	{
3340 		OUTYY(("P(dt_dnstap_log_forwarder_response_messages:%s)\n", $2));
3341 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3342 			yyerror("expected yes or no.");
3343 		else cfg_parser->cfg->dnstap_log_forwarder_response_messages =
3344 			(strcmp($2, "yes")==0);
3345 		free($2);
3346 	}
3347 	;
3348 pythonstart: VAR_PYTHON
3349 	{
3350 		OUTYY(("\nP(python:)\n"));
3351 	}
3352 	;
3353 contents_py: contents_py content_py
3354 	| ;
3355 content_py: py_script
3356 	;
3357 py_script: VAR_PYTHON_SCRIPT STRING_ARG
3358 	{
3359 		OUTYY(("P(python-script:%s)\n", $2));
3360 		if(!cfg_strlist_append_ex(&cfg_parser->cfg->python_script, $2))
3361 			yyerror("out of memory");
3362 	}
3363 dynlibstart: VAR_DYNLIB
3364 	{
3365 		OUTYY(("\nP(dynlib:)\n"));
3366 	}
3367 	;
3368 contents_dl: contents_dl content_dl
3369 	| ;
3370 content_dl: dl_file
3371 	;
3372 dl_file: VAR_DYNLIB_FILE STRING_ARG
3373 	{
3374 		OUTYY(("P(dynlib-file:%s)\n", $2));
3375 		if(!cfg_strlist_append_ex(&cfg_parser->cfg->dynlib_file, $2))
3376 			yyerror("out of memory");
3377 	}
3378 server_disable_dnssec_lame_check: VAR_DISABLE_DNSSEC_LAME_CHECK STRING_ARG
3379 	{
3380 		OUTYY(("P(disable_dnssec_lame_check:%s)\n", $2));
3381 		if (strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3382 			yyerror("expected yes or no.");
3383 		else cfg_parser->cfg->disable_dnssec_lame_check =
3384 			(strcmp($2, "yes")==0);
3385 		free($2);
3386 	}
3387 	;
3388 server_log_identity: VAR_LOG_IDENTITY STRING_ARG
3389 	{
3390 		OUTYY(("P(server_log_identity:%s)\n", $2));
3391 		free(cfg_parser->cfg->log_identity);
3392 		cfg_parser->cfg->log_identity = $2;
3393 	}
3394 	;
3395 server_response_ip: VAR_RESPONSE_IP STRING_ARG STRING_ARG
3396 	{
3397 		OUTYY(("P(server_response_ip:%s %s)\n", $2, $3));
3398 		validate_respip_action($3);
3399 		if(!cfg_str2list_insert(&cfg_parser->cfg->respip_actions,
3400 			$2, $3))
3401 			fatal_exit("out of memory adding response-ip");
3402 	}
3403 	;
3404 server_response_ip_data: VAR_RESPONSE_IP_DATA STRING_ARG STRING_ARG
3405 	{
3406 		OUTYY(("P(server_response_ip_data:%s)\n", $2));
3407 		if(!cfg_str2list_insert(&cfg_parser->cfg->respip_data,
3408 			$2, $3))
3409 			fatal_exit("out of memory adding response-ip-data");
3410 	}
3411 	;
3412 dnscstart: VAR_DNSCRYPT
3413 	{
3414 		OUTYY(("\nP(dnscrypt:)\n"));
3415 	}
3416 	;
3417 contents_dnsc: contents_dnsc content_dnsc
3418 	| ;
3419 content_dnsc:
3420 	dnsc_dnscrypt_enable | dnsc_dnscrypt_port | dnsc_dnscrypt_provider |
3421 	dnsc_dnscrypt_secret_key | dnsc_dnscrypt_provider_cert |
3422 	dnsc_dnscrypt_provider_cert_rotated |
3423 	dnsc_dnscrypt_shared_secret_cache_size |
3424 	dnsc_dnscrypt_shared_secret_cache_slabs |
3425 	dnsc_dnscrypt_nonce_cache_size |
3426 	dnsc_dnscrypt_nonce_cache_slabs
3427 	;
3428 dnsc_dnscrypt_enable: VAR_DNSCRYPT_ENABLE STRING_ARG
3429 	{
3430 		OUTYY(("P(dnsc_dnscrypt_enable:%s)\n", $2));
3431 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3432 			yyerror("expected yes or no.");
3433 		else cfg_parser->cfg->dnscrypt = (strcmp($2, "yes")==0);
3434 		free($2);
3435 	}
3436 	;
3437 
3438 dnsc_dnscrypt_port: VAR_DNSCRYPT_PORT STRING_ARG
3439 	{
3440 		OUTYY(("P(dnsc_dnscrypt_port:%s)\n", $2));
3441 		if(atoi($2) == 0)
3442 			yyerror("port number expected");
3443 		else cfg_parser->cfg->dnscrypt_port = atoi($2);
3444 		free($2);
3445 	}
3446 	;
3447 dnsc_dnscrypt_provider: VAR_DNSCRYPT_PROVIDER STRING_ARG
3448 	{
3449 		OUTYY(("P(dnsc_dnscrypt_provider:%s)\n", $2));
3450 		free(cfg_parser->cfg->dnscrypt_provider);
3451 		cfg_parser->cfg->dnscrypt_provider = $2;
3452 	}
3453 	;
3454 dnsc_dnscrypt_provider_cert: VAR_DNSCRYPT_PROVIDER_CERT STRING_ARG
3455 	{
3456 		OUTYY(("P(dnsc_dnscrypt_provider_cert:%s)\n", $2));
3457 		if(cfg_strlist_find(cfg_parser->cfg->dnscrypt_provider_cert, $2))
3458 			log_warn("dnscrypt-provider-cert %s is a duplicate", $2);
3459 		if(!cfg_strlist_insert(&cfg_parser->cfg->dnscrypt_provider_cert, $2))
3460 			fatal_exit("out of memory adding dnscrypt-provider-cert");
3461 	}
3462 	;
3463 dnsc_dnscrypt_provider_cert_rotated: VAR_DNSCRYPT_PROVIDER_CERT_ROTATED STRING_ARG
3464 	{
3465 		OUTYY(("P(dnsc_dnscrypt_provider_cert_rotated:%s)\n", $2));
3466 		if(!cfg_strlist_insert(&cfg_parser->cfg->dnscrypt_provider_cert_rotated, $2))
3467 			fatal_exit("out of memory adding dnscrypt-provider-cert-rotated");
3468 	}
3469 	;
3470 dnsc_dnscrypt_secret_key: VAR_DNSCRYPT_SECRET_KEY STRING_ARG
3471 	{
3472 		OUTYY(("P(dnsc_dnscrypt_secret_key:%s)\n", $2));
3473 		if(cfg_strlist_find(cfg_parser->cfg->dnscrypt_secret_key, $2))
3474 			log_warn("dnscrypt-secret-key: %s is a duplicate", $2);
3475 		if(!cfg_strlist_insert(&cfg_parser->cfg->dnscrypt_secret_key, $2))
3476 			fatal_exit("out of memory adding dnscrypt-secret-key");
3477 	}
3478 	;
3479 dnsc_dnscrypt_shared_secret_cache_size: VAR_DNSCRYPT_SHARED_SECRET_CACHE_SIZE STRING_ARG
3480   {
3481 	OUTYY(("P(dnscrypt_shared_secret_cache_size:%s)\n", $2));
3482 	if(!cfg_parse_memsize($2, &cfg_parser->cfg->dnscrypt_shared_secret_cache_size))
3483 		yyerror("memory size expected");
3484 	free($2);
3485   }
3486   ;
3487 dnsc_dnscrypt_shared_secret_cache_slabs: VAR_DNSCRYPT_SHARED_SECRET_CACHE_SLABS STRING_ARG
3488   {
3489 	OUTYY(("P(dnscrypt_shared_secret_cache_slabs:%s)\n", $2));
3490 	if(atoi($2) == 0) {
3491 		yyerror("number expected");
3492 	} else {
3493 		cfg_parser->cfg->dnscrypt_shared_secret_cache_slabs = atoi($2);
3494 		if(!is_pow2(cfg_parser->cfg->dnscrypt_shared_secret_cache_slabs))
3495 			yyerror("must be a power of 2");
3496 	}
3497 	free($2);
3498   }
3499   ;
3500 dnsc_dnscrypt_nonce_cache_size: VAR_DNSCRYPT_NONCE_CACHE_SIZE STRING_ARG
3501   {
3502 	OUTYY(("P(dnscrypt_nonce_cache_size:%s)\n", $2));
3503 	if(!cfg_parse_memsize($2, &cfg_parser->cfg->dnscrypt_nonce_cache_size))
3504 		yyerror("memory size expected");
3505 	free($2);
3506   }
3507   ;
3508 dnsc_dnscrypt_nonce_cache_slabs: VAR_DNSCRYPT_NONCE_CACHE_SLABS STRING_ARG
3509   {
3510 	OUTYY(("P(dnscrypt_nonce_cache_slabs:%s)\n", $2));
3511 	if(atoi($2) == 0) {
3512 		yyerror("number expected");
3513 	} else {
3514 		cfg_parser->cfg->dnscrypt_nonce_cache_slabs = atoi($2);
3515 		if(!is_pow2(cfg_parser->cfg->dnscrypt_nonce_cache_slabs))
3516 			yyerror("must be a power of 2");
3517 	}
3518 	free($2);
3519   }
3520   ;
3521 cachedbstart: VAR_CACHEDB
3522 	{
3523 		OUTYY(("\nP(cachedb:)\n"));
3524 	}
3525 	;
3526 contents_cachedb: contents_cachedb content_cachedb
3527 	| ;
3528 content_cachedb: cachedb_backend_name | cachedb_secret_seed |
3529 	redis_server_host | redis_server_port | redis_timeout |
3530 	redis_expire_records
3531 	;
3532 cachedb_backend_name: VAR_CACHEDB_BACKEND STRING_ARG
3533 	{
3534 	#ifdef USE_CACHEDB
3535 		OUTYY(("P(backend:%s)\n", $2));
3536 		free(cfg_parser->cfg->cachedb_backend);
3537 		cfg_parser->cfg->cachedb_backend = $2;
3538 	#else
3539 		OUTYY(("P(Compiled without cachedb, ignoring)\n"));
3540 		free($2);
3541 	#endif
3542 	}
3543 	;
3544 cachedb_secret_seed: VAR_CACHEDB_SECRETSEED STRING_ARG
3545 	{
3546 	#ifdef USE_CACHEDB
3547 		OUTYY(("P(secret-seed:%s)\n", $2));
3548 		free(cfg_parser->cfg->cachedb_secret);
3549 		cfg_parser->cfg->cachedb_secret = $2;
3550 	#else
3551 		OUTYY(("P(Compiled without cachedb, ignoring)\n"));
3552 		free($2);
3553 	#endif
3554 	}
3555 	;
3556 redis_server_host: VAR_CACHEDB_REDISHOST STRING_ARG
3557 	{
3558 	#if defined(USE_CACHEDB) && defined(USE_REDIS)
3559 		OUTYY(("P(redis_server_host:%s)\n", $2));
3560 		free(cfg_parser->cfg->redis_server_host);
3561 		cfg_parser->cfg->redis_server_host = $2;
3562 	#else
3563 		OUTYY(("P(Compiled without cachedb or redis, ignoring)\n"));
3564 		free($2);
3565 	#endif
3566 	}
3567 	;
3568 redis_server_port: VAR_CACHEDB_REDISPORT STRING_ARG
3569 	{
3570 	#if defined(USE_CACHEDB) && defined(USE_REDIS)
3571 		int port;
3572 		OUTYY(("P(redis_server_port:%s)\n", $2));
3573 		port = atoi($2);
3574 		if(port == 0 || port < 0 || port > 65535)
3575 			yyerror("valid redis server port number expected");
3576 		else cfg_parser->cfg->redis_server_port = port;
3577 	#else
3578 		OUTYY(("P(Compiled without cachedb or redis, ignoring)\n"));
3579 	#endif
3580 		free($2);
3581 	}
3582 	;
3583 redis_timeout: VAR_CACHEDB_REDISTIMEOUT STRING_ARG
3584 	{
3585 	#if defined(USE_CACHEDB) && defined(USE_REDIS)
3586 		OUTYY(("P(redis_timeout:%s)\n", $2));
3587 		if(atoi($2) == 0)
3588 			yyerror("redis timeout value expected");
3589 		else cfg_parser->cfg->redis_timeout = atoi($2);
3590 	#else
3591 		OUTYY(("P(Compiled without cachedb or redis, ignoring)\n"));
3592 	#endif
3593 		free($2);
3594 	}
3595 	;
3596 redis_expire_records: VAR_CACHEDB_REDISEXPIRERECORDS STRING_ARG
3597 	{
3598 	#if defined(USE_CACHEDB) && defined(USE_REDIS)
3599 		OUTYY(("P(redis_expire_records:%s)\n", $2));
3600 		if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
3601 			yyerror("expected yes or no.");
3602 		else cfg_parser->cfg->redis_expire_records = (strcmp($2, "yes")==0);
3603 	#else
3604 		OUTYY(("P(Compiled without cachedb or redis, ignoring)\n"));
3605 	#endif
3606 		free($2);
3607 	}
3608 	;
3609 server_tcp_connection_limit: VAR_TCP_CONNECTION_LIMIT STRING_ARG STRING_ARG
3610 	{
3611 		OUTYY(("P(server_tcp_connection_limit:%s %s)\n", $2, $3));
3612 		if (atoi($3) < 0)
3613 			yyerror("positive number expected");
3614 		else {
3615 			if(!cfg_str2list_insert(&cfg_parser->cfg->tcp_connection_limits, $2, $3))
3616 				fatal_exit("out of memory adding tcp connection limit");
3617 		}
3618 	}
3619 	;
3620 	ipsetstart: VAR_IPSET
3621 		{
3622 			OUTYY(("\nP(ipset:)\n"));
3623 		}
3624 		;
3625 	contents_ipset: contents_ipset content_ipset
3626 		| ;
3627 	content_ipset: ipset_name_v4 | ipset_name_v6
3628 		;
3629 	ipset_name_v4: VAR_IPSET_NAME_V4 STRING_ARG
3630 		{
3631 		#ifdef USE_IPSET
3632 			OUTYY(("P(name-v4:%s)\n", $2));
3633 			if(cfg_parser->cfg->ipset_name_v4)
3634 				yyerror("ipset name v4 override, there must be one "
3635 					"name for ip v4");
3636 			free(cfg_parser->cfg->ipset_name_v4);
3637 			cfg_parser->cfg->ipset_name_v4 = $2;
3638 		#else
3639 			OUTYY(("P(Compiled without ipset, ignoring)\n"));
3640 			free($2);
3641 		#endif
3642 		}
3643 	;
3644 	ipset_name_v6: VAR_IPSET_NAME_V6 STRING_ARG
3645 	{
3646 		#ifdef USE_IPSET
3647 			OUTYY(("P(name-v6:%s)\n", $2));
3648 			if(cfg_parser->cfg->ipset_name_v6)
3649 				yyerror("ipset name v6 override, there must be one "
3650 					"name for ip v6");
3651 			free(cfg_parser->cfg->ipset_name_v6);
3652 			cfg_parser->cfg->ipset_name_v6 = $2;
3653 		#else
3654 			OUTYY(("P(Compiled without ipset, ignoring)\n"));
3655 			free($2);
3656 		#endif
3657 		}
3658 	;
3659 %%
3660 
3661 /* parse helper routines could be here */
3662 static void
3663 validate_respip_action(const char* action)
3664 {
3665 	if(strcmp(action, "deny")!=0 &&
3666 		strcmp(action, "redirect")!=0 &&
3667 		strcmp(action, "inform")!=0 &&
3668 		strcmp(action, "inform_deny")!=0 &&
3669 		strcmp(action, "always_transparent")!=0 &&
3670 		strcmp(action, "always_refuse")!=0 &&
3671 		strcmp(action, "always_nxdomain")!=0)
3672 	{
3673 		yyerror("response-ip action: expected deny, redirect, "
3674 			"inform, inform_deny, always_transparent, "
3675 			"always_refuse or always_nxdomain");
3676 	}
3677 }
3678 
3679 
3680