This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hello again,
I have a problem with name lookups in InetAddress, and this one I don't
think I can solve myself.
Linux 2.2.5, glibc 2.0.7 (rpm says: glibc-2.0.7-19)
For all names not in my local /etc/hosts file I get an
UnknownHostException, even though the lookup seems to have returned
something useful. The following fails:
InetAddress ia;
ia = InetAddress.getByName("www.svenskatest.se");
System.err.println("ia: " + ia);
Adding some debug printouts to natInetAddress.cc
(line ~122, GETHOSTBYNAME_R_RETURNS_INT is defined)
fprintf(stderr, "%s %d\n", hostname, ok);
fprintf(stderr, "h_name: %s\n", hent_r.h_name);
fprintf(stderr, "h_aliases[0]: %s\n", hent_r.h_aliases[0]);
fprintf(stderr, "h_aliases[1]: %s\n", hent_r.h_aliases[1]);
fprintf(stderr, "h_addr_list[0]: %08x\n", hent_r.h_addr_list[0]);
fprintf(stderr, "h_addr_list[1]: %08x\n", hent_r.h_addr_list[1]);
fprintf(stderr, "hptr: %08x\n", hptr);
gives the following output:
www.svenskatest.se 0
h_name: (null)
h_aliases[0]: svtest
h_aliases[1]: (null)
h_addr_list[0]: bffff638
h_addr_list[1]: 00000000
hptr: 00000000
java.net.UnknownHostException: www.svenskatest.se
The real name of the machine is svtest.eisi.se, which is probably where it
got the svtest part from. It also shows that it did get an answer from
the dns.
Manually undefining GETHOSTBYNAME_R (forcing gethostbyname) makes the
lookups work.
Something known with gethostbyname_r and glibc 2.0.7 ?
/Urban
---
Urban Widmark urban@svenskatest.se
Svenska Test AB +46 90 71 71 23