thanks for martin's sleuthing i think i understand what might be going
on here.

the getaddrinfo() call was being given an AF_UNSPEC hint which meant
that either a IPv4 or IPv6 address was acceptable.  since the machines
had IPv6 interfaces.. getaddrinfo was return the IPv6 interfaces. 
that's ok.

but when a person went to connect to the IPv6 address to get the XML...
the call to inet_ntop also had AF_INET hardcoded as the first parameter.

given that the address is really an AF_INET6 inet_ntop would fail giving
us the address 0.0.0.0.

i have a question though... where you putting in the hostname or IP
address?  i suspect you were putting in the hostname and when gmond
resolved the name it got an IPv6 address.  can you try running gmond
explicitly stating an IPv4 address?

-matt



On Wed, 2004-06-09 at 01:58, Martin Knoblauch wrote:
> Hi Matt,
> 
>   please have a look at the appended diff. Basically, I have just
> changed all "family hints" from AF_UNSPEC to AF_INET (IPv4). After this
> change the "0.0.0.0" problem went away. Apparently Solaris ( and
> Mac/OS) do IPv6 first if  AF_UNSPEC is given in a call to "socket". I
> have not checked, which of the modifications actually did it for me.
> 
>  I am not sure how this will behave on a system that does only IPv6.
> Unfortunatelly I have no chance to test it. Likely/hopefully it will
> just "do the right thing".
> 
>  Also, for local communication my change will/may prevent to use of
> UNIX type sockets.
> 
>  Again, this may not be the solution. It just hints on why the family
> was set to IPv6. The proper solution is to handle the IPv6 case right
> in gmond/server.c. On the other hand, that kind of detail does not
> belong there (IMO).
> 
> Cheers
> Martin
> 
> bash-2.03$ diff -ur monitor-core monitor-core-ipv4
> diff -ur monitor-core/libunp/getaddrinfo.c
> monitor-core-ipv4/libunp/getaddrinfo.c
> --- monitor-core/libunp/getaddrinfo.c   2004-02-26 01:36:31.000000000
> +0100
> +++ monitor-core-ipv4/libunp/getaddrinfo.c      2004-06-09
> 10:24:30.343275000 +0200
> @@ -31,7 +31,7 @@
> 
>         if (hintsp == NULL) {
>                 bzero(&hints, sizeof(hints));
> -               hints.ai_family = AF_UNSPEC;
> +               hints.ai_family = AF_INET;
>         } else
>                 hints = *hintsp;                /* struct copy */
> 
> Only in monitor-core-ipv4/libunp: getaddrinfo.c-org
> diff -ur monitor-core/libunp/tcp_connect.c
> monitor-core-ipv4/libunp/tcp_connect.c
> --- monitor-core/libunp/tcp_connect.c   2004-04-30 20:02:31.000000000
> +0200
> +++ monitor-core-ipv4/libunp/tcp_connect.c      2004-06-09
> 10:25:50.630798000 +0200
> @@ -8,7 +8,7 @@
>         struct addrinfo hints, *res, *ressave;
> 
>         bzero(&hints, sizeof(struct addrinfo));
> -       hints.ai_family = AF_UNSPEC;
> +       hints.ai_family = AF_INET;
>         hints.ai_socktype = SOCK_STREAM;
> 
>         if ( (n = getaddrinfo(host, serv, &hints, &res)) != 0)
> diff -ur monitor-core/libunp/tcp_listen.c
> monitor-core-ipv4/libunp/tcp_listen.c
> --- monitor-core/libunp/tcp_listen.c    2004-04-30 20:02:31.000000000
> +0200
> +++ monitor-core-ipv4/libunp/tcp_listen.c       2004-06-09
> 10:27:25.688425000 +0200
> @@ -10,7 +10,7 @@
> 
>         bzero(&hints, sizeof(struct addrinfo));
>         hints.ai_flags = AI_PASSIVE;
> -       hints.ai_family = AF_UNSPEC;
> +       hints.ai_family = AF_INET;
>         hints.ai_socktype = SOCK_STREAM;
> 
>         if ( (n = getaddrinfo(host, serv, &hints, &res)) != 0)
> diff -ur monitor-core/libunp/udp_client.c
> monitor-core-ipv4/libunp/udp_client.c
> --- monitor-core/libunp/udp_client.c    2004-04-30 20:02:31.000000000
> +0200
> +++ monitor-core-ipv4/libunp/udp_client.c       2004-06-09
> 10:30:56.898624000 +0200
> @@ -8,7 +8,7 @@
>         struct addrinfo hints, *res, *ressave;
> 
>         bzero(&hints, sizeof(struct addrinfo));
> -       hints.ai_family = AF_UNSPEC;
> +       hints.ai_family = AF_INET;
>         hints.ai_socktype = SOCK_DGRAM;
> 
>         if ( (n = getaddrinfo(host, serv, &hints, &res)) != 0)
> diff -ur monitor-core/libunp/udp_connect.c
> monitor-core-ipv4/libunp/udp_connect.c
> --- monitor-core/libunp/udp_connect.c   2004-04-30 20:02:31.000000000
> +0200
> +++ monitor-core-ipv4/libunp/udp_connect.c      2004-06-09
> 10:28:37.311607000 +0200
> @@ -8,7 +8,7 @@
>         struct addrinfo hints, *res, *ressave;
> 
>         bzero(&hints, sizeof(struct addrinfo));
> -       hints.ai_family = AF_UNSPEC;
> +       hints.ai_family = AF_INET;
>         hints.ai_socktype = SOCK_DGRAM;
> 
>         if ( (n = getaddrinfo(host, serv, &hints, &res)) != 0)
> diff -ur monitor-core/libunp/udp_server.c
> monitor-core-ipv4/libunp/udp_server.c
> --- monitor-core/libunp/udp_server.c    2004-04-30 20:02:31.000000000
> +0200
> +++ monitor-core-ipv4/libunp/udp_server.c       2004-06-09
> 10:29:55.422103000 +0200
> @@ -9,7 +9,7 @@
> 
>         bzero(&hints, sizeof(struct addrinfo));
>         hints.ai_flags = AI_PASSIVE;
> -       hints.ai_family = AF_UNSPEC;
> +       hints.ai_family = AF_INET;
>         hints.ai_socktype = SOCK_DGRAM;
> 
>         if ( (n = getaddrinfo(host, serv, &hints, &res)) != 0)
> 
> 
> 
> 
> 
> =====
> ------------------------------------------------------
> Martin Knoblauch
> email: k n o b i AT knobisoft DOT de
> www:   http://www.knobisoft.de
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: GNOME Foundation
> Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
> GNOME Users and Developers European Conference, 28-30th June in Norway
> http://2004/guadec.org
> _______________________________________________
> Ganglia-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ganglia-developers
-- 
PGP fingerprint 'A7C2 3C2F 8445 AD3C 135E F40B 242A 5984 ACBC 91D3'

   They that can give up essential liberty to obtain a little 
      temporary safety deserve neither liberty nor safety. 
  --Benjamin Franklin, Historical Review of Pennsylvania, 1759

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to