Thomas Lussnig <[EMAIL PROTECTED]> writes:

> i'm building an IPv6 patch for wget. And i'm worried about the point
> that i have to add 12 in the sockaddr.

Perhaps it would help if you created a "minimal" test case for the
problem you're witnessing.  For example:

#include <stdio.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>

#include <netdb.h>

int
main (int argc, char **argv)
{
  char *host = argv[1];
  struct addrinfo *ai_head, *ai;

  int err = getaddrinfo (host, NULL, NULL, &ai_head);
  if (err != 0)
    return err;

  for (ai = ai_head; ai; ai = ai->ai_next)
    {
      char buf[128];
      struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)ai->ai_addr;

      if (!inet_ntop (AF_INET6, &sa6->sin6_addr, buf, sizeof (buf)))
        {
          perror ("inet_ntop");
          continue;
        }
      puts (buf);
    }
  return 0;
}

Compile this.  For me it seems to work correctly:

$ ./a.out www.ipv6.euronet.be
3ffe:8100:200:2::2
3ffe:8100:200:2::2
3ffe:8100:200:2::2
::57.0.0.0
::57.0.0.0
::9.11.0.0

The first three IP addresses seem to be correct (I remember them from
your logs).  So adding 12 does not appear to be necessary on my
system.

Does the same test work for you?

Reply via email to