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