Compare commits

...
3 Commits
Author SHA1 Message Date
Simon Kelley f4d0c660ca Fix sporadic crash in find_mac() - hwlen must be zero for empty entries. 2016-01-18 12:51:08 +00:00
Simon Kelley 1801a29226 Fix botch in forward.c flags code.
Thanks to Matthias Anfree for spotting this.
2016-01-17 21:53:57 +00:00
Simon Kelley 92be34a407 Complete work to allow DNSSEC validation with private DNS servers. 2016-01-16 18:39:54 +00:00
4 changed files with 53 additions and 16 deletions

No files matched your search

+4 -1
View File
@@ -405,7 +405,10 @@ xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag
.B -S /internal.thekelleys.org.uk/192.168.1.1 .B -S /internal.thekelleys.org.uk/192.168.1.1
will send all queries for will send all queries for
internal machines to that nameserver, everything else will go to the internal machines to that nameserver, everything else will go to the
servers in /etc/resolv.conf. An empty domain specification, servers in /etc/resolv.conf. DNSSEC validation is turned off for such
private nameservers, UNLESS a
.B --trust-anchor
is specified for the domain in question. An empty domain specification,
.B // .B //
has the special meaning of "unqualified names only" ie names without any has the special meaning of "unqualified names only" ie names without any
dots in them. A non-standard port may be specified as dots in them. A non-standard port may be specified as
+1
View File
@@ -188,6 +188,7 @@ int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now)
arps = arp; arps = arp;
arp->status = ARP_EMPTY; arp->status = ARP_EMPTY;
arp->family = addr->sa.sa_family; arp->family = addr->sa.sa_family;
arp->hwlen = 0;
if (addr->sa.sa_family == AF_INET) if (addr->sa.sa_family == AF_INET)
arp->addr.addr.addr4.s_addr = addr->in.sin_addr.s_addr; arp->addr.addr.addr4.s_addr = addr->in.sin_addr.s_addr;
+33 -5
View File
@@ -151,7 +151,7 @@ static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigne
hostname_isequal(matchstart, serv->domain) && hostname_isequal(matchstart, serv->domain) &&
(domainlen == 0 || namelen == domainlen || *(matchstart-1) == '.' )) (domainlen == 0 || namelen == domainlen || *(matchstart-1) == '.' ))
{ {
if (serv->flags & SERV_NO_REBIND) if ((serv->flags & SERV_NO_REBIND) && norebind)
*norebind = 1; *norebind = 1;
else else
{ {
@@ -644,7 +644,7 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
return resize_packet(header, n, pheader, plen); return resize_packet(header, n, pheader, plen);
/* Complain loudly if the upstream server is non-recursive. */ /* Complain loudly if the upstream server is non-recursive. */
if (!(header->hb4 & HB4_RA) && RCODE(header) == NOERROR && ntohs(header->ancount) == 0 && if (!(header->hb4 & HB4_RA) && RCODE(header) == NOERROR &&
server && !(server->flags & SERV_WARNED_RECURSIVE)) server && !(server->flags & SERV_WARNED_RECURSIVE))
{ {
prettyprint_addr(&server->addr, daemon->namebuff); prettyprint_addr(&server->addr, daemon->namebuff);
@@ -810,9 +810,9 @@ void reply_query(int fd, int family, time_t now)
{ {
header->hb3 &= ~(HB3_QR | HB3_AA | HB3_TC); header->hb3 &= ~(HB3_QR | HB3_AA | HB3_TC);
header->hb4 &= ~(HB4_RA | HB4_RCODE | HB4_CD | HB4_AD); header->hb4 &= ~(HB4_RA | HB4_RCODE | HB4_CD | HB4_AD);
if (forward->flags |= FREC_CHECKING_DISABLED) if (forward->flags & FREC_CHECKING_DISABLED)
header->hb4 |= HB4_CD; header->hb4 |= HB4_CD;
if (forward->flags |= FREC_AD_QUESTION) if (forward->flags & FREC_AD_QUESTION)
header->hb4 |= HB4_AD; header->hb4 |= HB4_AD;
if (forward->flags & FREC_DO_QUESTION) if (forward->flags & FREC_DO_QUESTION)
add_do_bit(header, nn, (unsigned char *)pheader + plen); add_do_bit(header, nn, (unsigned char *)pheader + plen);
@@ -923,12 +923,40 @@ void reply_query(int fd, int family, time_t now)
status = STAT_ABANDONED; status = STAT_ABANDONED;
else else
{ {
int fd; int fd, type;
struct frec *next = new->next; struct frec *next = new->next;
char *domain;
*new = *forward; /* copy everything, then overwrite */ *new = *forward; /* copy everything, then overwrite */
new->next = next; new->next = next;
new->blocking_query = NULL; new->blocking_query = NULL;
/* Find server to forward to. This will normally be the
same as for the original query, but may be another if
servers for domains are involved. */
if (search_servers(now, NULL, F_QUERY, daemon->keyname, &type, &domain, NULL) == 0)
{
struct server *start = server;
type &= ~SERV_DO_DNSSEC;
while (1)
{
if (type == (start->flags & SERV_TYPE) &&
(type != SERV_HAS_DOMAIN || hostname_isequal(domain, start->domain)) &&
!(start->flags & (SERV_LITERAL_ADDRESS | SERV_LOOP)))
{
server = start;
break;
}
if (!(start = start->next))
start = daemon->servers;
if (start == server)
break;
}
}
new->sentto = server; new->sentto = server;
new->rfd4 = NULL; new->rfd4 = NULL;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
new->rfd6 = NULL; new->rfd6 = NULL;
+15 -10
View File
@@ -1442,20 +1442,25 @@ void check_servers(void)
if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND))) if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND)))
{ {
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
if (option_bool(OPT_DNSSEC_VALID) && (serv->flags & SERV_HAS_DOMAIN)) if (option_bool(OPT_DNSSEC_VALID))
{ {
struct ds_config *ds; if (serv->flags & SERV_HAS_DOMAIN)
char *domain = serv->domain; {
struct ds_config *ds;
char *domain = serv->domain;
/* .example.com is valid */ /* .example.com is valid */
while (*domain == '.') while (*domain == '.')
domain++; domain++;
for (ds = daemon->ds; ds; ds = ds->next) for (ds = daemon->ds; ds; ds = ds->next)
if (ds->name[0] != 0 && hostname_isequal(domain, ds->name)) if (ds->name[0] != 0 && hostname_isequal(domain, ds->name))
break; break;
if (!ds) if (!ds)
serv->flags &= ~SERV_DO_DNSSEC;
}
else if (serv->flags & SERV_FOR_NODOTS)
serv->flags &= ~SERV_DO_DNSSEC; serv->flags &= ~SERV_DO_DNSSEC;
} }
#endif #endif