summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-13 19:30:55 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-13 19:38:14 +0100
commitff4caaaeba731c0f96ba391a7837c877490596ba (patch)
tree782d7fb12f8b6048e4620557e5ab0c94b5198f61 /src/resolve
parentacd74d61d2906a57ec37bfdc793c56b403d18324 (diff)
downloadsystemd-ff4caaaeba731c0f96ba391a7837c877490596ba.tar.gz
resolved: if we can't append EDNS OPT RR, then indicate truncation to stub client
We do so for any other RR we can't add, do this here too. Fixes: #11625
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-dns-stub.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/resolve/resolved-dns-stub.c b/src/resolve/resolved-dns-stub.c
index 4549fe0c72..2bf04db4c5 100644
--- a/src/resolve/resolved-dns-stub.c
+++ b/src/resolve/resolved-dns-stub.c
@@ -91,7 +91,14 @@ static int dns_stub_finish_reply_packet(
assert(p);
- if (!add_opt) {
+ if (add_opt) {
+ r = dns_packet_append_opt(p, ADVERTISE_DATAGRAM_SIZE_MAX, edns0_do, rcode, NULL);
+ if (r == -EMSGSIZE) /* Hit the size limit? then indicate truncation */
+ tc = true;
+ else if (r < 0)
+ return r;
+
+ } else {
/* If the client can't to EDNS0, don't do DO either */
edns0_do = false;
@@ -117,12 +124,6 @@ static int dns_stub_finish_reply_packet(
0 /* cd */,
rcode));
- if (add_opt) {
- r = dns_packet_append_opt(p, ADVERTISE_DATAGRAM_SIZE_MAX, edns0_do, rcode, NULL);
- if (r < 0)
- return r;
- }
-
return 0;
}