mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
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.
This commit is contained in:
parent
32845fd656
commit
380815f8ef
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user