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