summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dns-transaction.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-11-11 21:03:04 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-16 18:41:08 +0100
commit2c42a217a2ef4a62933290f5ef204bcf89ea52fd (patch)
treed4cd8308585e2480664cf3fb166ad2631bbd9392 /src/resolve/resolved-dns-transaction.c
parentman: fix indentation (diff)
downloadsystemd-2c42a217a2ef4a62933290f5ef204bcf89ea52fd.tar.xz
systemd-2c42a217a2ef4a62933290f5ef204bcf89ea52fd.zip
resolved: when we can't parse a packet, downgrade feature level
So far we didn't really handle the case where we can't parse a reply packet. Since this apparently happens in real-life though, let's add some minimal logic, to downgrade/restart if we see this.
Diffstat (limited to '')
-rw-r--r--src/resolve/resolved-dns-transaction.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
index bd2ae5e4fb..66226c0681 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/resolved-dns-transaction.c
@@ -1189,6 +1189,16 @@ void dns_transaction_process_reply(DnsTransaction *t, DnsPacket *p, bool encrypt
/* After the superficial checks, actually parse the message. */
r = dns_packet_extract(p);
if (r < 0) {
+ if (t->server) {
+ dns_server_packet_invalid(t->server, t->current_feature_level);
+
+ r = dns_transaction_maybe_restart(t);
+ if (r < 0)
+ goto fail;
+ if (r > 0) /* Transaction got restarted... */
+ return;
+ }
+
dns_transaction_complete(t, DNS_TRANSACTION_INVALID_REPLY);
return;
}