VirtualBox

Changeset 67792 in vbox


Ignore:
Timestamp:
Jul 5, 2017 11:30:48 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116711
Message:

Main/NetworkAdapterImpl: fixed another case with wrong NAT/DHCP refcounting: don't change the NAT refcount if the current networking mode is not 'NAT network'. This happens for instance if we change the adapter type from something else to 'NAT network' in the GUI and at the same time change the NAT network name.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/NetworkAdapterImpl.h

    r66940 r67792  
    112112    HRESULT i_updateMacAddress(Utf8Str aMacAddress);
    113113    void i_updateBandwidthGroup(BandwidthGroup *aBwGroup);
    114     HRESULT i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName);
     114    HRESULT i_switchFromNatNetworking(const com::Utf8Str &aNatnetworkName);
    115115    HRESULT i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName);
    116116
  • trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp

    r66940 r67792  
    458458
    459459        if (oldAttachmentType == NetworkAttachmentType_NATNetwork)
    460             i_checkAndSwitchFromNatNetworking(mData->strNATNetworkName);
     460            i_switchFromNatNetworking(mData->strNATNetworkName);
    461461
    462462        if (aAttachmentType == NetworkAttachmentType_NATNetwork)
     
    648648        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
    649649        mlock.release();
    650         i_checkAndSwitchFromNatNetworking(oldNatNetworkName.raw());
    651 
    652         i_switchToNatNetworking(aNATNetwork);
     650
     651        if (mData->mode == NetworkAttachmentType_NATNetwork)
     652        {
     653            i_switchFromNatNetworking(oldNatNetworkName.raw());
     654            i_switchToNatNetworking(aNATNetwork);
     655        }
     656
    653657        /* When changing the host adapter, adapt the CFGM logic to make this
    654658         * change immediately effect and to notify the guest that the network
     
    13891393
    13901394
    1391 HRESULT NetworkAdapter::i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName)
     1395HRESULT NetworkAdapter::i_switchFromNatNetworking(const com::Utf8Str &networkName)
    13921396{
    13931397    HRESULT hrc;
Note: See TracChangeset for help on using the changeset viewer.

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