提交 380815f8 编写于 作者: D Dawid Zamirski 提交者: John Ferlan

vbox: Make autoport set RDP port range.

Originally autoport in vbox driver was setting the port to default value
(3389) which caused multiple VM instances use the same port. Since
libvirt XML does not allow to set port ranges, this patch changes the
"autoport" behavior to set VBox's "TCP/Ports" property to an arbitrary
port range (3389-3689) to avoid that issue.
上级 32845fd6
......@@ -146,6 +146,9 @@ if (strUtf16) {\
#define VBOX_IID_INITIALIZER { NULL, true }
/* default RDP port range to use for auto-port setting */
#define VBOX_RDP_AUTOPORT_RANGE "3389-3689"
static void
_vboxIIDUnalloc(vboxDriverPtr data, vboxIID *iid)
{
......@@ -1595,15 +1598,21 @@ _vrdeServerGetPorts(vboxDriverPtr data ATTRIBUTE_UNUSED,
}
static nsresult
_vrdeServerSetPorts(vboxDriverPtr data ATTRIBUTE_UNUSED,
IVRDEServer *VRDEServer, virDomainGraphicsDefPtr graphics)
_vrdeServerSetPorts(vboxDriverPtr data, IVRDEServer *VRDEServer,
virDomainGraphicsDefPtr graphics)
{
nsresult rc = 0;
PRUnichar *VRDEPortsKey = NULL;
PRUnichar *VRDEPortsValue = NULL;
VBOX_UTF8_TO_UTF16("TCP/Ports", &VRDEPortsKey);
VRDEPortsValue = PRUnicharFromInt(data->pFuncs, graphics->data.rdp.port);
if (graphics->data.rdp.autoport)
VBOX_UTF8_TO_UTF16(VBOX_RDP_AUTOPORT_RANGE, &VRDEPortsValue);
else
VRDEPortsValue = PRUnicharFromInt(data->pFuncs,
graphics->data.rdp.port);
rc = VRDEServer->vtbl->SetVRDEProperty(VRDEServer, VRDEPortsKey,
VRDEPortsValue);
VBOX_UTF16_FREE(VRDEPortsKey);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册