Fix nameserver list in auth mode.

If dnsmasq is not acting as an authoritative nameserver (no second
argument to --auth-server) then it should not appear in the NS RRset.

This leaves simply the list of servers specified in --auth-sec-servers.
This commit is contained in:
Simon Kelley
2020-03-28 17:41:06 +00:00
parent 3f60ecd6f0
commit b43585c34b
2 changed files with 14 additions and 10 deletions

View File

@@ -628,16 +628,20 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
{
struct name_list *secondary;
newoffset = ansp - (unsigned char *)header;
if (add_resource_record(header, limit, &trunc, -offset, &ansp,
daemon->auth_ttl, NULL, T_NS, C_IN, "d", offset == 0 ? authname : NULL, daemon->authserver))
/* Only include the machine running dnsmasq if it's acting as an auth server */
if (daemon->authinterface)
{
if (offset == 0)
offset = newoffset;
if (ns)
anscount++;
else
authcount++;
newoffset = ansp - (unsigned char *)header;
if (add_resource_record(header, limit, &trunc, -offset, &ansp,
daemon->auth_ttl, NULL, T_NS, C_IN, "d", offset == 0 ? authname : NULL, daemon->authserver))
{
if (offset == 0)
offset = newoffset;
if (ns)
anscount++;
else
authcount++;
}
}
if (!subnet)