]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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 a3e740896f762a3969930701ed88012c9c85ba05..e1087b32192b199133376e836d0ed16b040d75df 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 86951d233a3dac8fd0e7f4c87bb2736b1e30bfc8..950af36ee30027b91df4d7b61012950d3c83dece 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 b76f981906b877c24ebedd42a7022fb9b7510817..2dd1f564fa48dd7505e4eddd97dce77f671f3a3c 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;