mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 06:41:26 +00:00
Set additional record count properly in NS reply
For when there is no IPv4 address to return.
This commit is contained in:
parent
ec6a1ac308
commit
cde0b7632d
|
@ -260,7 +260,6 @@ int dns_encode_ns_response(char *buf, size_t buflen, struct query *q,
|
||||||
|
|
||||||
header->qdcount = htons(1);
|
header->qdcount = htons(1);
|
||||||
header->ancount = htons(1);
|
header->ancount = htons(1);
|
||||||
header->arcount = htons(1);
|
|
||||||
|
|
||||||
/* pointer to start of name */
|
/* pointer to start of name */
|
||||||
name = 0xc000 | ((p - buf) & 0x3fff);
|
name = 0xc000 | ((p - buf) & 0x3fff);
|
||||||
|
@ -302,6 +301,10 @@ int dns_encode_ns_response(char *buf, size_t buflen, struct query *q,
|
||||||
/* Do we have an IPv4 address to send? */
|
/* Do we have an IPv4 address to send? */
|
||||||
if (q->destination.ss_family == AF_INET) {
|
if (q->destination.ss_family == AF_INET) {
|
||||||
struct sockaddr_in *dest = (struct sockaddr_in *) &q->destination;
|
struct sockaddr_in *dest = (struct sockaddr_in *) &q->destination;
|
||||||
|
|
||||||
|
/* One additional record coming */
|
||||||
|
header->arcount = htons(1);
|
||||||
|
|
||||||
/* Additional data (A-record of NS server) */
|
/* Additional data (A-record of NS server) */
|
||||||
CHECKLEN(12);
|
CHECKLEN(12);
|
||||||
putshort(&p, nsname); /* Name Server */
|
putshort(&p, nsname); /* Name Server */
|
||||||
|
|
Loading…
Reference in a new issue