diff options
author | Jorge Niedbalski <jnr@metaklass.org> | 2019-07-12 15:34:24 -0400 |
---|---|---|
committer | Jorge Niedbalski <jnr@metaklass.org> | 2019-07-17 10:42:53 -0400 |
commit | 37d7a7d984ec7679711c2d31789f033f3b6dc2c2 (patch) | |
tree | f4fb302ef3b0aa7d51e2e50e4ec4cc6444b53231 /src/shared/resolve-util.h | |
parent | 81c07a955590b44fe2b1f21780df353c0d8b62f6 (diff) | |
download | systemd-37d7a7d984ec7679711c2d31789f033f3b6dc2c2.tar.gz |
resolved: switch cache option to a tri-state option (systemd#5552).
Change the resolved.conf Cache option to a tri-state "no, no-negative, yes" values.
If a lookup returns SERVFAIL systemd-resolved will cache the result for 30s (See 201d995),
however, there are several use cases on which this condition is not acceptable (See systemd#5552 comments)
and the only workaround would be to disable cache entirely or flush it , which isn't optimal.
This change adds the 'no-negative' option when set it avoids putting in cache
negative answers but still works the same heuristics for positive answers.
Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
Diffstat (limited to 'src/shared/resolve-util.h')
-rw-r--r-- | src/shared/resolve-util.h | 14 |
1 files changed, 14 insertions, 0 deletions
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_; |