VirtualBox

Changeset 36082 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Feb 25, 2011 12:21:57 PM (14 years ago)
Author:
vboxsync
Message:

Added a promiscModePolicy attribute to INetworkAdapter, three values: deny (default), allow-network (i.e. VMs), allow-all (i.e. include unrelated host traffic).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r36074 r36082  
    59745974
    59755975/**
     5976 * Adds the given IsModified_* flag to the dirty flags of the machine, taking
     5977 * care of the write locking.
     5978 *
     5979 * @param   fModifications      The flag to add.
     5980 */
     5981void Machine::setModifiedLock(uint32_t fModification)
     5982{
     5983    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     5984    mData->flModifications |= fModification;
     5985}
     5986
     5987/**
    59765988 *  Saves the registry entry of this machine to the given configuration node.
    59775989 *
  • trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp

    r35638 r36082  
    753753}
    754754
     755
     756STDMETHODIMP NetworkAdapter::COMGETTER(PromiscModePolicy)(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy)
     757{
     758    CheckComArgOutPointerValid(aPromiscModePolicy);
     759
     760    AutoCaller autoCaller(this);
     761    HRESULT hrc = autoCaller.rc();
     762    if (SUCCEEDED(hrc))
     763    {
     764        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     765        *aPromiscModePolicy = mData->mPromiscModePolicy;
     766    }
     767    return hrc;
     768}
     769
     770STDMETHODIMP NetworkAdapter::COMSETTER(PromiscModePolicy)(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy)
     771{
     772    switch (aPromiscModePolicy)
     773    {
     774        case NetworkAdapterPromiscModePolicy_Deny:
     775        case NetworkAdapterPromiscModePolicy_AllowNetwork:
     776        case NetworkAdapterPromiscModePolicy_AllowAll:
     777            break;
     778        default:
     779            return setError(E_INVALIDARG, tr("Invalid promiscuous mode policy (%d)"), aPromiscModePolicy);
     780    }
     781
     782    AutoCaller autoCaller(this);
     783    HRESULT hrc = autoCaller.rc();
     784
     785    if (SUCCEEDED(hrc))
     786    {
     787        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     788        if (aPromiscModePolicy != mData->mPromiscModePolicy)
     789        {
     790            mData.backup();
     791            mData->mPromiscModePolicy = aPromiscModePolicy;
     792            m_fModified = true;
     793
     794            alock.release();
     795            mParent->setModifiedLock(Machine::IsModified_NetworkAdapters);
     796            mParent->onNetworkAdapterChange(this, TRUE);
     797        }
     798    }
     799
     800    return hrc;
     801}
     802
    755803STDMETHODIMP NetworkAdapter::COMGETTER(BandwidthLimit) (ULONG *aLimit)
    756804{
     
    12581306    /* line speed (defaults to 100 Mbps) */
    12591307    mData->mLineSpeed = data.ulLineSpeed;
     1308    mData->mPromiscModePolicy = data.enmPromiscModePolicy;
    12601309    /* tracing (defaults to false) */
    12611310    mData->mTraceEnabled = data.fTraceEnabled;
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