summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-09-28 21:17:53 +0000
committerMike Frysinger <vapier@gentoo.org>2007-09-28 21:17:53 +0000
commit9734a5f15a86afad159e92e40b8d2d60167e2c3c (patch)
tree094dffd861ed8da058ca06d5e1176215f0674274
parent9e5250dae08a1601c3c7c82d9128613d7c22dd84 (diff)
This patch will fix a problem when the same host is defined with both IPv4 and
IPv6 entries in /etc/hosts. Previous only the first of these host would work, as uClibc would read the /etc/hosts file from top to bottom, failing if the first hit did not match the IP type. Now uClibc will continue reading, even if the first correct entry name, but wrong IP type fails. Thus, allowing a second correct entry name with correct IP type will result in a name resolve. Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
-rw-r--r--libc/inet/resolv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 749c647fc..7f9d7d536 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1650,9 +1650,15 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type,
ret = NETDB_SUCCESS;
#endif /* __UCLIBC_HAS_IPV6__ */
} else {
- DPRINTF("Error\n");
+ /* continue parsing in the hope the user has multiple
+ * host types listed in the database like so:
+ * <ipv4 addr> host
+ * <ipv6 addr> host
+ * If looking for an IPv6 addr, don't bail when we got the IPv4
+ */
+ DPRINTF("Error: Found host but diff network type\n");
ret = TRY_AGAIN;
- break; /* bad ip address */
+ continue;
}
if (action != GETHOSTENT)