- VBOX: It turns out that once you set the firewall rules, you cannot reset the

rules for a VM until the VM is in a powered off state.  I guess the VM will
        just have to fail starting up if it cannot allocate the assigned port.
        
    samples/vboxwrapper/
        vbox.cpp

svn path=/trunk/boinc/; revision=24863
This commit is contained in:
Rom Walton 2011-12-22 01:01:37 +00:00
parent 86d5915342
commit 1642299a73
3 changed files with 22 additions and 28 deletions

View File

@ -9278,4 +9278,11 @@ Rom 21 Dec 2011
samples/vboxwrapper/
vbox.cpp
Rom 21 Dec 2011
- VBOX: It turns out that once you set the firewall rules, you cannot reset the
rules for a VM until the VM is in a powered off state. I guess the VM will
just have to fail starting up if it cannot allocate the assigned port.
samples/vboxwrapper/
vbox.cpp

View File

@ -100,13 +100,6 @@ int VBOX_VM::run() {
// error to stop further processing.
if (register_only) return ERR_FOPEN;
// If a project wants to open up a firewall port through the VirtualBox virtual
// network firewall/nat do that here. This has to be done for every execution
// of the wrapper because available host ports change depending on what other
// software is running.
retval = register_vm_firewall_rules();
if (retval) return retval;
retval = start();
if (retval) return retval;
@ -641,6 +634,14 @@ int VBOX_VM::register_vm() {
set_network_access(true);
}
// If a project wants to open up a firewall port through the VirtualBox virtual
// network firewall/nat do that here.
//
if (pf_desired_host_port) {
retval = register_vm_firewall_rules();
if (retval) return retval;
}
// Enable the shared folder if a shared folder is specified.
//
if (enable_shared_directory) {
@ -670,19 +671,12 @@ int VBOX_VM::register_vm_firewall_rules() {
int sock;
int retval;
// Are we being requested to open a firewall port? if the desired
// guest port is zero, then no. The desired host port can be zero
// which means the OS should dynamically assign one.
//
if (pf_desired_guest_port == 0) return 0;
get_slot_directory(virtual_machine_slot_directory);
fprintf(
stderr,
"%s Registering virtual machine firewall rules. (%s)\n",
boinc_msg_prefix(buf, sizeof(buf)),
vm_name.c_str()
"%s Registering virtual machine firewall rules.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
memset(&addr, 0, sizeof(addr));
@ -721,13 +715,6 @@ int VBOX_VM::register_vm_firewall_rules() {
boinc_close_socket(sock);
// Remove any stale firewall rule
//
command = "modifyvm \"" + vm_name + "\" ";
command += "--natpf1 delete \"vboxwrapper\" ";
vbm_popen(command, output, "remove stale port forwarding rule");
// Add new firewall rule
//
sprintf(buf, "vboxwrapper,tcp,127.0.0.1,%d,,%d", pf_assigned_host_port, pf_desired_guest_port);

View File

@ -81,13 +81,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_intelx86.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24862_windows_intelx86.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_intelx86.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24862_windows_intelx86.pdb"
SubSystem="2"
TargetMachine="1"
/>
@ -182,13 +182,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_x86_64.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24862_windows_x86_64.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_x86_64.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24862_windows_x86_64.pdb"
SubSystem="2"
TargetMachine="17"
/>