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