Subject: Intended CNAME query behaviour

Intended CNAME query behaviour

From: Thomas Walton <twalton3_at_gmail.com>
Date: Mon, 24 Feb 2020 23:38:23 +0000

Hello,

I have created https://github.com/c-ares/c-ares/issues/303 because c-ares
returns a SUCCESS status when it just receives a CNAME in response to a
query (with no A or AAAA name provided). I consider this to be a bug, and
clearly the test at
https://github.com/c-ares/c-ares/blob/b9eb3a0cfe7f50a3eaa8a1755ae57f7657931e3e/test/ares-test-parse-a.cc#L134
was supposed to check this, but the test is broken and doesn't work. When
the test is corrected, it fails. However, this then clashes with test
ParseAReplyJustCname, which is essentially testing the same case and
checking for a different result.

However, there is a comment in the code implying that this behaviour of
returning a success for a CNAME only lookup is intentional. This was added
in
https://github.com/c-ares/c-ares/commit/2c63440127feed70ccefb148b8f938a2df6c15f8
many years ago.

What is the intended behaviour of c-ares in cases like this? How should
CNAME queries be handled? Is there even a good way of reconciling these
two requirements?

I am happy to try to write a patch for this issue, but I do not want to
break existing useful behaviour.

Regards,

Thomas
Received on 2020-02-25