Xvnc and -localhost revisited

Jon Maltz jmaltz "at" nema.com
Fri, 11 Aug 2000 18:03:02 +0000


I've seen this in the archives, but didn't find anything approaching a
solution.  I'm running vnc-3.3.3r1 (from the FreeBSD ports directory) on
FreeBSD 4.1-RELEASE, also duplicated on a fresh install of 4.0-RELEASE.
When I run vncserver :12 it works fine, as everyone knows, if I append
-localhost it doesn't, but everything in ~/.vnc/xstartup executes.

So I ran it without -localhost, did ps auxww to get the full Xvnc startup
line, and ran it manually.  The results without -localhost:

Xvnc :12 -desktop X -httpd /usr/local/vnc/classes -auth
/home/someuser/.Xauthority -geometry 1024x768 -depth 8 -rfbwait 120000
-rfbauth /home/someuser/.vnc/passwd -rfbport 5912

11/08/00 11:19:19 Xvnc version 3.3.3r1
11/08/00 11:19:19 Copyright (C) AT&T Laboratories Cambridge.
11/08/00 11:19:19 All Rights Reserved.
11/08/00 11:19:19 See http://www.uk.research.att.com/vnc for information on
VNC
11/08/00 11:19:19 Desktop name 'X' (some.domain.com:12)
11/08/00 11:19:19 Protocol version supported 3.3
11/08/00 11:19:19 Listening for VNC connections on TCP port 5912
11/08/00 11:19:19 Listening for HTTP connections on TCP port 5812
11/08/00 11:19:19   URL http://some.domain.com:5812

And if I killed it, and ran it with -localhost: 

Xvnc :12 -desktop X -httpd /usr/local/vnc/classes -auth
/home/someuser/.Xauthority -geometry 1024x768 -depth 8 -rfbwait 120000
-rfbauth /home/someuser/.vnc/passwd -rfbport 5912 -localhost

11/08/00 11:20:10 Xvnc version 3.3.3r1
11/08/00 11:20:10 Copyright (C) AT&T Laboratories Cambridge.
11/08/00 11:20:10 All Rights Reserved.
11/08/00 11:20:10 See http://www.uk.research.att.com/vnc for information on
VNC
11/08/00 11:20:10 Desktop name 'X' (some.domain.com:12)
11/08/00 11:20:10 Protocol version supported 3.3
11/08/00 11:20:10 Listening for VNC connections on TCP port 5912
11/08/00 11:20:10 ListenOnTCPPort: Can't assign requested address

I can tell something like socks5 to bind to 127.0.0.1 without issue.
Looking through the source code I see something that's supposed to be
handling BSD style localhost in Xvnc/lib/xtrans/Xtransutil.c starting
around line 104

        /*  
         * Check for the BSD hack localhost address 127.0.0.1.
         * In this case, we are really FamilyLocal.
         */
            
        struct sockaddr_in saddr;
#ifdef CRAY
#ifdef OLDTCP
        int len = sizeof(saddr.sin_addr);
#else
        int len = SIZEOF_in_addr;   
#endif /* OLDTCP */
        char *cp = (char *) &saddr.sin_addr;   
#else /* else not CRAY */
        int len = sizeof(saddr.sin_addr.s_addr);
        char *cp = (char *) &saddr.sin_addr.s_addr;
#endif /* CRAY */

        memcpy (&saddr, *addrp, sizeof (struct sockaddr_in));

        if ((len == 4) && (cp[0] == 127) && (cp[1] == 0) &&
            (cp[2] == 0) && (cp[3] == 1))
        {
            *familyp=FamilyLocal;
        }
        else
        {
            *familyp=FamilyInternet;
            *addrlenp=len;
            memcpy(*addrp,&saddr.sin_addr,len);
        }

Could the problem lie in here, or is that just a red herring?

Jon
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at" uk.research.att.com
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------