resolved: rr - ignore pseudo types in NSEC(3) bitmaps
authorTom Gundersen <teg@jklm.no>
Thu, 23 Jul 2015 11:48:56 +0000 (13:48 +0200)
committerTom Gundersen <teg@jklm.no>
Thu, 23 Jul 2015 16:06:50 +0000 (18:06 +0200)
src/resolve/dns-type.c
src/resolve/dns-type.h
src/resolve/resolved-dns-packet.c

index a3e7408..e1087b3 100644 (file)
@@ -43,3 +43,8 @@ int dns_type_from_string(const char *s) {
 
         return sc->id;
 }
+
+/* XXX: find an authorotative list of all pseudo types? */
+bool dns_type_is_pseudo(int n) {
+        return IN_SET(n, DNS_TYPE_ANY, DNS_TYPE_AXFR, DNS_TYPE_IXFR, DNS_TYPE_OPT);
+}
index 86951d2..950af36 100644 (file)
@@ -25,6 +25,7 @@
 
 const char *dns_type_to_string(int type);
 int dns_type_from_string(const char *s);
+bool dns_type_is_pseudo(int n);
 
 /* DNS record types, taken from
  * http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
index b76f981..2dd1f56 100644 (file)
@@ -1208,9 +1208,12 @@ static int dns_packet_read_type_window(DnsPacket *p, Bitmap **types, size_t *sta
                         if (bitmap[i] & bitmask) {
                                 uint16_t n;
 
-                                /* XXX: ignore pseudo-types? see RFC4034 section 4.1.2 */
                                 n = (uint16_t) window << 8 | (uint16_t) bit;
 
+                                /* Ignore pseudo-types. see RFC4034 section 4.1.2 */
+                                if (dns_type_is_pseudo(n))
+                                        continue;
+
                                 r = bitmap_set(*types, n);
                                 if (r < 0)
                                         goto fail;