"cliff" <[EMAIL PROTECTED]> writes:

> Thanks for the reply. I somewhat agree with you and will post a
> question to fedora but my concern is that curl also uses getaddrinfo
> and once I disabled IPv6, curl began working. It's as if wget is
> defaulting getaddrinfo's ai_family to PF_INET6 and never attempting
> PF_INET.

Wget sets ai_family to AF_UNSPEC and sorts the resulting addresses in
order to prefer IPv4 addresses (which can be changed using
--prefer-family).  It won't set ai_family to a specific address unless
-4/-6 is used.  You might want to check that /etc/wgetrc or a similar
file doesn't contain ipv4_only or ipv6_only.

If that checks out okay, try compiling this program on your system;
see if running it with the argument "www.yahoo.com" produces success
or failure, and if the failure is the same one as produced by Wget.

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>

int main (int argc, char **argv)
{
  int err;
  struct addrinfo hints, *res;
  const char *host = argv[1];
  if (argc != 2)
    return 2;

  memset (&hints, 0, sizeof hints);
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_family = AF_UNSPEC;
  err = getaddrinfo (host, NULL, &hints, &res);

  if (err != 0 || res == NULL)
    printf ("failed resolving %s: %s.\n",
            host, err != EAI_SYSTEM ? gai_strerror (err) : strerror (errno));
  else
    printf ("success\n");

  return 0;
}

Reply via email to