More DNS standard correctness changes: we preserve the CD flag,not the TC flag on responses. When we get a nonstandard query, we should say "NOTIMPL" rather than ignoring it.
svn:r428
o Fix a memory leak in the DNS server
o Fix compilation when DNS_USE_OPENSSL_FOR_ID is enabled
o Fix buffer size and string generation in evdns_resolve_reverse_ipv6().
+ o Respond to nonstandard DNS queries with "NOTIMPL" rather than by ignoring them.
+ o In DNS responses, the CD flag should be preserved, not the TC flag.
GET16(additional);
if (flags & 0x8000) return -1; /* Must not be an answer. */
- if (flags & 0x7800) return -1; /* only standard queries are supported */
- flags &= 0x0300; /* Only TC and RD get preserved. */
+ flags &= 0x0110; /* Only RD and CD get preserved. */
server_req = malloc(sizeof(struct server_request));
if (server_req == NULL) return -1;
server_req->port = port;
port->refcnt++;
+
+ /* Only standard queries are supported. */
+ if (flags & 0x7800) {
+ evdns_server_request_respond(&(server_req->base), DNS_ERR_NOTIMPL);
+ return -1;
+ }
+
port->user_callback(&(server_req->base), port->user_data);
return 0;