Sourceware Bugzilla – Bug 13651
resolver fails if result to first query fails but second succeeds
Last modified: 2013-10-08 16:40:44 UTC
Created attachment 6187 [details]
Patch to fix the issue
When using a nameserver which doesn't support IPv6, it might returns FORMERR or NOTIMP, though it's not supposed to be the case according to the RFC. When this corresponds to the first answer (which is usually the case as it's faster to just return an error than doing a recursive query), resplen (that is the returned value) ends up being 0 and resplen2 > 0. The tests in __libc_res_nsearch() only look at resplen and totally ignore resplen2.
The attached patch fixes that by testing if resplen > 0 or resplen == 0 (that is empty result, but no error) and resplen2 > 0.
Aurelien, did you send this patch to libc-alpha?