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