[X2Go-Dev] [X2Go-User] "connectedHost" variable contains wrong IP, reason unknown
Mike
bellyacres at gmail.com
Thu Jun 12 01:04:01 CEST 2014
On 06/11/2014 05:46 PM, Stefan Baur wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Package: x2goagent
> severity: normal
> version: 3.5.0.24
>
> Note: Crossposting and Reply-To'ing to X2Go-Dev due to the need for a
> C/C++ coder, also, turning it into a bug so we can keep track of this.
>
> Here's the output the user gets as the connection refuses to establish
> itself:
>
> quoting Sebastien Chabrolles:
>
>> running as X2Go Agent
>>
>> NXAGENT - Version 3.5.0
>>
>> Copyright (C) 2001, 2011 NoMachine. See http://www.nomachine.com/
>> for more information.
>>
>> Info: Agent running with pid '24808'. Session: Starting session at
>> 'Sat Jun 7 15:37:37 2014'. Info: Proxy running in server mode with
>> pid '24808'. Info: Waiting for connection from 'localhost' on port
>> '30003'. Warning: Refusing connection from '225.3.10.80'. .80' on
>> port '30003'. I don't know what is this IP address !!!!!
> And at a later attempt, Sebastien received this output:
>> running as X2Go Agent
>>
>>
>> NXAGENT - Version 3.5.0
>>
>>
>> Copyright (C) 2001, 2011 NoMachine.
>> See http://www.nomachine.com/ for more information.
>>
>>
>> Info: Agent running with pid '10710'.
>> Session: Starting session at 'Wed Jun 11 23:02:09 2014'.
>> Info: Proxy running in server mode with pid '10710'.
>> Info: Waiting for connection from 'localhost' on port '30006'.
>> Warning: Refusing connection from '141.168.10.80'.
>> Info: Aborting the procedure due to signal '1'.
>> Error: Aborting session with 'Unable to open display
>> 'nx/nx,options=/root/.x2go/C-root-51-1402520526_stRWWWBROWSER_dp24/options:51''.
>> Session: Aborting session at 'Wed Jun 11 23:02:19 2014'.
>> Session: Session aborted at 'Wed Jun 11 23:02:19 2014'.
>
> My first guess is/was that there's something endianess-related going
> wrong, as he's running X2Go on a ppc64 architecture instead of x86/x64.
> However, the fact that the two "wrong" IPs change at random speak
> against that, so I may be totally wrong with this and there's a much
> simpler reason and solution.
>
> quoting myself, replying to Mike Gabriel there:
>
>>> Do you think you could at least give him a hint as to where that
>>> message is pulling the IP from and how it is being
>>> mangled/processed before that?
>>>
>>> My guess is that there's some self-made conversion routine
>>> somewhere that only works on little-endian architectures like x86
>>> and x64.
>>>
>>> PPC64 is big-endian by default.
>
> quoting Mike Gabriel:
>
>> you can get the nx-libs sources from git.x2go.org [1] and grep
>> through the sources.
>>
>> I am currently doing the same to get NX fixed on systems with
>> poly-instantiated /tmp directories.
> Here's what I was able to find out so far:
>
> I was able to locate the message in Loop.cpp.
> It uses the variable "connectedHost".
> So "connectedHost" contains the wrong IP.
>
> connectedHost gets populated (also in Loop.cpp) like this:
>
> char *connectedHost = inet_ntoa(newAddr.sin_addr);
>
> so either newAddr.sin_addr already contains a wrong value (I'm not sure
> how to check that, though), or inet_ntoa does something wrong, or both.
>
> I haven't touched C/C++ code since the year 2002 or so, so debugging
> this further is way beyond my ken.
>
> Any one of the more experienced coders willing to jump in?
>
>
> Here's some more info about the X2Go server system as provided by
> Sebastien Chabrolles:
>
> # cat /etc/hosts
> 127.0.0.1 localhost localhost.localdomain localhost4
> localhost4.localdomain4
> ::1 localhost localhost.localdomain localhost6
> localhost6.localdomain6
> 10.7.19.161 fc20-161
>
> # cat /etc/resolv.conf
> nameserver 129.35.160.4
>
> #cat /etc/nsswitch.conf
> passwd: files
> shadow: files
> group: files
> ###
> #this strange-looking entry was present during the first tries.
> #
> #hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname
> #
> # it was changed to the one below for the last try, which gave
> # the result with the different, but still wrong, IP.
> ###
> hosts: files dns
> bootparams: nisplus [NOTFOUND=return] files
> ethers: files
> netmasks: files
> networks: files
> protocols: files
> rpc: files
> services: files
> netgroup: files
> publickey: nisplus
> automount: files
> aliases: files nisplus
>
> # ifconfig -a
> eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
> inet 10.7.19.161 netmask 255.255.255.0 broadcast 10.7.19.255
>
> inet6 fe80::f816:3eff:feec:ecb8 prefixlen 64 scopeid
> 0x20<link>
> ether fa:16:3e:ec:ec:b8 txqueuelen 1000 (Ethernet)
>
> RX packets 90677 bytes 5717673 (5.4 MiB)
>
> RX errors 0 dropped 0 overruns 0 frame 0
> TX packets 89102 bytes 32828059 (31.3 MiB)
> TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
>
> lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
> inet 127.0.0.1 netmask 255.0.0.0
> inet6 ::1 prefixlen 128 scopeid 0x10<host>
> loop txqueuelen 0 (Local Loopback)
> RX packets 76 bytes 5248 (5.1 KiB)
> RX errors 0 dropped 0 overruns 0 frame 0
> TX packets 76 bytes 5248 (5.1 KiB)
> TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
>
>
> # route -n
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref
> Use Iface
> 0.0.0.0 10.7.19.254 0.0.0.0 UG 0 0
> 0 eth0
> 10.7.19.0 0.0.0.0 255.255.255.0 U 0 0
> 0 eth0
> 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0
> 0 eth0
>
>
> - -Stefan
I'm far from being any type of coder. Looks like it could be an endian
issue though.
inet_aton() converts the Internet host address cp from the IPv4
numbers-and-dots notation into binary form (in network byte order) and
stores it in the structure that inp points to.
http://linux.die.net/man/3/inet_ntoa
Mike
More information about the x2go-dev
mailing list