diff options
Diffstat (limited to 'unix/xserver')
-rw-r--r-- | unix/xserver/hw/vnc/Xvnc.man | 4 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/vncExtInit.cc | 13 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/xvnc.cc | 22 |
3 files changed, 33 insertions, 6 deletions
diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man index 865d408e..356925df 100644 --- a/unix/xserver/hw/vnc/Xvnc.man +++ b/unix/xserver/hw/vnc/Xvnc.man @@ -48,6 +48,10 @@ next three green, and the least significant three represent red), the default for depth 16 is RGB565 and for depth 24 is RGB888. .TP +.B \-interface \fIIP address\fP or \-i \fIIP address\fP +Listen on interface. By default Xvnc listens on all available interfaces. + +.TP .B \-cc 3 As an alternative to the default TrueColor visual, this allows you to run an Xvnc server with a PseudoColor visual (i.e. one which uses a color map or diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index 0364adc4..36948681 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -72,6 +72,7 @@ extern "C" { pointer args); extern char *display; + extern char *listenaddr; } using namespace rfb; @@ -223,22 +224,24 @@ void vncExtensionInit() if (network::TcpSocket::isSocket(vncInetdSock) && !network::TcpSocket::isConnected(vncInetdSock)) { - listener = new network::TcpListener(0, 0, vncInetdSock, true); + listener = new network::TcpListener(NULL, 0, 0, vncInetdSock, true); vlog.info("inetd wait"); } } else { int port = rfbport; if (port == 0) port = 5900 + atoi(display); port += 1000 * scr; - listener = new network::TcpListener(port, localhostOnly); - vlog.info("Listening for VNC connections on port %d",port); + listener = new network::TcpListener(listenaddr, port, localhostOnly); + vlog.info("Listening for VNC connections on %s interface(s), port %d", + listenaddr == NULL ? "all" : listenaddr, port); CharArray httpDirStr(httpDir.getData()); if (httpDirStr.buf[0]) { port = httpPort; if (port == 0) port = 5800 + atoi(display); port += 1000 * scr; - httpListener = new network::TcpListener(port, localhostOnly); - vlog.info("Listening for HTTP connections on port %d",port); + httpListener = new network::TcpListener(listenaddr, port, localhostOnly); + vlog.info("Listening for HTTP connections on %s interface(s), port %d", + listenaddr == NULL ? "all" : listenaddr, port); } } diff --git a/unix/xserver/hw/vnc/xvnc.cc b/unix/xserver/hw/vnc/xvnc.cc index 1fe3473c..62564d32 100644 --- a/unix/xserver/hw/vnc/xvnc.cc +++ b/unix/xserver/hw/vnc/xvnc.cc @@ -164,6 +164,8 @@ static bool displaySpecified = false; static bool wellKnownSocketsCreated = false; static char displayNumStr[16]; +char *listenaddr = NULL; + static void vfbInitializePixmapDepths(void) @@ -284,6 +286,7 @@ ddxUseMsg() ErrorF("-depth D set screen 0's depth\n"); ErrorF("-pixelformat fmt set pixel format (rgbNNN or bgrNNN)\n"); ErrorF("-inetd has been launched from inetd\n"); + ErrorF("-interface IP_address listen on specified interface\n"); ErrorF("\nVNC parameters:\n"); fprintf(stderr,"\n" @@ -306,7 +309,7 @@ static bool displayNumFree(int num) { try { - network::TcpListener l(6000+num); + network::TcpListener l(NULL, 6000+num); } catch (rdr::Exception& e) { return false; } @@ -544,6 +547,23 @@ ddxProcessArgument(int argc, char *argv[], int i) return 1; } + + if (strcmp(argv[i], "-interface") == 0 || + strcmp(argv[i], "-i") == 0) { + if (++i >= argc) { + UseMsg(); + return 2; + } + + if (listenaddr != NULL) /* Only first -interface is valid */ + return 2; + + listenaddr = strdup(argv[i]); + if (listenaddr == NULL) + FatalError("Not enough memory"); + + return 2; + } if (rfb::Configuration::setParam(argv[i])) return 1; |