| Summary: | resolver does not return proper error codes | ||
|---|---|---|---|
| Product: | uClibc | Reporter: | Timo Teräs <timo.teras> |
| Component: | Networking | Assignee: | unassigned |
| Status: | VERIFIED FIXED | ||
| Severity: | normal | CC: | uclibc-cvs |
| Priority: | P5 | ||
| Version: | 0.9.30 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | Test-case | ||
Fix: in libc/inet/resolv.c:
int res_query(const char *dname, int class, int type,
unsigned char *answer, int anslen)
{
int i;
unsigned char * packet = NULL;
struct resolv_answer a;
if (!dname || class != 1 /* CLASS_IN */) {
h_errno = NO_RECOVERY;
return -1;
}
memset(&a, '\0', sizeof(a));
i = __dns_lookup(dname, type, &packet, &a);
if (i < 0) {
--> if (!h_errno) /* TODO: can this ever happen? */
h_errno = TRY_AGAIN;
return -1;
}
Fixed in revision 25595, thanks! |
Created attachment 129 [details] Test-case The res_query and other resolver functions do not parse the reply error codes properly. h_errno mostly contains 2 (TRY_AGAIN) even though other error should be there. Attached is a test program that does T_TXT queries. On glibc and other system reports (assuming av.com does not have TXT records in future): av.com: -1, no_data (4) non-existant-domain.info: -1, host_not_found (1) While uclibc returns: av.com: -1, try_again (2) non-existant-domain.info: -1, try_again (2) This is especially problematic for applications that depend on the NO_DATA error. E.g. Overlapped ENUM lookups for NAPTR records.