src/types.c: Handle inconsistent CNAME records between addr answers.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 10 Jun 2014 23:40:42 +0000 (00:40 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 13 Jun 2014 08:57:42 +0000 (09:57 +0100)
commit7ef232c6c93693a8623c3cae0d00eade10354b89
tree6bca29346ffbb6f8549605be89bbb006e7f32da6
parentda234f9fe6d3391530bcb1fe632f1164cf0ad9dc
src/types.c: Handle inconsistent CNAME records between addr answers.

It can happen, if we have multiple address queries outstanding, that
they disagree about whether the original name has a CNAME record, or
what the CNAME target is.  This needn't be a configuration error or a
server bug: the zone might have been caught during a changeover.  So we
should try to handle this situation gracefully.

We resolve this as follows.  At least one answer must have reported a
CNAME record, else there is no ambiguity.  We choose the first such
record to arrive, and commit to it, discarding other addresses already
received, if any.  We then resubmit address queries for the address
types still outstanding, but asking specifically for the CNAME target
rather than the original name.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
src/internal.h
src/types.c