This is a discussion on Problem with getnameinfo and IPv6 on HPUX-11.11 - HP UX ; I'm running: "HP-UX glade B.11.11 U 9000/800 unknown" I can look up IPv6 names with getaddrinfo(), but getnameinfo() is failing. This C++ test program: #include #include #include #include int main (int argc, char**argv) { sockaddr_in6 sin6; int err = inet_pton ...
I'm running: "HP-UX glade B.11.11 U 9000/800 unknown"
I can look up IPv6 names with getaddrinfo(), but getnameinfo() is
failing. This C++ test program:
#include
#include
#include
#include
int main (int argc, char**argv) {
sockaddr_in6 sin6;
int err = inet_pton (AF_INET6,
"2001:470:1f00:1056:202:b3ff:fe1d:b515",
&sin6.sin6_addr);
printf ("inet_pton() returned %d\n", err);
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(0);
sin6.sin6_flowinfo = 0;
sin6.sin6_scope_id = 0;
char hostbuf[NI_MAXHOST];
int flags = NI_NAMEREQD;
err = getnameinfo (reinterpret_cast(&sin6),
sizeof (sin6),
hostbuf,
sizeof (hostbuf),
0,
0,
flags);
printf ("getnameinfo() returned %d (%s)\n", err, gai_strerror
(err));
}
prints:
inet_pton() returned 1
getnameinfo() returned 8 (host nor service provided, or not known)
The address translates fine from the command line:
glade:test$ nslookup -type=ptr
5.1.5.b.d.1.e.f.f.f.3.b.2.0.2.0.6.5.0.1.0.0.f.1.0. 7.4.0.1.0.0.2.ip6.arpa.
Using /etc/hosts on: glade
looking up FILES
Trying DNS
Non-authoritative answer:
5.1.5.b.d.1.e.f.f.f.3.b.2.0.2.0.6.5.0.1.0.0.f.1.0. 7.4.0.1.0.0.2.ip6.arpa
name = kohaku.sarna.org
so I know it's a good address, and I know IPv6 is enabled on the box.
This works on my linux and solaris systems. Does anybody have any idea
what might be going wrong?