Subject: Handling Format error response

Handling Format error response

From: Jeremy Leibs <leibs_at_suitabletech.com>
Date: Tue, 23 Oct 2012 21:34:58 -0700

I'm dealing with kind of a weird situation that's uncovered a small
corner case in c-ares. An SRV query from an upstream DNS server is
replying with Server Failed. I'm planning on getting to the bottom of
that later, but for now, I'm considering it expected behavior. When I
instead point c-ares at my linksys router, which is running dnsmasq,
the response I get back changes Format Error. I'm not sure if this is
a bug in dnsmasq, or if there is something else weird/unique to my
setup.

Anyways, when I get the Format Error response, ares simply times out
waiting for a response rather than detecting the error and invoking
the callback with status = ARES_EFORMERR.

Looking into it, the crux of the problem is in process_answer, where
we require that both the query id's and the questions match, so as to
handle the case of query ids wrapping with sufficient oustanding
requests. In the case of format error, however, we get no questions
in the response, and so we never find the match.

I'm not positive what the correct fix is in this case (or if any
action is necessary). Does it seem reasonable to match the response
in the event that it's a format error and there's only a single
outstanding query with the given id? I'm mostly just trying to avoid
an annoying timeout that could otherwise be avoided.

Thanks,
--Jeremy
Received on 2012-10-24