Subject: Bug#515: [X2Go-Dev] [X2Go-User] "connectedHost" variable contains wrong IP, reason unknown

From: Mihai Moldovan <[email-masked]>
Date: Fri, 13 Jun 2014 18:15:27 +0200

* On 12.06.2014 09:48 pm, Mihai Moldovan wrote:
>> For the connection, I use IPV4 addresse, no hostname. There is only one IP on
>> the server.
> OK. I was asking because the code is calling gethostbyname() which, when given a
> host name, looks up the address of that specified host name. If, however, the
> host name should have multiple addresses, all of them will be returned in a list
> -- their order depending on how the DNS server spits them out. Most DNS servers
> use a round-robin method for this, so you will get a different ordering with
> each lookup.
>
> That was one possible explanation for what you might have experienced.
>
> However, if you're only using IP addresses directly everywhere, gethostbyname()
> merely converts the given string to its binary address representation in network
> byte order. Thus, the functionality is almost equal to inet_aton() (just the way
> the information is returned differs, but that's no functional change.)

Follow-up: I've written a simple program to look up hosts using the OS-provided
functions getaddrinfo() and inet_ntop(). If you (Sebastien) are interested, take
a look in /usr/src/domainlookup, although it's really boring.

Output for "./getaddrinfo localhost 127.0.0.1 loopback":

### information for localhost ###
addr 1: 127.0.0.1 (length 9)
addr 2: 127.0.0.1 (length 9)
addr 3: 127.0.0.1 (length 9)
addr 4: 127.0.0.1 (length 9)
addr 5: 127.0.0.1 (length 9)
addr 6: 127.0.0.1 (length 9)

### information for 127.0.0.1 ###
addr 1: 127.0.0.1 (length 9)
addr 2: 127.0.0.1 (length 9)
addr 3: 127.0.0.1 (length 9)

### information for loopback ###

Thus, it doesn't look like a system issue. The returned addresses are just fine.
Even if something WERE to convert 127.0.0.1 to "localhost" and back to an
address, the address list for localhost is fine and does not contain the unknown
addresses.

Seems like we're really seeing an nx bug on ppc64.

I'll supply more information later when I get back.

Mihai