xref: /freebsd/contrib/unbound/util/config_file.h (revision 1f1e2261e341e6ca6862f82261066ef1705f0a7a)
1 /*
2  * util/config_file.h - reads and stores the config file for unbound.
3  *
4  * Copyright (c) 2007, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 /**
37  * \file
38  *
39  * This file contains functions for the config file.
40  */
41 
42 #ifndef UTIL_CONFIG_FILE_H
43 #define UTIL_CONFIG_FILE_H
44 #include "sldns/rrdef.h"
45 struct config_stub;
46 struct config_auth;
47 struct config_view;
48 struct config_strlist;
49 struct config_str2list;
50 struct config_str3list;
51 struct config_strbytelist;
52 struct module_qstate;
53 struct sock_list;
54 struct ub_packed_rrset_key;
55 struct regional;
56 
57 /** List head for strlist processing, used for append operation. */
58 struct config_strlist_head {
59 	/** first in list of text items */
60 	struct config_strlist* first;
61 	/** last in list of text items */
62 	struct config_strlist* last;
63 };
64 
65 /**
66  * The configuration options.
67  * Strings are malloced.
68  */
69 struct config_file {
70 	/** verbosity level as specified in the config file */
71 	int verbosity;
72 
73 	/** statistics interval (in seconds) */
74 	int stat_interval;
75 	/** if false, statistics values are reset after printing them */
76 	int stat_cumulative;
77 	/** if true, the statistics are kept in greater detail */
78 	int stat_extended;
79 
80 	/** number of threads to create */
81 	int num_threads;
82 
83 	/** port on which queries are answered. */
84 	int port;
85 	/** do ip4 query support. */
86 	int do_ip4;
87 	/** do ip6 query support. */
88 	int do_ip6;
89 	/** prefer ip4 upstream queries. */
90 	int prefer_ip4;
91 	/** prefer ip6 upstream queries. */
92 	int prefer_ip6;
93 	/** do udp query support. */
94 	int do_udp;
95 	/** do tcp query support. */
96 	int do_tcp;
97 	/** max number of queries on a reuse connection. */
98 	size_t max_reuse_tcp_queries;
99 	/** timeout for REUSE entries in milliseconds. */
100 	int tcp_reuse_timeout;
101 	/** timeout in milliseconds for TCP queries to auth servers. */
102 	int tcp_auth_query_timeout;
103 	/** tcp upstream queries (no UDP upstream queries) */
104 	int tcp_upstream;
105 	/** udp upstream enabled when no UDP downstream is enabled (do_udp no)*/
106 	int udp_upstream_without_downstream;
107 	/** maximum segment size of tcp socket which queries are answered */
108 	int tcp_mss;
109 	/** maximum segment size of tcp socket for outgoing queries */
110 	int outgoing_tcp_mss;
111 	/** tcp idle timeout, in msec */
112 	int tcp_idle_timeout;
113 	/** do edns tcp keepalive */
114 	int do_tcp_keepalive;
115 	/** tcp keepalive timeout, in msec */
116 	int tcp_keepalive_timeout;
117 
118 	/** private key file for dnstcp-ssl service (enabled if not NULL) */
119 	char* ssl_service_key;
120 	/** public key file for dnstcp-ssl service */
121 	char* ssl_service_pem;
122 	/** port on which to provide ssl service */
123 	int ssl_port;
124 	/** if outgoing tcp connections use SSL */
125 	int ssl_upstream;
126 	/** cert bundle for outgoing connections */
127 	char* tls_cert_bundle;
128 	/** should the system certificate store get added to the cert bundle */
129 	int tls_win_cert;
130 	/** additional tls ports */
131 	struct config_strlist* tls_additional_port;
132 	/** secret key used to encrypt and decrypt TLS session ticket */
133 	struct config_strlist_head tls_session_ticket_keys;
134 	/** TLS ciphers */
135 	char* tls_ciphers;
136 	/** TLS chiphersuites (TLSv1.3) */
137 	char* tls_ciphersuites;
138 	/** if SNI is to be used */
139 	int tls_use_sni;
140 
141 	/** port on which to provide DNS over HTTPS service */
142 	int https_port;
143 	/** endpoint for HTTP service */
144 	char* http_endpoint;
145 	/** MAX_CONCURRENT_STREAMS HTTP/2 setting */
146 	uint32_t http_max_streams;
147 	/** maximum size of all HTTP2 query buffers combined. */
148 	size_t http_query_buffer_size;
149 	/** maximum size of all HTTP2 response buffers combined. */
150 	size_t http_response_buffer_size;
151 	/** set TCP_NODELAY option for http sockets */
152 	int http_nodelay;
153 	/** Disable TLS for http sockets downstream */
154 	int http_notls_downstream;
155 
156 	/** outgoing port range number of ports (per thread) */
157 	int outgoing_num_ports;
158 	/** number of outgoing tcp buffers per (per thread) */
159 	size_t outgoing_num_tcp;
160 	/** number of incoming tcp buffers per (per thread) */
161 	size_t incoming_num_tcp;
162 	/** allowed udp port numbers, array with 0 if not allowed */
163 	int* outgoing_avail_ports;
164 
165 	/** EDNS buffer size to use */
166 	size_t edns_buffer_size;
167 	/** size of the stream wait buffers, max */
168 	size_t stream_wait_size;
169 	/** number of bytes buffer size for DNS messages */
170 	size_t msg_buffer_size;
171 	/** size of the message cache */
172 	size_t msg_cache_size;
173 	/** slabs in the message cache. */
174 	size_t msg_cache_slabs;
175 	/** number of queries every thread can service */
176 	size_t num_queries_per_thread;
177 	/** number of msec to wait before items can be jostled out */
178 	size_t jostle_time;
179 	/** size of the rrset cache */
180 	size_t rrset_cache_size;
181 	/** slabs in the rrset cache */
182 	size_t rrset_cache_slabs;
183 	/** host cache ttl in seconds */
184 	int host_ttl;
185 	/** number of slabs in the infra host cache */
186 	size_t infra_cache_slabs;
187 	/** max number of hosts in the infra cache */
188 	size_t infra_cache_numhosts;
189 	/** min value for infra cache rtt */
190 	int infra_cache_min_rtt;
191 	/** keep probing hosts that are down */
192 	int infra_keep_probing;
193 	/** delay close of udp-timeouted ports, if 0 no delayclose. in msec */
194 	int delay_close;
195 	/** udp_connect enable uses UDP connect to mitigate ICMP side channel */
196 	int udp_connect;
197 
198 	/** the target fetch policy for the iterator */
199 	char* target_fetch_policy;
200 	/** percent*10, how many times in 1000 to pick from the fastest
201 	 * destinations */
202 	int fast_server_permil;
203 	/** number of fastest server to select from */
204 	size_t fast_server_num;
205 
206 	/** automatic interface for incoming messages. Uses ipv6 remapping,
207 	 * and recvmsg/sendmsg ancillary data to detect interfaces, boolean */
208 	int if_automatic;
209 	/** extra ports to open if if_automatic enabled, or NULL for default */
210 	char* if_automatic_ports;
211 	/** SO_RCVBUF size to set on port 53 UDP socket */
212 	size_t so_rcvbuf;
213 	/** SO_SNDBUF size to set on port 53 UDP socket */
214 	size_t so_sndbuf;
215 	/** SO_REUSEPORT requested on port 53 sockets */
216 	int so_reuseport;
217 	/** IP_TRANSPARENT socket option requested on port 53 sockets */
218 	int ip_transparent;
219 	/** IP_FREEBIND socket option request on port 53 sockets */
220 	int ip_freebind;
221 	/** IP_TOS socket option requested on port 53 sockets */
222 	int ip_dscp;
223 
224 	/** number of interfaces to open. If 0 default all interfaces. */
225 	int num_ifs;
226 	/** interface description strings (IP addresses) */
227 	char **ifs;
228 
229 	/** number of outgoing interfaces to open.
230 	 * If 0 default all interfaces. */
231 	int num_out_ifs;
232 	/** outgoing interface description strings (IP addresses) */
233 	char **out_ifs;
234 
235 	/** the root hints */
236 	struct config_strlist* root_hints;
237 	/** the stub definitions, linked list */
238 	struct config_stub* stubs;
239 	/** the forward zone definitions, linked list */
240 	struct config_stub* forwards;
241 	/** the auth zone definitions, linked list */
242 	struct config_auth* auths;
243 	/** the views definitions, linked list */
244 	struct config_view* views;
245 	/** list of donotquery addresses, linked list */
246 	struct config_strlist* donotqueryaddrs;
247 #ifdef CLIENT_SUBNET
248 	/** list of servers we send edns-client-subnet option to and
249 	 * accept option from, linked list */
250 	struct config_strlist* client_subnet;
251 	/** list of zones we send edns-client-subnet option for */
252 	struct config_strlist* client_subnet_zone;
253 	/** opcode assigned by IANA for edns0-client-subnet option */
254 	uint16_t client_subnet_opcode;
255 	/** Do not check whitelist if incoming query contains an ECS record */
256 	int client_subnet_always_forward;
257 	/** Subnet length we are willing to give up privacy for */
258 	uint8_t max_client_subnet_ipv4;
259 	uint8_t max_client_subnet_ipv6;
260 	/** Minimum subnet length we are willing to answer */
261 	uint8_t min_client_subnet_ipv4;
262 	uint8_t min_client_subnet_ipv6;
263 	/** Max number of nodes in the ECS radix tree */
264 	uint32_t max_ecs_tree_size_ipv4;
265 	uint32_t max_ecs_tree_size_ipv6;
266 #endif
267 	/** list of access control entries, linked list */
268 	struct config_str2list* acls;
269 	/** use default localhost donotqueryaddr entries */
270 	int donotquery_localhost;
271 
272 	/** list of tcp connection limitss, linked list */
273 	struct config_str2list* tcp_connection_limits;
274 
275 	/** harden against very small edns buffer sizes */
276 	int harden_short_bufsize;
277 	/** harden against very large query sizes */
278 	int harden_large_queries;
279 	/** harden against spoofed glue (out of zone data) */
280 	int harden_glue;
281 	/** harden against receiving no DNSSEC data for trust anchor */
282 	int harden_dnssec_stripped;
283 	/** harden against queries that fall under known nxdomain names */
284 	int harden_below_nxdomain;
285 	/** harden the referral path, query for NS,A,AAAA and validate */
286 	int harden_referral_path;
287 	/** harden against algorithm downgrade */
288 	int harden_algo_downgrade;
289 	/** use 0x20 bits in query as random ID bits */
290 	int use_caps_bits_for_id;
291 	/** 0x20 whitelist, domains that do not use capsforid */
292 	struct config_strlist* caps_whitelist;
293 	/** strip away these private addrs from answers, no DNS Rebinding */
294 	struct config_strlist* private_address;
295 	/** allow domain (and subdomains) to use private address space */
296 	struct config_strlist* private_domain;
297 	/** what threshold for unwanted action. */
298 	size_t unwanted_threshold;
299 	/** the number of seconds maximal TTL used for RRsets and messages */
300 	int max_ttl;
301 	/** the number of seconds minimum TTL used for RRsets and messages */
302 	int min_ttl;
303 	/** the number of seconds maximal negative TTL for SOA in auth */
304 	int max_negative_ttl;
305 	/** if prefetching of messages should be performed. */
306 	int prefetch;
307 	/** if prefetching of DNSKEYs should be performed. */
308 	int prefetch_key;
309 	/** deny queries of type ANY with an empty answer */
310 	int deny_any;
311 
312 	/** chrootdir, if not "" or chroot will be done */
313 	char* chrootdir;
314 	/** username to change to, if not "". */
315 	char* username;
316 	/** working directory */
317 	char* directory;
318 	/** filename to log to. */
319 	char* logfile;
320 	/** pidfile to write pid to. */
321 	char* pidfile;
322 
323 	/** should log messages be sent to syslogd */
324 	int use_syslog;
325 	/** log timestamp in ascii UTC */
326 	int log_time_ascii;
327 	/** log queries with one line per query */
328 	int log_queries;
329 	/** log replies with one line per reply */
330 	int log_replies;
331 	/** tag log_queries and log_replies for filtering */
332 	int log_tag_queryreply;
333 	/** log every local-zone hit **/
334 	int log_local_actions;
335 	/** log servfails with a reason */
336 	int log_servfail;
337 	/** log identity to report */
338 	char* log_identity;
339 
340 	/** do not report identity (id.server, hostname.bind) */
341 	int hide_identity;
342 	/** do not report version (version.server, version.bind) */
343 	int hide_version;
344 	/** do not report trustanchor (trustanchor.unbound) */
345 	int hide_trustanchor;
346 	/** do not report the User-Agent HTTP header */
347 	int hide_http_user_agent;
348 	/** identity, hostname is returned if "". */
349 	char* identity;
350 	/** version, package version returned if "". */
351 	char* version;
352 	/** User-Agent for HTTP header */
353 	char* http_user_agent;
354 	/** nsid */
355 	char *nsid_cfg_str;
356 	uint8_t *nsid;
357 	uint16_t nsid_len;
358 
359 	/** the module configuration string */
360 	char* module_conf;
361 
362 	/** files with trusted DS and DNSKEYs in zonefile format, list */
363 	struct config_strlist* trust_anchor_file_list;
364 	/** list of trustanchor keys, linked list */
365 	struct config_strlist* trust_anchor_list;
366 	/** files with 5011 autotrust tracked keys */
367 	struct config_strlist* auto_trust_anchor_file_list;
368 	/** files with trusted DNSKEYs in named.conf format, list */
369 	struct config_strlist* trusted_keys_file_list;
370 	/** insecure domain list */
371 	struct config_strlist* domain_insecure;
372 	/** send key tag query */
373 	int trust_anchor_signaling;
374 	/** enable root key sentinel */
375 	int root_key_sentinel;
376 
377 	/** if not 0, this value is the validation date for RRSIGs */
378 	int32_t val_date_override;
379 	/** the minimum for signature clock skew */
380 	int32_t val_sig_skew_min;
381 	/** the maximum for signature clock skew */
382 	int32_t val_sig_skew_max;
383 	/** max number of query restarts, number of IPs to probe */
384 	int32_t val_max_restart;
385 	/** this value sets the number of seconds before revalidating bogus */
386 	int bogus_ttl;
387 	/** should validator clean additional section for secure msgs */
388 	int val_clean_additional;
389 	/** log bogus messages by the validator */
390 	int val_log_level;
391 	/** squelch val_log_level to log - this is library goes to callback */
392 	int val_log_squelch;
393 	/** should validator allow bogus messages to go through */
394 	int val_permissive_mode;
395 	/** use cached NSEC records to synthesise (negative) answers */
396 	int aggressive_nsec;
397 	/** ignore the CD flag in incoming queries and refuse them bogus data */
398 	int ignore_cd;
399 	/** serve expired entries and prefetch them */
400 	int serve_expired;
401 	/** serve expired entries until TTL after expiration */
402 	int serve_expired_ttl;
403 	/** reset serve expired TTL after failed update attempt */
404 	int serve_expired_ttl_reset;
405 	/** TTL for the serve expired replies */
406 	int serve_expired_reply_ttl;
407 	/** serve expired entries only after trying to update the entries and this
408 	 *  timeout (in milliseconds) is reached */
409 	int serve_expired_client_timeout;
410 	/** serve EDE code 3 - Stale Answer (RFC8914) for expired entries */
411 	int ede_serve_expired;
412 	/** serve original TTLs rather than decrementing ones */
413 	int serve_original_ttl;
414 	/** nsec3 maximum iterations per key size, string */
415 	char* val_nsec3_key_iterations;
416 	/** if zonemd failures are permitted, only logged */
417 	int zonemd_permissive_mode;
418 	/** autotrust add holddown time, in seconds */
419 	unsigned int add_holddown;
420 	/** autotrust del holddown time, in seconds */
421 	unsigned int del_holddown;
422 	/** autotrust keep_missing time, in seconds. 0 is forever. */
423 	unsigned int keep_missing;
424 	/** permit small holddown values, allowing 5011 rollover very fast */
425 	int permit_small_holddown;
426 
427 	/** size of the key cache */
428 	size_t key_cache_size;
429 	/** slabs in the key cache. */
430 	size_t key_cache_slabs;
431 	/** size of the neg cache */
432 	size_t neg_cache_size;
433 
434 	/** local zones config */
435 	struct config_str2list* local_zones;
436 	/** local zones nodefault list */
437 	struct config_strlist* local_zones_nodefault;
438 #ifdef USE_IPSET
439 	/** local zones ipset list */
440 	struct config_strlist* local_zones_ipset;
441 #endif
442 	/** do not add any default local zone */
443 	int local_zones_disable_default;
444 	/** local data RRs configured */
445 	struct config_strlist* local_data;
446 	/** local zone override types per netblock */
447 	struct config_str3list* local_zone_overrides;
448 	/** unblock lan zones (reverse lookups for AS112 zones) */
449 	int unblock_lan_zones;
450 	/** insecure lan zones (don't validate AS112 zones) */
451 	int insecure_lan_zones;
452 	/** list of zonename, tagbitlist */
453 	struct config_strbytelist* local_zone_tags;
454 	/** list of aclname, tagbitlist */
455 	struct config_strbytelist* acl_tags;
456 	/** list of aclname, tagname, localzonetype */
457 	struct config_str3list* acl_tag_actions;
458 	/** list of aclname, tagname, redirectdata */
459 	struct config_str3list* acl_tag_datas;
460 	/** list of aclname, view*/
461 	struct config_str2list* acl_view;
462 	/** list of IP-netblock, tagbitlist */
463 	struct config_strbytelist* respip_tags;
464 	/** list of response-driven access control entries, linked list */
465 	struct config_str2list* respip_actions;
466 	/** RRs configured for response-driven access controls */
467 	struct config_str2list* respip_data;
468 	/** tag list, array with tagname[i] is malloced string */
469 	char** tagname;
470 	/** number of items in the taglist */
471 	int num_tags;
472 
473 	/** remote control section. enable toggle. */
474 	int remote_control_enable;
475 	/** the interfaces the remote control should listen on */
476 	struct config_strlist_head control_ifs;
477 	/** if the use-cert option is set */
478 	int control_use_cert;
479 	/** port number for the control port */
480 	int control_port;
481 	/** private key file for server */
482 	char* server_key_file;
483 	/** certificate file for server */
484 	char* server_cert_file;
485 	/** private key file for unbound-control */
486 	char* control_key_file;
487 	/** certificate file for unbound-control */
488 	char* control_cert_file;
489 
490 	/** Python script file */
491 	struct config_strlist* python_script;
492 
493 	/** Dynamic library file */
494 	struct config_strlist* dynlib_file;
495 
496 	/** Use systemd socket activation. */
497 	int use_systemd;
498 
499 	/** daemonize, i.e. fork into the background. */
500 	int do_daemonize;
501 
502 	/* minimal response when positive answer */
503 	int minimal_responses;
504 
505 	/* RRSet roundrobin */
506 	int rrset_roundrobin;
507 
508 	/* wait time for unknown server in msec */
509 	int unknown_server_time_limit;
510 
511 	/* maximum UDP response size */
512 	size_t max_udp_size;
513 
514 	/* DNS64 prefix */
515 	char* dns64_prefix;
516 
517 	/* Synthetize all AAAA record despite the presence of an authoritative one */
518 	int dns64_synthall;
519 	/** ignore AAAAs for these domain names and use A record anyway */
520 	struct config_strlist* dns64_ignore_aaaa;
521 
522 	/** true to enable dnstap support */
523 	int dnstap;
524 	/** using bidirectional frame streams if true */
525 	int dnstap_bidirectional;
526 	/** dnstap socket path */
527 	char* dnstap_socket_path;
528 	/** dnstap IP */
529 	char* dnstap_ip;
530 	/** dnstap TLS enable */
531 	int dnstap_tls;
532 	/** dnstap tls server authentication name */
533 	char* dnstap_tls_server_name;
534 	/** dnstap server cert bundle */
535 	char* dnstap_tls_cert_bundle;
536 	/** dnstap client key for client authentication */
537 	char* dnstap_tls_client_key_file;
538 	/** dnstap client cert for client authentication */
539 	char* dnstap_tls_client_cert_file;
540 	/** true to send "identity" via dnstap */
541 	int dnstap_send_identity;
542 	/** true to send "version" via dnstap */
543 	int dnstap_send_version;
544 	/** dnstap "identity", hostname is used if "". */
545 	char* dnstap_identity;
546 	/** dnstap "version", package version is used if "". */
547 	char* dnstap_version;
548 
549 	/** true to log dnstap RESOLVER_QUERY message events */
550 	int dnstap_log_resolver_query_messages;
551 	/** true to log dnstap RESOLVER_RESPONSE message events */
552 	int dnstap_log_resolver_response_messages;
553 	/** true to log dnstap CLIENT_QUERY message events */
554 	int dnstap_log_client_query_messages;
555 	/** true to log dnstap CLIENT_RESPONSE message events */
556 	int dnstap_log_client_response_messages;
557 	/** true to log dnstap FORWARDER_QUERY message events */
558 	int dnstap_log_forwarder_query_messages;
559 	/** true to log dnstap FORWARDER_RESPONSE message events */
560 	int dnstap_log_forwarder_response_messages;
561 
562 	/** true to disable DNSSEC lameness check in iterator */
563 	int disable_dnssec_lame_check;
564 
565 	/** ratelimit for ip addresses. 0 is off, otherwise qps (unless overridden) */
566 	int ip_ratelimit;
567 	/** number of slabs for ip_ratelimit cache */
568 	size_t ip_ratelimit_slabs;
569 	/** memory size in bytes for ip_ratelimit cache */
570 	size_t ip_ratelimit_size;
571 	/** ip_ratelimit factor, 0 blocks all, 10 allows 1/10 of traffic */
572 	int ip_ratelimit_factor;
573 	/** ratelimit backoff, when on, if the limit is reached it is
574 	 *  considered an attack and it backs off until 'demand' decreases over
575 	 *  the RATE_WINDOW. */
576 	int ip_ratelimit_backoff;
577 
578 	/** ratelimit for domains. 0 is off, otherwise qps (unless overridden) */
579 	int ratelimit;
580 	/** number of slabs for ratelimit cache */
581 	size_t ratelimit_slabs;
582 	/** memory size in bytes for ratelimit cache */
583 	size_t ratelimit_size;
584 	/** ratelimits for domain (exact match) */
585 	struct config_str2list* ratelimit_for_domain;
586 	/** ratelimits below domain */
587 	struct config_str2list* ratelimit_below_domain;
588 	/** ratelimit factor, 0 blocks all, 10 allows 1/10 of traffic */
589 	int ratelimit_factor;
590 	/** ratelimit backoff, when on, if the limit is reached it is
591 	 *  considered an attack and it backs off until 'demand' decreases over
592 	 *  the RATE_WINDOW. */
593 	int ratelimit_backoff;
594 
595 	/** number of retries on outgoing queries */
596 	int outbound_msg_retry;
597 	/** minimise outgoing QNAME and hide original QTYPE if possible */
598 	int qname_minimisation;
599 	/** minimise QNAME in strict mode, minimise according to RFC.
600 	 *  Do not apply fallback */
601 	int qname_minimisation_strict;
602 	/** SHM data - true if shm is enabled */
603 	int shm_enable;
604 	/** SHM data - key for the shm */
605 	int shm_key;
606 
607 	/** list of EDNS client string entries, linked list */
608 	struct config_str2list* edns_client_strings;
609 	/** EDNS opcode to use for EDNS client strings */
610 	uint16_t edns_client_string_opcode;
611 
612 	/** DNSCrypt */
613 	/** true to enable dnscrypt */
614 	int dnscrypt;
615 	/** port on which to provide dnscrypt service */
616 	int dnscrypt_port;
617 	/** provider name 2.dnscrypt-cert.example.com */
618 	char* dnscrypt_provider;
619 	/** dnscrypt secret keys 1.key */
620 	struct config_strlist* dnscrypt_secret_key;
621 	/** dnscrypt provider certs 1.cert */
622 	struct config_strlist* dnscrypt_provider_cert;
623 	/** dnscrypt provider certs 1.cert which have been rotated and should not be
624 	* advertised through DNS's providername TXT record but are required to be
625 	* able to handle existing traffic using the old cert. */
626 	struct config_strlist* dnscrypt_provider_cert_rotated;
627 	/** memory size in bytes for dnscrypt shared secrets cache */
628 	size_t dnscrypt_shared_secret_cache_size;
629 	/** number of slabs for dnscrypt shared secrets cache */
630 	size_t dnscrypt_shared_secret_cache_slabs;
631 	/** memory size in bytes for dnscrypt nonces cache */
632 	size_t dnscrypt_nonce_cache_size;
633 	/** number of slabs for dnscrypt nonces cache */
634 	size_t dnscrypt_nonce_cache_slabs;
635 
636 	/** EDNS padding according to RFC7830 and RFC8467 */
637 	/** true to enable padding of responses (default: on) */
638 	int pad_responses;
639 	/** block size with which to pad encrypted responses (default: 468) */
640 	size_t pad_responses_block_size;
641 	/** true to enable padding of queries (default: on) */
642 	int pad_queries;
643 	/** block size with which to pad encrypted queries (default: 128) */
644 	size_t pad_queries_block_size;
645 
646 	/** IPsec module */
647 #ifdef USE_IPSECMOD
648 	/** false to bypass the IPsec module */
649 	int ipsecmod_enabled;
650 	/** whitelisted domains for ipsecmod */
651 	struct config_strlist* ipsecmod_whitelist;
652 	/** path to external hook */
653 	char* ipsecmod_hook;
654 	/** true to proceed even with a bogus IPSECKEY */
655 	int ipsecmod_ignore_bogus;
656 	/** max TTL for the A/AAAA records that call the hook */
657 	int ipsecmod_max_ttl;
658 	/** false to proceed even when ipsecmod_hook fails */
659 	int ipsecmod_strict;
660 #endif
661 
662 	/* cachedb module */
663 #ifdef USE_CACHEDB
664 	/** backend DB name */
665 	char* cachedb_backend;
666 	/** secret seed for hash key calculation */
667 	char* cachedb_secret;
668 #ifdef USE_REDIS
669 	/** redis server's IP address or host name */
670 	char* redis_server_host;
671 	/** redis server's TCP port */
672 	int redis_server_port;
673 	/** timeout (in ms) for communication with the redis server */
674 	int redis_timeout;
675 	/** set timeout on redis records based on DNS response ttl */
676 	int redis_expire_records;
677 #endif
678 #endif
679 
680 	/* ipset module */
681 #ifdef USE_IPSET
682 	char* ipset_name_v4;
683 	char* ipset_name_v6;
684 #endif
685 	/** respond with Extended DNS Errors (RFC8914) */
686 	int ede;
687 };
688 
689 /** from cfg username, after daemonize setup performed */
690 extern uid_t cfg_uid;
691 /** from cfg username, after daemonize setup performed */
692 extern gid_t cfg_gid;
693 /** debug and enable small timeouts */
694 extern int autr_permit_small_holddown;
695 /** size (in bytes) of stream wait buffers max */
696 extern size_t stream_wait_max;
697 /** size (in bytes) of all total HTTP2 query buffers max */
698 extern size_t http2_query_buffer_max;
699 /** size (in bytes) of all total HTTP2 response buffers max */
700 extern size_t http2_response_buffer_max;
701 
702 /**
703  * Stub config options
704  */
705 struct config_stub {
706 	/** next in list */
707 	struct config_stub* next;
708 	/** domain name (in text) of the stub apex domain */
709 	char* name;
710 	/** list of stub nameserver hosts (domain name) */
711 	struct config_strlist* hosts;
712 	/** list of stub nameserver addresses (IP address) */
713 	struct config_strlist* addrs;
714 	/** if stub-prime is set */
715 	int isprime;
716 	/** if forward-first is set (failover to without if fails) */
717 	int isfirst;
718 	/** use tcp for queries to this stub */
719 	int tcp_upstream;
720 	/** use SSL for queries to this stub */
721 	int ssl_upstream;
722 	/*** no cache */
723 	int no_cache;
724 };
725 
726 /**
727  * Auth config options
728  */
729 struct config_auth {
730 	/** next in list */
731 	struct config_auth* next;
732 	/** domain name (in text) of the auth apex domain */
733 	char* name;
734 	/** list of masters */
735 	struct config_strlist* masters;
736 	/** list of urls */
737 	struct config_strlist* urls;
738 	/** list of allow-notify */
739 	struct config_strlist* allow_notify;
740 	/** zonefile (or NULL) */
741 	char* zonefile;
742 	/** provide downstream answers */
743 	int for_downstream;
744 	/** provide upstream answers */
745 	int for_upstream;
746 	/** fallback to recursion to authorities if zone expired and other
747 	 * reasons perhaps (like, query bogus) */
748 	int fallback_enabled;
749 	/** this zone is used to create local-zone policies */
750 	int isrpz;
751 	/** rpz tags (or NULL) */
752 	uint8_t* rpz_taglist;
753 	/** length of the taglist (in bytes) */
754 	size_t rpz_taglistlen;
755 	/** Override RPZ action for this zone, regardless of zone content */
756 	char* rpz_action_override;
757 	/** Log when this RPZ policy is applied */
758 	int rpz_log;
759 	/** Display this name in the log when RPZ policy is applied */
760 	char* rpz_log_name;
761 	/** Always reply with this CNAME target if the cname override action is
762 	 * used */
763 	char* rpz_cname;
764 	/** signal nxdomain block with unset RA */
765 	int rpz_signal_nxdomain_ra;
766 	/** Check ZONEMD records for this zone */
767 	int zonemd_check;
768 	/** Reject absence of ZONEMD records, zone must have one */
769 	int zonemd_reject_absence;
770 };
771 
772 /**
773  * View config options
774  */
775 struct config_view {
776 	/** next in list */
777 	struct config_view* next;
778 	/** view name */
779 	char* name;
780 	/** local zones */
781 	struct config_str2list* local_zones;
782 	/** local data RRs */
783 	struct config_strlist* local_data;
784 	/** local zones nodefault list */
785 	struct config_strlist* local_zones_nodefault;
786 #ifdef USE_IPSET
787 	/** local zones ipset list */
788 	struct config_strlist* local_zones_ipset;
789 #endif
790 	/** Fallback to global local_zones when there is no match in the view
791 	 * view specific tree. 1 for yes, 0 for no */
792 	int isfirst;
793 	/** predefined actions for particular IP address responses */
794 	struct config_str2list* respip_actions;
795 	/** data complementing the 'redirect' response IP actions */
796 	struct config_str2list* respip_data;
797 };
798 
799 /**
800  * List of strings for config options
801  */
802 struct config_strlist {
803 	/** next item in list */
804 	struct config_strlist* next;
805 	/** config option string */
806 	char* str;
807 };
808 
809 /**
810  * List of two strings for config options
811  */
812 struct config_str2list {
813 	/** next item in list */
814 	struct config_str2list* next;
815 	/** first string */
816 	char* str;
817 	/** second string */
818 	char* str2;
819 };
820 
821 /**
822  * List of three strings for config options
823  */
824 struct config_str3list {
825 	/** next item in list */
826 	struct config_str3list* next;
827 	/** first string */
828 	char* str;
829 	/** second string */
830 	char* str2;
831 	/** third string */
832 	char* str3;
833 };
834 
835 
836 /**
837  * List of string, bytestring for config options
838  */
839 struct config_strbytelist {
840 	/** next item in list */
841 	struct config_strbytelist* next;
842 	/** first string */
843 	char* str;
844 	/** second bytestring */
845 	uint8_t* str2;
846 	size_t str2len;
847 };
848 
849 /**
850  * Create config file structure. Filled with default values.
851  * @return: the new structure or NULL on memory error.
852  */
853 struct config_file* config_create(void);
854 
855 /**
856  * Create config file structure for library use. Filled with default values.
857  * @return: the new structure or NULL on memory error.
858  */
859 struct config_file* config_create_forlib(void);
860 
861 /**
862  * Read the config file from the specified filename.
863  * @param config: where options are stored into, must be freshly created.
864  * @param filename: name of configfile. If NULL nothing is done.
865  * @param chroot: if not NULL, the chroot dir currently in use (for include).
866  * @return: false on error. In that case errno is set, ENOENT means
867  * 	file not found.
868  */
869 int config_read(struct config_file* config, const char* filename,
870 	const char* chroot);
871 
872 /**
873  * Destroy the config file structure.
874  * @param config: to delete.
875  */
876 void config_delete(struct config_file* config);
877 
878 /**
879  * Apply config to global constants; this routine is called in single thread.
880  * @param config: to apply. Side effect: global constants change.
881  */
882 void config_apply(struct config_file* config);
883 
884 /**
885  * Find username, sets cfg_uid and cfg_gid.
886  * @param config: the config structure.
887  */
888 void config_lookup_uid(struct config_file* config);
889 
890 /**
891  * Set the given keyword to the given value.
892  * @param config: where to store config
893  * @param option: option name, including the ':' character.
894  * @param value: value, this string is copied if needed, or parsed.
895  * 	The caller owns the value string.
896  * @return 0 on error (malloc or syntax error).
897  */
898 int config_set_option(struct config_file* config, const char* option,
899 	const char* value);
900 
901 /**
902  * Call print routine for the given option.
903  * @param cfg: config.
904  * @param opt: option name without trailing :.
905  *	This is different from config_set_option.
906  * @param func: print func, called as (str, arg) for every data element.
907  * @param arg: user argument for print func.
908  * @return false if the option name is not supported (syntax error).
909  */
910 int config_get_option(struct config_file* cfg, const char* opt,
911 	void (*func)(char*,void*), void* arg);
912 
913 /**
914  * Get an option and return strlist
915  * @param cfg: config file
916  * @param opt: option name.
917  * @param list: list is returned here. malloced, caller must free it.
918  * @return 0=OK, 1=syntax error, 2=malloc failed.
919  */
920 int config_get_option_list(struct config_file* cfg, const char* opt,
921 	struct config_strlist** list);
922 
923 /**
924  * Get an option and collate results into string
925  * @param cfg: config file
926  * @param opt: option name.
927  * @param str: string. malloced, caller must free it.
928  * @return 0=OK, 1=syntax error, 2=malloc failed.
929  */
930 int config_get_option_collate(struct config_file* cfg, const char* opt,
931 	char** str);
932 
933 /**
934  * function to print to a file, use as func with config_get_option.
935  * @param line: text to print. \n appended.
936  * @param arg: pass a FILE*, like stdout.
937  */
938 void config_print_func(char* line, void* arg);
939 
940 /**
941  * function to collate the text strings into a strlist_head.
942  * @param line: text to append.
943  * @param arg: pass a strlist_head structure. zeroed on start.
944  */
945 void config_collate_func(char* line, void* arg);
946 
947 /**
948  * take a strlist_head list and return a malloc string. separated with newline.
949  * @param list: strlist first to collate. zeroes return "".
950  * @return NULL on malloc failure. Or if malloc failure happened in strlist.
951  */
952 char* config_collate_cat(struct config_strlist* list);
953 
954 /**
955  * Append text at end of list.
956  * @param list: list head. zeroed at start.
957  * @param item: new item. malloced by caller. if NULL the insertion fails.
958  * @return true on success.
959  * on fail the item is free()ed.
960  */
961 int cfg_strlist_append(struct config_strlist_head* list, char* item);
962 
963 /**
964  * Searches the end of a string list and appends the given text.
965  * @param head: pointer to strlist head variable.
966  * @param item: new item. malloced by caller. if NULL the insertion fails.
967  * @return true on success.
968  */
969 int cfg_strlist_append_ex(struct config_strlist** head, char* item);
970 
971 /**
972  * Find string in strlist.
973  * @param head: pointer to strlist head variable.
974  * @param item: the item to search for.
975  * @return: the element in the list when found, NULL otherwise.
976  */
977 struct config_strlist* cfg_strlist_find(struct config_strlist* head,
978 	const char* item);
979 
980 /**
981  * Insert string into strlist.
982  * @param head: pointer to strlist head variable.
983  * @param item: new item. malloced by caller. If NULL the insertion fails.
984  * @return: true on success.
985  * on fail, the item is free()d.
986  */
987 int cfg_strlist_insert(struct config_strlist** head, char* item);
988 
989 /** insert with region for allocation. */
990 int cfg_region_strlist_insert(struct regional* region,
991 	struct config_strlist** head, char* item);
992 
993 /**
994  * Insert string into str2list.
995  * @param head: pointer to str2list head variable.
996  * @param item: new item. malloced by caller. If NULL the insertion fails.
997  * @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
998  * @return: true on success.
999  * on fail, the item and i2 are free()d.
1000  */
1001 int cfg_str2list_insert(struct config_str2list** head, char* item, char* i2);
1002 
1003 /**
1004  * Insert string into str3list.
1005  * @param head: pointer to str3list head variable.
1006  * @param item: new item. malloced by caller. If NULL the insertion fails.
1007  * @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
1008  * @param i3: 3rd string, malloced by caller. If NULL the insertion fails.
1009  * @return: true on success.
1010  */
1011 int cfg_str3list_insert(struct config_str3list** head, char* item, char* i2,
1012 	char* i3);
1013 
1014 /**
1015  * Insert string into strbytelist.
1016  * @param head: pointer to strbytelist head variable.
1017  * @param item: new item. malloced by caller. If NULL the insertion fails.
1018  * @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
1019  * @param i2len: length of the i2 bytestring.
1020  * @return: true on success.
1021  */
1022 int cfg_strbytelist_insert(struct config_strbytelist** head, char* item,
1023 	uint8_t* i2, size_t i2len);
1024 
1025 /**
1026  * Find stub in config list, also returns prevptr (for deletion).
1027  * @param pp: call routine with pointer to a pointer to the start of the list,
1028  * 	if the stub is found, on exit, the value contains a pointer to the
1029  * 	next pointer that points to the found element (or to the list start
1030  * 	pointer if it is the first element).
1031  * @param nm: name of stub to find.
1032  * @return: pointer to config_stub if found, or NULL if not found.
1033  */
1034 struct config_stub* cfg_stub_find(struct config_stub*** pp, const char* nm);
1035 
1036 /**
1037  * Delete items in config string list.
1038  * @param list: list.
1039  */
1040 void config_delstrlist(struct config_strlist* list);
1041 
1042 /**
1043  * Delete items in config double string list.
1044  * @param list: list.
1045  */
1046 void config_deldblstrlist(struct config_str2list* list);
1047 
1048 /**
1049  * Delete items in config triple string list.
1050  * @param list: list.
1051  */
1052 void config_deltrplstrlist(struct config_str3list* list);
1053 
1054 /** delete string array */
1055 void config_del_strarray(char** array, int num);
1056 
1057 /** delete stringbytelist */
1058 void config_del_strbytelist(struct config_strbytelist* list);
1059 
1060 /**
1061  * Delete a stub item
1062  * @param p: stub item
1063  */
1064 void config_delstub(struct config_stub* p);
1065 
1066 /**
1067  * Delete items in config stub list.
1068  * @param list: list.
1069  */
1070 void config_delstubs(struct config_stub* list);
1071 
1072 /**
1073  * Delete an auth item
1074  * @param p: auth item
1075  */
1076 void config_delauth(struct config_auth* p);
1077 
1078 /**
1079  * Delete items in config auth list.
1080  * @param list: list.
1081  */
1082 void config_delauths(struct config_auth* list);
1083 
1084 /**
1085  * Delete a view item
1086  * @param p: view item
1087  */
1088 void config_delview(struct config_view* p);
1089 
1090 /**
1091  * Delete items in config view list.
1092  * @param list: list.
1093  */
1094 void config_delviews(struct config_view* list);
1095 
1096 /** check if config for remote control turns on IP-address interface
1097  * with certificates or a named pipe without certificates. */
1098 int options_remote_is_address(struct config_file* cfg);
1099 
1100 /**
1101  * Convert 14digit to time value
1102  * @param str: string of 14 digits
1103  * @return time value or 0 for error.
1104  */
1105 time_t cfg_convert_timeval(const char* str);
1106 
1107 /**
1108  * Count number of values in the string.
1109  * format ::= (sp num)+ sp
1110  * num ::= [-](0-9)+
1111  * sp ::= (space|tab)*
1112  *
1113  * @param str: string
1114  * @return: 0 on parse error, or empty string, else
1115  *	number of integer values in the string.
1116  */
1117 int cfg_count_numbers(const char* str);
1118 
1119 /**
1120  * Convert a 'nice' memory or file size into a bytecount
1121  * From '100k' to 102400. and so on. Understands kKmMgG.
1122  * k=1024, m=1024*1024, g=1024*1024*1024.
1123  * @param str: string
1124  * @param res: result is stored here, size in bytes.
1125  * @return: true if parsed correctly, or 0 on a parse error (and an error
1126  * is logged).
1127  */
1128 int cfg_parse_memsize(const char* str, size_t* res);
1129 
1130 /**
1131  * Parse nsid from string into binary nsid. nsid is either a hexadecimal
1132  * string or an ascii string prepended with ascii_ in which case the
1133  * characters after ascii_ are simply copied.
1134  * @param str: the string to parse.
1135  * @param nsid_len: returns length of nsid in bytes.
1136  * @return malloced bytes or NULL on parse error or malloc failure.
1137  */
1138 uint8_t* cfg_parse_nsid(const char* str, uint16_t* nsid_len);
1139 
1140 /**
1141  * Add a tag name to the config.  It is added at the end with a new ID value.
1142  * @param cfg: the config structure.
1143  * @param tag: string (which is copied) with the name.
1144  * @return: false on alloc failure.
1145  */
1146 int config_add_tag(struct config_file* cfg, const char* tag);
1147 
1148 /**
1149  * Find tag ID in the tag list.
1150  * @param cfg: the config structure.
1151  * @param tag: string with tag name to search for.
1152  * @return: 0..(num_tags-1) with tag ID, or -1 if tagname is not found.
1153  */
1154 int find_tag_id(struct config_file* cfg, const char* tag);
1155 
1156 /**
1157  * parse taglist from string into bytestring with bitlist.
1158  * @param cfg: the config structure (with tagnames)
1159  * @param str: the string to parse.  Parse puts 0 bytes in string.
1160  * @param listlen: returns length of in bytes.
1161  * @return malloced bytes with a bitlist of the tags.  or NULL on parse error
1162  * or malloc failure.
1163  */
1164 uint8_t* config_parse_taglist(struct config_file* cfg, char* str,
1165 	size_t* listlen);
1166 
1167 /**
1168  * convert tag bitlist to a malloced string with tag names.  For debug output.
1169  * @param cfg: the config structure (with tagnames)
1170  * @param taglist: the tag bitlist.
1171  * @param len: length of the tag bitlist.
1172  * @return malloced string or NULL.
1173  */
1174 char* config_taglist2str(struct config_file* cfg, uint8_t* taglist,
1175 	size_t len);
1176 
1177 /**
1178  * see if two taglists intersect (have tags in common).
1179  * @param list1: first tag bitlist.
1180  * @param list1len: length in bytes of first list.
1181  * @param list2: second tag bitlist.
1182  * @param list2len: length in bytes of second list.
1183  * @return true if there are tags in common, 0 if not.
1184  */
1185 int taglist_intersect(uint8_t* list1, size_t list1len, const uint8_t* list2,
1186 	size_t list2len);
1187 
1188 /**
1189  * Parse local-zone directive into two strings and register it in the config.
1190  * @param cfg: to put it in.
1191  * @param val: argument strings to local-zone, "example.com nodefault".
1192  * @return: false on failure
1193  */
1194 int cfg_parse_local_zone(struct config_file* cfg, const char* val);
1195 
1196 /**
1197  * Mark "number" or "low-high" as available or not in ports array.
1198  * @param str: string in input
1199  * @param allow: give true if this range is permitted.
1200  * @param avail: the array from cfg.
1201  * @param num: size of the array (65536).
1202  * @return: true if parsed correctly, or 0 on a parse error (and an error
1203  * is logged).
1204  */
1205 int cfg_mark_ports(const char* str, int allow, int* avail, int num);
1206 
1207 /**
1208  * Get a condensed list of ports returned. allocated.
1209  * @param cfg: config file.
1210  * @param avail: the available ports array is returned here.
1211  * @return: number of ports in array or 0 on error.
1212  */
1213 int cfg_condense_ports(struct config_file* cfg, int** avail);
1214 
1215 /**
1216  * Apply system specific port range policy.
1217  * @param cfg: config file.
1218  * @param num: size of the array (65536).
1219  */
1220 void cfg_apply_local_port_policy(struct config_file* cfg, int num);
1221 
1222 /**
1223  * Scan ports available
1224  * @param avail: the array from cfg.
1225  * @param num: size of the array (65536).
1226  * @return the number of ports available for use.
1227  */
1228 int cfg_scan_ports(int* avail, int num);
1229 
1230 /**
1231  * Convert a filename to full pathname in original filesys
1232  * @param fname: the path name to convert.
1233  *      Must not be null or empty.
1234  * @param cfg: config struct for chroot and chdir (if set).
1235  * @param use_chdir: if false, only chroot is applied.
1236  * @return pointer to malloced buffer which is: [chroot][chdir]fname
1237  *      or NULL on malloc failure.
1238  */
1239 char* fname_after_chroot(const char* fname, struct config_file* cfg,
1240 	int use_chdir);
1241 
1242 /**
1243  * Convert a ptr shorthand into a full reverse-notation PTR record.
1244  * @param str: input string, "IP name"
1245  * @return: malloced string "reversed-ip-name PTR name"
1246  */
1247 char* cfg_ptr_reverse(char* str);
1248 
1249 /**
1250  * Used during options parsing
1251  */
1252 struct config_parser_state {
1253 	/** name of file being parser */
1254 	char* filename;
1255 	/** line number in the file, starts at 1 */
1256 	int line;
1257 	/** number of errors encountered */
1258 	int errors;
1259 	/** the result of parsing is stored here. */
1260 	struct config_file* cfg;
1261 	/** the current chroot dir (or NULL if none) */
1262 	const char* chroot;
1263 };
1264 
1265 /** global config parser object used during config parsing */
1266 extern struct config_parser_state* cfg_parser;
1267 /** init lex state */
1268 void init_cfg_parse(void);
1269 /** lex in file */
1270 extern FILE* ub_c_in;
1271 /** lex out file */
1272 extern FILE* ub_c_out;
1273 /** the yacc lex generated parse function */
1274 int ub_c_parse(void);
1275 /** the lexer function */
1276 int ub_c_lex(void);
1277 /** wrap function */
1278 int ub_c_wrap(void);
1279 /** parsing helpers: print error with file and line numbers */
1280 void ub_c_error(const char* msg);
1281 /** parsing helpers: print error with file and line numbers */
1282 void ub_c_error_msg(const char* fmt, ...) ATTR_FORMAT(printf, 1, 2);
1283 
1284 #ifdef UB_ON_WINDOWS
1285 /**
1286  * Obtain registry string (if it exists).
1287  * @param key: key string
1288  * @param name: name of value to fetch.
1289  * @return malloced string with the result or NULL if it did not
1290  * 	exist on an error (logged with log_err) was encountered.
1291  */
1292 char* w_lookup_reg_str(const char* key, const char* name);
1293 
1294 /** Modify directory in options for module file name */
1295 void w_config_adjust_directory(struct config_file* cfg);
1296 #endif /* UB_ON_WINDOWS */
1297 
1298 /** debug option for unit tests. */
1299 extern int fake_dsa, fake_sha1;
1300 
1301 /** see if interface is https, its port number == the https port number */
1302 int if_is_https(const char* ifname, const char* port, int https_port);
1303 
1304 /**
1305  * Return true if the config contains settings that enable https.
1306  * @param cfg: config information.
1307  * @return true if https ports are used for server.
1308  */
1309 int cfg_has_https(struct config_file* cfg);
1310 
1311 #ifdef USE_LINUX_IP_LOCAL_PORT_RANGE
1312 #define LINUX_IP_LOCAL_PORT_RANGE_PATH "/proc/sys/net/ipv4/ip_local_port_range"
1313 #endif
1314 
1315 #endif /* UTIL_CONFIG_FILE_H */
1316 
1317