Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2025 01:54:10 GMT
From:      Vladimir Druzenko <vvd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: ed48632461bd - main - emulators/virtualbox-ose{,-nox11}{,-legacy}: Fix listen VNC on TCP port on IPv6 address
Message-ID:  <202501050154.5051sAQI096136@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ed48632461bd9b3c095333c34040fe921673ab48

commit ed48632461bd9b3c095333c34040fe921673ab48
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2025-01-05 01:43:43 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-01-05 01:43:43 +0000

    emulators/virtualbox-ose{,-nox11}{,-legacy}: Fix listen VNC on TCP port on IPv6 address
    
    Four new options are available:
     - "VNCAddress4" -> IPv4 address to use
     - "VNCPort4" -> IPv4 Port to use
     - "VNCAddress6" -> IPv6 address to use
     - "VNCPort6" -> IPv6 port to use
    
    "TCP/Ports" is used for backward compatibility as IPv4 and IPv6 ports if
    "VNCPort4" or "VNCPort6" is not defined.
    
    Detailed description is here:
    https://www.virtualbox.org/browser/vbox/trunk/src/VBox/ExtPacks/VNC/VBoxVNC.cpp#L361
    
    PR:     193778
---
 emulators/virtualbox-ose-legacy/Makefile           |  2 +-
 .../files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp  | 67 ++++++++++++++++++++++
 emulators/virtualbox-ose-nox11-legacy/Makefile     |  2 +-
 emulators/virtualbox-ose-nox11/Makefile            |  2 +-
 emulators/virtualbox-ose/Makefile                  |  2 +-
 .../files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp  | 58 +++++++++++++++++++
 6 files changed, 129 insertions(+), 4 deletions(-)

diff --git a/emulators/virtualbox-ose-legacy/Makefile b/emulators/virtualbox-ose-legacy/Makefile
index eb9e45783125..6c0563b2759c 100644
--- a/emulators/virtualbox-ose-legacy/Makefile
+++ b/emulators/virtualbox-ose-legacy/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	virtualbox-ose
 DISTVERSION=	5.2.44
