resolved: be less strict where the OPT pseudo-RR is placed
authorLennart Poettering <lennart@poettering.net>
Thu, 7 Jan 2016 11:42:48 +0000 (12:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 Jan 2016 18:39:58 +0000 (19:39 +0100)
This increases compatibility with crappy Belkin routers.

src/resolve/resolved-dns-packet.c

index 4750bf1..8a360a2 100644 (file)
@@ -2089,11 +2089,12 @@ int dns_packet_extract(DnsPacket *p) {
                                         goto finish;
                                 }
 
-                                /* The OPT RR is only valid in the Additional section */
-                                if (i < DNS_PACKET_ANCOUNT(p) + DNS_PACKET_NSCOUNT(p)) {
-                                        r = -EBADMSG;
-                                        goto finish;
-                                }
+                                /* Note that we accept the OPT RR in
+                                 * any section, not just in the
+                                 * additional section, as some routers
+                                 * (Belkin!)  blindly copy the OPT RR
+                                 * from the query to the reply packet,
+                                 * and don't get the section right. */
 
                                 /* Two OPT RRs? */
                                 if (p->opt) {