VirtualBox

Changeset 34335 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Nov 24, 2010 5:49:09 PM (14 years ago)
Author:
vboxsync
Message:

Main/DrvIntNet: pass IgnoreConnectFailure to the driver to make it ignore connection errors only if the VM is restoring from a saved state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r34330 r34335  
    12261226    PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
    12271227    bool f;
     1228    bool fIgnoreConnectFailure;
    12281229    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    12291230
     
    12751276                              "QuietlyIgnoreTrunkWirePromisc\0"
    12761277                              "IgnoreTrunkHostPromisc\0"
     1278                              "IgnoreConnectFailure\0"
    12771279                              "QuietlyIgnoreTrunkHostPromisc\0"
    12781280                              "IsService\0"))
     
    14361438    /** @todo flags for not sending to the host and for setting the trunk-wire
    14371439     *        connection in promiscuous mode. */
     1440
     1441
     1442    /** @cfgm{IgnoreConnectFailure, boolean, false}
     1443     * When set only raise a runtime error if we cannot connect to the internal
     1444     * network. */
     1445    rc = CFGMR3QueryBoolDef(pCfg, "IgnoreConnectFailure", &fIgnoreConnectFailure, false);
     1446    if (RT_FAILURE(rc))
     1447        return PDMDRV_SET_ERROR(pDrvIns, rc,
     1448                                N_("Configuration error: Failed to get the \"IgnoreConnectFailure\" value"));
     1449    if (f)
     1450        OpenReq.fFlags |= INTNET_OPEN_FLAGS_IGNORE_PROMISC;
    14381451
    14391452
     
    15391552    if (RT_FAILURE(rc))
    15401553    {
    1541          PDMDrvHlpVMSetRuntimeError (pDrvIns, 0 /*fFlags*/, "HostIfNotConnecting",
    1542                                      N_ ("Cannot connect to the network interface '%s'. The virtual "
    1543                                          "network card will appear to work but the guest will not "
    1544                                          "be able to connect. Please choose a different network in the "
    1545                                          "network settings"), OpenReq.szTrunk);
    1546 
    1547         return VERR_PDM_NO_ATTACHED_DRIVER;
     1554        if (fIgnoreConnectFailure)
     1555        {
     1556            /*
     1557             * During VM restore it is fatal if the network is not available because the
     1558             * VM settings are locked and the user has no chance to fix network settings.
     1559             * Therefore don't abort but just raise a runtime warning.
     1560             */
     1561            PDMDrvHlpVMSetRuntimeError (pDrvIns, 0 /*fFlags*/, "HostIfNotConnecting",
     1562                                        N_ ("Cannot connect to the network interface '%s'. The virtual "
     1563                                            "network card will appear to work but the guest will not "
     1564                                            "be able to connect. Please choose a different network in the "
     1565                                            "network settings"), OpenReq.szTrunk);
     1566
     1567            return VERR_PDM_NO_ATTACHED_DRIVER;
     1568        }
     1569        else
     1570        {
     1571            return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
     1572                                       N_("Failed to open/create the internal network '%s'"), pThis->szNetwork);
     1573        }
    15481574    }
    15491575
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette