chiark / gitweb /
resolved: properly process DNAME RRs
authorLennart Poettering <lennart@poettering.net>
Thu, 31 Jul 2014 16:02:24 +0000 (18:02 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 31 Jul 2014 16:02:24 +0000 (18:02 +0200)
src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-rr.c
src/resolve/resolved-dns-rr.h

index 32c4876..5d4e097 100644 (file)
@@ -502,6 +502,7 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, size_t *star
         case DNS_TYPE_PTR:
         case DNS_TYPE_NS:
         case DNS_TYPE_CNAME:
+        case DNS_TYPE_DNAME:
                 r = dns_packet_append_name(p, rr->ptr.name, NULL);
                 break;
 
@@ -599,7 +600,6 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, size_t *star
                 break;
 
         case DNS_TYPE_SRV:
-        case DNS_TYPE_DNAME:
         case DNS_TYPE_SSHFP:
         case _DNS_TYPE_INVALID: /* unparseable */
         default:
@@ -953,6 +953,7 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) {
         case DNS_TYPE_PTR:
         case DNS_TYPE_NS:
         case DNS_TYPE_CNAME:
+        case DNS_TYPE_DNAME:
                 r = dns_packet_read_name(p, &rr->ptr.name, NULL);
                 break;
 
@@ -1068,7 +1069,6 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, size_t *start) {
         }
 
         case DNS_TYPE_SRV:
-        case DNS_TYPE_DNAME:
         case DNS_TYPE_SSHFP:
         default:
                 r = dns_packet_read(p, rdlength, &d, NULL);
index b6a2c04..d282244 100644 (file)
@@ -237,6 +237,7 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) {
                 case DNS_TYPE_PTR:
                 case DNS_TYPE_NS:
                 case DNS_TYPE_CNAME:
+                case DNS_TYPE_DNAME:
                         free(rr->ptr.name);
                         break;
                 case DNS_TYPE_HINFO:
@@ -319,6 +320,7 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor
         case DNS_TYPE_PTR:
         case DNS_TYPE_NS:
         case DNS_TYPE_CNAME:
+        case DNS_TYPE_DNAME:
                 return dns_name_equal(a->ptr.name, b->ptr.name);
 
         case DNS_TYPE_HINFO:
@@ -424,6 +426,7 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) {
         case DNS_TYPE_PTR:
         case DNS_TYPE_NS:
         case DNS_TYPE_CNAME:
+        case DNS_TYPE_DNAME:
                 s = strjoin(k, " ", rr->ptr.name, NULL);
                 if (!s)
                         return -ENOMEM;
@@ -591,7 +594,6 @@ static const struct {
         { DNS_TYPE_AXFR,  "AXFR"  },
 };
 
-
 const char *dns_type_to_string(uint16_t type) {
         unsigned i;
 
index 8fb4639..027f6ca 100644 (file)
@@ -95,7 +95,7 @@ struct DnsResourceRecord {
 
                 struct {
                         char *name;
-                } ptr, ns, cname;
+                } ptr, ns, cname, dname;
 
                 struct {
                         char *cpu;