Subject: Bug#515: X2Go issue (in src:nx-libs) has been marked as closed

From: Mike Gabriel <[email-masked]>
Date: Mon, 30 Jun 2014 14:24:39 +0200 (CEST)

close #515
thanks

Hello,

we are very hopeful that X2Go issue #515 reported by you
has been resolved in the new release (2:3.5.0.25) of the
X2Go source project »src:nx-libs«.

You can view the complete changelog entry of src:nx-libs (2:3.5.0.25)
below, and you can use the following link to view all the code changes
between this and the last release of src:nx-libs.

    http://code.x2go.org/gitweb?p=nx-libs.git;a=commitdiff;h=8d4317e7e4fccbe6906c5ba57b8d0101868f92f3;hp=460a3cb3911bbfb717d0259947fe05f68d964948

If you feel that the issue has not been resolved satisfyingly, feel
free to reopen this bug report or submit a follow-up report with
further observations described based on the new released version
of src:nx-libs.

Thanks a lot for contributing to X2Go!!!

light+love
X2Go Git Admin (on behalf of the sender of this mail)

---
X2Go Component: src:nx-libs
Version: 2:3.5.0.25-0x2go1
Status: RELEASE
Date: Mon, 30 Jun 2014 14:05:46 +0200
Fixes: 40 339 490 504 505 515 516
Changes: 
 nx-libs (2:3.5.0.25-0x2go1) RELEASED; urgency=low
 .
   [ Mihai Moldovan ]
   * Add 029_nxcomp_ppc64.full+lite.patch. Fix sockaddr handling on
     Big Endian systems (like PPC64). (Fixes: #515).
   * Add 057_nx-X11_sanitize-eventmasks.full.patch. Fix
     failures in session windows coming up on Big Endian systems
     like PPC64. (Fixes: #516).
   * Improve 105_nxagent_export-remote-keyboard-config.full.patch.
     Don't print out nonsensical information, if there really was
     no error when creating the keyboard file or the other way around.
     Also add the reason when failing to create the keyboard file.
     Only print an error message if SessionPath *really* is not defined.
   * Improve 028_nx-X11_abstract-kernel-sockets.full.patch. Make it more
     Big Endian robust by assigning correct types for socklen_t objects.
   * Add 990_fix-DEBUG-and-TEST-builds.full.patch. Fix debug builds (e.g.
     when globally setting -DDEBUG and -DTEST at build time).
 .
   [ Nito Martínez ]
   * Add 212_nxcomp_build-on-Android.patch. Fix FTBFS of nxproxy/nxcomp when
     build against the Android system. (Fixes: #339).
 .
   [ Oleksandr Shneyder ]
   * Add 210_nxagent_nxcomp_save_session_state.full+lite.patch. Save session
     state in path specified by "state" option in agent options file. If
     option is omitted, session state will not be saved. Session states are:
     STARTING, RUNNING, SUSPENDING, SUSPENDED, RESUMING, TERMINATING,
     TERMINATED.
   * Add 211_nxcomp_set_default_options.full+lite.patch. Set default arguments
     for options 'link' and 'pack' to avoid session damage by resuming with
     incorrect options file.
 .
   [ Mike Gabriel ]
   * Add 606_nx-X11_build-on-aarch64.full.patch. Build on aarch64
     architectures. (Fixes: #490).
   * Add 027_nxcomp_abstract-X11-socket.full+lite.patch. In proxy mode "server"
     let NX proxy attempt connecting to the abstract X11 socket first, and only
     fallback to the file system socket, if the abstract socket is not
     available. (Fixes: #505).
   * Add 028_nx-X11_abstract-kernel-sockets.full.patch. Provide abstract local
     socket support for Linux based systems. This patch pulls in abstract
     socket relevant code from xtrans 1.2.7. (Fixes: #504).
   * Add 302_nx-X11_xkbbasedir-detection.patch. For detecting XkbBaseDir
     test for xkb/rules/base instead of testing for deprecated file
     xkb/keymap.dir. (Fixes: #40).
   * Add 206_nxagent_clipboard-as-nxoption.full.patch. Make the clipboard
     option configurable in nxagent via NX options as addition to the
     command line parameter -clipboard. Note that the command line
     parameter overrides the clipboard NX option. Possible values are
     both or 1, client, server, none or 0.
 .
   * Update patches, to make them apply cleanly after above changes:
     + 220_nxproxy-bind-loopback-only.full+lite.patch
     + 016_nx-X11_install-location.debian.patch
     + 056_nx-X11-Werror-format-security.full.patch
     + 108_nxagent_wine-close-delay.full.patch
     + 300_nxagent_set-wm-class.full.patch
     + 320_nxagent_configurable-keystrokes.full.patch
 .
   * Rename patches to match our naming scheme:
     + 008_nxcomp_sa-restorer.full+lite.patch
     + 009_nxagent_add-man-page.full.patch
     + 009_nxproxy_add-man-page.full+lite.patch
     + 056_nx-X11_Werror-format-security.full.patch
     + 209_x2goagent_add-man-page.full.patch
     + 220_nxproxy_bind-loopback-only.full+lite.patch

---

From: [email-masked] (X2Go Bug Tracking System)
Date: Mon, 30 Jun 2014 12:30:01 +0000

This is an automatic notification regarding your Bug report
which was filed against the x2goagent package:

#515: "connectedHost" variable contains wrong IP, reason unknown (was: Re: [X2Go-User] Pb with x2go agent on ppc64 system)

It has been closed by Mike Gabriel <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Mike Gabriel <[email-masked]> by
replying to this email.

-- 
X2Go Bug Tracking System
Contact [email-masked] with problems

Subject: X2Go issue (in src:nx-libs) has been marked as closed
From: Mike Gabriel <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Mon, 30 Jun 2014 14:24:39 +0200 (CEST)

close #515
thanks

Hello,

light+love

---

Subject: "connectedHost" variable contains wrong IP, reason unknown (was: Re: [X2Go-User] Pb with x2go agent on ppc64 system)
From: Stefan Baur <[email-masked]>
To: Mike Gabriel <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], sebastien chabrolles <[email-masked]>
Date: Wed, 11 Jun 2014 23:46:08 +0200

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