Subject: gethostbyname prob
To: None <netbsd-users@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: netbsd-users
Date: 06/26/2002 17:32:05
It seems I don't understand struct hostent which has
char **h_addr_list; /* list of addresses from name server */
(gdb) print h->h_addr_list
$9 = (char **) 0x48103180
(gdb) x/16x 0x48103180
0x48103180 <__curbrk+27240>: 0x481032fc 0x00000000 0x00000000 0x00000000
0x48103190 <__curbrk+27256>: 0x00000000 0x00000000 0x00000000 0x00000000
0x481031a0 <__curbrk+27272>: 0x00000000 0x00000000 0x00000000 0x00000000
0x481031b0 <__curbrk+27288>: 0x00000000 0x00000000 0x00000000 0x00000000
(gdb) x/16x 0x481032fc
0x481032fc <__curbrk+27620>: 0x7e5d3cc1 0x006b752e 0x656d6f68 0x6e6f0000
0x4810330c <__curbrk+27636>: 0x00000000 0x00000000 0x00000000 0x00000000
0x4810331c <__curbrk+27652>: 0x00000000 0x00000000 0x00000000 0x00000000
0x4810332c <__curbrk+27668>: 0x00000000 0x00000000 0x00000000 0x00000000
In went gethostbyname2 with a host with 2 ipnumbers. Out comes the above.
0x7e5d3cc1 is the correct first ip number, but the second should look like
0xb1cc6f83 (this is on i386) but I can't see it anywhere! There really seems
to be just the one entry in h_addr_list. Is that right, or am I missing
something?
Cheers,
Patrick