summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dns-transaction.c
diff options
context:
space:
mode:
authorRonan Pigott <ronan@rjp.ie>2024-10-12 19:00:56 +0200
committerRonan Pigott <ronan@rjp.ie>2024-10-19 06:21:35 +0200
commitfa02d04ee9a4787c2c39032185b6fe3e7146b26b (patch)
treeb88ce97cabe83775db25e82b1a218edf10794530 /src/resolve/resolved-dns-transaction.c
parentresolved: enable CD bit without DO set (diff)
downloadsystemd-fa02d04ee9a4787c2c39032185b6fe3e7146b26b.tar.xz
systemd-fa02d04ee9a4787c2c39032185b6fe3e7146b26b.zip
resolved: update condition for caching full packets
Previously a full packet was cached only if the CD bit was set, but this no longer corresponds to the cases where bypass is enabled. Update the cache to retain a full packet in the cases where it might actually be useful.
Diffstat (limited to '')
-rw-r--r--src/resolve/resolved-dns-transaction.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
index 17a815cd44..f78bf0702b 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/resolved-dns-transaction.c
@@ -840,10 +840,8 @@ static void dns_transaction_cache_answer(DnsTransaction *t) {
dns_transaction_key(t),
t->answer_rcode,
t->answer,
- DNS_PACKET_CD(t->received) ? t->received : NULL, /* only cache full packets with CD on,
- * since our use case for caching them
- * is "bypass" mode which is only
- * enabled for CD packets. */
+ /* If neither DO nor EDE is set, the full packet isn't useful to cache */
+ DNS_PACKET_DO(t->received) || t->answer_ede_rcode > 0 || t->answer_ede_msg ? t->received : NULL,
t->answer_query_flags,
t->answer_dnssec_result,
t->answer_nsec_ttl,