-PORTREVISION?=	23
+PORTREVISION?=	24
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
 		LOCAL/bofh/emulators/virtualbox-ose-legacy:docs
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp b/emulators/virtualbox-ose-legacy/files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp
new file mode 100644
index 000000000000..2039707a7fec
--- /dev/null
+++ b/emulators/virtualbox-ose-legacy/files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp
@@ -0,0 +1,67 @@
+--- src/VBox/ExtPacks/VNC/VBoxVNC.cpp.orig	2020-07-09 16:56:32 UTC
++++ src/VBox/ExtPacks/VNC/VBoxVNC.cpp
+@@ -45,7 +45,7 @@
+ 
+ #ifdef LIBVNCSERVER_IPv6
+ // enable manually!
+-// #define VBOX_USE_IPV6
++#define VBOX_USE_IPV6
+ #endif
+ 
+ 
+@@ -312,7 +312,7 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
+     else
+     {
+         const char szFeatName[] = "Property/TCP/Ports";
+-        const uint32_t featLen = sizeof(VRDEFEATURE) + RT_MAX(sizeof(VNC_PORTSSIZE), sizeof(szFeatName)) - 1;
++        const uint32_t featLen = sizeof(VRDEFEATURE) + RT_MAX(VNC_PORTSSIZE, sizeof(szFeatName)) - 1;
+         VRDEFEATURE *feature = (VRDEFEATURE *)RTMemTmpAlloc(featLen);
+         feature->u32ClientId = 0;
+         RTStrCopy(feature->achInfo, featLen - sizeof(VRDEFEATURE) + 1, szFeatName);
+@@ -421,7 +421,7 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
+ 
+     // get address
+     char *pszTCPAddress = (char *)RTMemTmpAllocZ(VNC_ADDRESS_OPTION_MAX);
+-    rc = instance->mCallbacks->VRDECallbackProperty(instance->mCallback,
++    int rc = instance->mCallbacks->VRDECallbackProperty(instance->mCallback,
+                                                     VRDE_QP_NETWORK_ADDRESS,
+                                                     pszTCPAddress,
+                                                     VNC_ADDRESS_OPTION_MAX,
+@@ -582,19 +582,35 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
+             pszServerAddress6 = szIPv6ListenAll;
+     }
+ 
+-    if (pszVNCPort4 && uServerPort4 == 0)
++    if (strlen(pszVNCPort4) > 0 && uServerPort4 == 0)
+     {
+         rc = RTStrToUInt32Ex(pszVNCPort4, NULL, 10, &uServerPort4);
+         if (!RT_SUCCESS(rc) || uServerPort4 > 65535)
+             uServerPort4 = 0;
+     }
+ 
+-    if (pszVNCPort6 && uServerPort6 == 0)
++    if (strlen(pszVNCPort6) > 0 && uServerPort6 == 0)
+     {
+         rc = RTStrToUInt32Ex(pszVNCPort6, NULL, 10, &uServerPort6);
+         if (!RT_SUCCESS(rc) || uServerPort6 > 65535)
+             uServerPort6 = 0;
+     }
++
++/* Backward compatibility with set port in "TCP/Ports" only { */
++    if (uServerPort4 == 0 && strlen(pszTCPPort) > 0)
++    {
++        rc = RTStrToUInt32Ex(pszTCPPort, NULL, 10, &uServerPort4);
++        if (!RT_SUCCESS(rc) || uServerPort4 > 65535)
++            uServerPort4 = 0;
++    }
++
++    if (uServerPort6 == 0 && strlen(pszTCPPort) > 0)
++    {
++        rc = RTStrToUInt32Ex(pszTCPPort, NULL, 10, &uServerPort6);
++        if (!RT_SUCCESS(rc) || uServerPort6 > 65535)
++            uServerPort6 = 0;
++    }
++/* } */
+ 
+     if (uServerPort4 == 0 || uServerPort6 == 0)
+         vncServer->autoPort = 1;
diff --git a/emulators/virtualbox-ose-nox11-legacy/Makefile b/emulators/virtualbox-ose-nox11-legacy/Makefile
index 5cc4fc68f34a..21b9fee09903 100644
--- a/emulators/virtualbox-ose-nox11-legacy/Makefile
+++ b/emulators/virtualbox-ose-nox11-legacy/Makefile
@@ -1,4 +1,4 @@
-PORTREVISION=	19
+PORTREVISION=	24
 PKGNAMESUFFIX=	-nox11-legacy
 
 MASTERDIR=	${.CURDIR}/../virtualbox-ose-legacy
diff --git a/emulators/virtualbox-ose-nox11/Makefile b/emulators/virtualbox-ose-nox11/Makefile
index d4a66aac1642..c396083ebf7c 100644
--- a/emulators/virtualbox-ose-nox11/Makefile
+++ b/emulators/virtualbox-ose-nox11/Makefile
@@ -1,4 +1,4 @@
-PORTREVISION=	2
+PORTREVISION=	8
 PKGNAMESUFFIX=	-nox11
 
 MASTERDIR=	${.CURDIR}/../virtualbox-ose
diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile
index a7c9299b7351..77500e1e992a 100644
--- a/emulators/virtualbox-ose/Makefile
+++ b/emulators/virtualbox-ose/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	virtualbox-ose
 DISTVERSION=	6.1.50
-PORTREVISION?=	7
+PORTREVISION?=	8
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.virtualbox.org/virtualbox/${DISTVERSION}/:src \
 		LOCAL/bofh/emulators/virtualbox-ose:docs
diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp b/emulators/virtualbox-ose/files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp
new file mode 100644
index 000000000000..f364e261f40b
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src_VBox_ExtPacks_VNC_VBoxVNC.cpp
@@ -0,0 +1,58 @@
+--- src/VBox/ExtPacks/VNC/VBoxVNC.cpp.orig	2024-01-11 12:24:04 UTC
++++ src/VBox/ExtPacks/VNC/VBoxVNC.cpp
+@@ -45,7 +45,7 @@
+ 
+ #ifdef LIBVNCSERVER_IPv6
+ // enable manually!
+-// #define VBOX_USE_IPV6
++#define VBOX_USE_IPV6
+ #endif
+ 
+ 
+@@ -421,7 +421,7 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
+ 
+     // get address
+     char *pszTCPAddress = (char *)RTMemTmpAllocZ(VNC_ADDRESS_OPTION_MAX);
+-    rc = instance->mCallbacks->VRDECallbackProperty(instance->mCallback,
++    int rc = instance->mCallbacks->VRDECallbackProperty(instance->mCallback,
+                                                     VRDE_QP_NETWORK_ADDRESS,
+                                                     pszTCPAddress,
+                                                     VNC_ADDRESS_OPTION_MAX,
+@@ -582,19 +582,35 @@ DECLCALLBACK(int) VNCServerImpl::VRDEEnableConnections
+             pszServerAddress6 = szIPv6ListenAll;
+     }
+ 
+-    if (pszVNCPort4 && uServerPort4 == 0)
++    if (strlen(pszVNCPort4) > 0 && uServerPort4 == 0)
+     {
+         rc = RTStrToUInt32Ex(pszVNCPort4, NULL, 10, &uServerPort4);
+         if (!RT_SUCCESS(rc) || uServerPort4 > 65535)
+             uServerPort4 = 0;
+     }
+ 
+-    if (pszVNCPort6 && uServerPort6 == 0)
++    if (strlen(pszVNCPort6) > 0 && uServerPort6 == 0)
+     {
+         rc = RTStrToUInt32Ex(pszVNCPort6, NULL, 10, &uServerPort6);
+         if (!RT_SUCCESS(rc) || uServerPort6 > 65535)
+             uServerPort6 = 0;
+     }
++
++/* Backward compatibility with set port in "TCP/Ports" only { */
++    if (uServerPort4 == 0 && strlen(pszTCPPort) > 0)
++    {
++        rc = RTStrToUInt32Ex(pszTCPPort, NULL, 10, &uServerPort4);
++        if (!RT_SUCCESS(rc) || uServerPort4 > 65535)
++            uServerPort4 = 0;
++    }
++
++    if (uServerPort6 == 0 && strlen(pszTCPPort) > 0)
++    {
++        rc = RTStrToUInt32Ex(pszTCPPort, NULL, 10, &uServerPort6);
++        if (!RT_SUCCESS(rc) || uServerPort6 > 65535)
++            uServerPort6 = 0;
++    }
++/* } */
+ 
+     if (uServerPort4 == 0 || uServerPort6 == 0)
+         vncServer->autoPort = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501050154.5051sAQI096136>