dnsproxy: DNS response answer count was incorrectly set
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Fri, 18 Jan 2013 12:11:32 +0000 (14:11 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 18 Jan 2013 14:48:58 +0000 (16:48 +0200)
We set the answer count in host byte order instead of network
byte order when sending cached AAAA record. This problem is only
seen in special case when an AAAA record is generated by us when
there is IPv4 address in cache but no IPv6 address for the host.

src/dnsproxy.c

index ce61909..f698cfd 100644 (file)
@@ -1307,7 +1307,7 @@ static int cache_update(struct server_data *srv, unsigned char *msg,
                                return -ENOMEM;
                        data->inserted = entry->ipv4->inserted;
                        data->type = type;
-                       data->answers = hdr->ancount;
+                       data->answers = ntohs(hdr->ancount);
                        data->timeout = entry->ipv4->timeout;
                        if (srv->protocol == IPPROTO_UDP)
                                cache_offset = 2;