]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: dns: automatic reduction of DNS accpeted payload size
authorBaptiste Assmann <bassmann@haproxy.com>
Mon, 21 Aug 2017 14:51:09 +0000 (16:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 09:40:00 +0000 (11:40 +0200)
RFC 6891 states that if a DNS client announces "big" payload size and
doesn't receive a response (because some equipments on the path may
block/drop UDP fragmented packets), then it should try asking for
smaller responses.

src/dns.c

index 62291fe1fcc9cc60574792eb437899de5a27447b..52e02026ffcd3b998748a22a65f52e379e75d8a7 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -2085,6 +2085,12 @@ struct task *dns_process_resolve(struct task *t)
                                LIST_DEL(&requester->list);
                                LIST_ADDQ(&resolution->requester.wait, &requester->list);
                        }
+
+                       /* this might be triggered by too big UDP packets dropped
+                        * somewhere on the network, so lowering the accepted_payload_size
+                        * announced */
+                       if (resolvers->accepted_payload_size > 1280)
+                               resolvers->accepted_payload_size = 1280;
                        goto out;
                }