Branch data Line data Source code
1 : : /* SPDX-License-Identifier: LGPL-2.1+ */
2 : :
3 : : #include "conf-parser.h"
4 : : #include "resolve-util.h"
5 : : #include "string-table.h"
6 : :
7 [ # # # # : 0 : DEFINE_CONFIG_PARSE_ENUM(config_parse_resolve_support, resolve_support, ResolveSupport, "Failed to parse resolve support setting");
# # # # #
# # # ]
8 [ # # # # : 0 : DEFINE_CONFIG_PARSE_ENUM(config_parse_dnssec_mode, dnssec_mode, DnssecMode, "Failed to parse DNSSEC mode setting");
# # # # #
# # # ]
9 [ # # # # : 0 : DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_over_tls_mode, dns_over_tls_mode, DnsOverTlsMode, "Failed to parse DNS-over-TLS mode setting");
# # # # #
# # # ]
10 : :
11 : : static const char* const resolve_support_table[_RESOLVE_SUPPORT_MAX] = {
12 : : [RESOLVE_SUPPORT_NO] = "no",
13 : : [RESOLVE_SUPPORT_YES] = "yes",
14 : : [RESOLVE_SUPPORT_RESOLVE] = "resolve",
15 : : };
16 [ + + + + : 40 : DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(resolve_support, ResolveSupport, RESOLVE_SUPPORT_YES);
+ + ]
17 : :
18 : : static const char* const dnssec_mode_table[_DNSSEC_MODE_MAX] = {
19 : : [DNSSEC_NO] = "no",
20 : : [DNSSEC_ALLOW_DOWNGRADE] = "allow-downgrade",
21 : : [DNSSEC_YES] = "yes",
22 : : };
23 [ + + + + : 40 : DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(dnssec_mode, DnssecMode, DNSSEC_YES);
+ + ]
24 : :
25 : : static const char* const dns_over_tls_mode_table[_DNS_OVER_TLS_MODE_MAX] = {
26 : : [DNS_OVER_TLS_NO] = "no",
27 : : [DNS_OVER_TLS_OPPORTUNISTIC] = "opportunistic",
28 : : [DNS_OVER_TLS_YES] = "yes",
29 : : };
30 [ + + + + : 40 : DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(dns_over_tls_mode, DnsOverTlsMode, DNS_OVER_TLS_YES);
+ + ]
31 : :
32 : 0 : bool dns_server_address_valid(int family, const union in_addr_union *sa) {
33 : :
34 : : /* Refuses the 0 IP addresses as well as 127.0.0.53 (which is our own DNS stub) */
35 : :
36 [ # # ]: 0 : if (in_addr_is_null(family, sa))
37 : 0 : return false;
38 : :
39 [ # # # # ]: 0 : if (family == AF_INET && sa->in.s_addr == htobe32(INADDR_DNS_STUB))
40 : 0 : return false;
41 : :
42 : 0 : return true;
43 : : }
44 : :
45 [ # # # # : 0 : DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_cache_mode, dns_cache_mode, DnsCacheMode, "Failed to parse DNS cache mode setting")
# # # # ]
46 : :
47 : : static const char* const dns_cache_mode_table[_DNS_CACHE_MODE_MAX] = {
48 : : [DNS_CACHE_MODE_YES] = "yes",
49 : : [DNS_CACHE_MODE_NO] = "no",
50 : : [DNS_CACHE_MODE_NO_NEGATIVE] = "no-negative",
51 : : };
52 [ # # # # : 0 : DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(dns_cache_mode, DnsCacheMode, DNS_CACHE_MODE_YES);
# # ]
|