summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorZac Medico <zmedico@gmail.com>2016-08-14 18:19:02 -0700
committerZac Medico <zmedico@gentoo.org>2016-08-14 18:28:19 -0700
commitcdd81bd479e228724ef03bf94c42a34feb42145a (patch)
tree70c6c85d376e9beef9e3b76c8982ba3c5f9143f9 /libvncserver
parent1f8c443cbc439e79d9e2c8b92643b65b7332db89 (diff)
downloadlibtdevnc-cdd81bd479e228724ef03bf94c42a34feb42145a.tar.gz
libtdevnc-cdd81bd479e228724ef03bf94c42a34feb42145a.zip
Support autoPort with ipv4 or ipv6 disabled
Make it possible to get autoPort behavior with either ipv4 or ipv6 disabled, by setting rfbScreen->ipv6port or rfbScreen->port to a negative number. This will make it possible for x11vnc to enforce its -noipv6 option, as discussed in the following bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672449
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/sockets.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c
index 51e86eb..6467b1c 100644
--- a/libvncserver/sockets.c
+++ b/libvncserver/sockets.c
@@ -155,10 +155,10 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
return;
}
- if(rfbScreen->autoPort) {
- int i;
- FD_ZERO(&(rfbScreen->allFds));
+ FD_ZERO(&(rfbScreen->allFds));
+ if(rfbScreen->autoPort && rfbScreen->port>0) {
+ int i;
rfbLog("Autoprobing TCP port \n");
for (i = 5900; i < 6000; i++) {
if ((rfbScreen->listenSock = rfbListenOnTCPPort(i, iface)) >= 0) {
@@ -175,8 +175,11 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
rfbLog("Autoprobing selected TCP port %d\n", rfbScreen->port);
FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds));
rfbScreen->maxFd = rfbScreen->listenSock;
+ }
#ifdef LIBVNCSERVER_IPv6
+ if(rfbScreen->autoPort && rfbScreen->ipv6port>0) {
+ int i;
rfbLog("Autoprobing TCP6 port \n");
for (i = 5900; i < 6000; i++) {
if ((rfbScreen->listen6Sock = rfbListenOnTCP6Port(i, rfbScreen->listen6Interface)) >= 0) {
@@ -193,12 +196,11 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
rfbLog("Autoprobing selected TCP6 port %d\n", rfbScreen->ipv6port);
FD_SET(rfbScreen->listen6Sock, &(rfbScreen->allFds));
rfbScreen->maxFd = rfbMax((int)rfbScreen->listen6Sock,rfbScreen->maxFd);
-#endif
}
- else
- {
+#endif
+
+ if(!rfbScreen->autoPort) {
if(rfbScreen->port>0) {
- FD_ZERO(&(rfbScreen->allFds));
if ((rfbScreen->listenSock = rfbListenOnTCPPort(rfbScreen->port, iface)) < 0) {
rfbLogPerror("ListenOnTCPPort");