summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-07-17 19:27:16 +0200
committerGitHub <noreply@github.com>2019-07-17 19:27:16 +0200
commitea582a0f1b052330a45b5d7bbc9fb860d1c0d98b (patch)
tree24a24106db602360fea3bb623725d635613e9da9 /src/shared
parent5eeb19c6002e98c32ea4ae7651be64287467045d (diff)
parent37d7a7d984ec7679711c2d31789f033f3b6dc2c2 (diff)
downloadsystemd-ea582a0f1b052330a45b5d7bbc9fb860d1c0d98b.tar.gz
systemd-ea582a0f1b052330a45b5d7bbc9fb860d1c0d98b.tar.bz2
systemd-ea582a0f1b052330a45b5d7bbc9fb860d1c0d98b.zip
Merge pull request #13047 from niedbalski/fix-5552-pr
resolved: add new option to only cache positive answers
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/resolve-util.c9
-rw-r--r--src/shared/resolve-util.h14
2 files changed, 23 insertions, 0 deletions
diff --git a/src/shared/resolve-util.c b/src/shared/resolve-util.c
index 3d14410e32..615cb6d852 100644
--- a/src/shared/resolve-util.c
+++ b/src/shared/resolve-util.c
@@ -41,3 +41,12 @@ bool dns_server_address_valid(int family, const union in_addr_union *sa) {
return true;
}
+
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dns_cache_mode, dns_cache_mode, DnsCacheMode, "Failed to parse DNS cache mode setting")
+
+static const char* const dns_cache_mode_table[_DNS_CACHE_MODE_MAX] = {
+ [DNS_CACHE_MODE_YES] = "yes",
+ [DNS_CACHE_MODE_NO] = "no",
+ [DNS_CACHE_MODE_NO_NEGATIVE] = "no-negative",
+};
+DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(dns_cache_mode, DnsCacheMode, DNS_CACHE_MODE_YES);
diff --git a/src/shared/resolve-util.h b/src/shared/resolve-util.h
index cf097dfaa3..acf1f3dade 100644
--- a/src/shared/resolve-util.h
+++ b/src/shared/resolve-util.h
@@ -8,6 +8,16 @@
/* 127.0.0.53 in native endian */
#define INADDR_DNS_STUB ((in_addr_t) 0x7f000035U)
+typedef enum DnsCacheMode DnsCacheMode;
+
+enum DnsCacheMode {
+ DNS_CACHE_MODE_NO,
+ DNS_CACHE_MODE_YES,
+ DNS_CACHE_MODE_NO_NEGATIVE,
+ _DNS_CACHE_MODE_MAX,
+ _DNS_CACHE_MODE_INVALID = 1
+};
+
typedef enum ResolveSupport ResolveSupport;
typedef enum DnssecMode DnssecMode;
typedef enum DnsOverTlsMode DnsOverTlsMode;
@@ -56,6 +66,7 @@ enum DnsOverTlsMode {
CONFIG_PARSER_PROTOTYPE(config_parse_resolve_support);
CONFIG_PARSER_PROTOTYPE(config_parse_dnssec_mode);
CONFIG_PARSER_PROTOTYPE(config_parse_dns_over_tls_mode);
+CONFIG_PARSER_PROTOTYPE(config_parse_dns_cache_mode);
const char* resolve_support_to_string(ResolveSupport p) _const_;
ResolveSupport resolve_support_from_string(const char *s) _pure_;
@@ -67,3 +78,6 @@ const char* dns_over_tls_mode_to_string(DnsOverTlsMode p) _const_;
DnsOverTlsMode dns_over_tls_mode_from_string(const char *s) _pure_;
bool dns_server_address_valid(int family, const union in_addr_union *sa);
+
+const char* dns_cache_mode_to_string(DnsCacheMode p) _const_;
+DnsCacheMode dns_cache_mode_from_string(const char *s) _pure_;