/* Hosts file parser in nss_files module.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
STRING_FIELD (addr, isspace, 1);
/* Parse address. */
- if (inet_pton (AF_INET6, p, entdata->host_addr) > 0)
- {
- result->h_addrtype = AF_INET6;
- result->h_length = IN6ADDRSZ;
- }
- else if (inet_pton (AF_INET, addr, entdata->host_addr) > 0)
+ if (inet_pton (AF_INET, addr, entdata->host_addr) > 0)
{
if (_res.options & RES_USE_INET6)
{
result->h_length = INADDRSZ;
}
}
+ else if (inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
+ {
+ result->h_addrtype = AF_INET6;
+ result->h_length = IN6ADDRSZ;
+ }
else
/* Illegal address: ignore line. */
return 0;
#include "files-XXX.c"
DB_LOOKUP (hostbyname, ,,
- LOOKUP_NAME (h_name, h_aliases),
- const char *name)
+ {
+ if (result->h_addrtype != ((_res.options & RES_USE_INET6)
+ ? AF_INET6 : AF_INET))
+ continue;
+ LOOKUP_NAME_CASE (h_name, h_aliases)
+ }, const char *name)
DB_LOOKUP (hostbyname2, ,,
{
if (result->h_addrtype != af)
continue;
- LOOKUP_NAME (h_name, h_aliases)
+ LOOKUP_NAME_CASE (h_name, h_aliases)
}, const char *name, int af)
DB_LOOKUP (hostbyaddr, ,,