cache: cache rdata of SRV-records as well
authorSteven Barth <steven@midlink.org>
Tue, 28 Oct 2014 10:57:09 +0000 (11:57 +0100)
committerSteven Barth <steven@midlink.org>
Tue, 28 Oct 2014 15:31:39 +0000 (16:31 +0100)
Signed-off-by: Steven Barth <steven@midlink.org>
cache.c

diff --git a/cache.c b/cache.c
index 11d359dff9c512c3608058bb150ea039d4a60181..7c7a8fba52858cc573100f9d1ff8f6713722cbce 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -268,6 +268,14 @@ cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struc
                        return;
 
                port = be16_to_cpu(dsd->port);
+               memcpy(rdata_buffer, dsd, sizeof(*dsd));
+               if (dn_expand(base, base + blen, (const uint8_t*)&dsd[1],
+                               &rdata_buffer[sizeof(*dsd)], MAX_DATA_LEN - sizeof(*dsd)) < 0) {
+                       perror("process_answer/dn_expand");
+                       return;
+               }
+               dlen = sizeof(*dsd) + strlen(&rdata_buffer[sizeof(*dsd)]) + 1;
+               rdata = (uint8_t*)rdata_buffer;
                break;
 
        case TYPE_TXT: