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