VirtualBox

Ignore:
Timestamp:
Aug 10, 2011 3:40:47 PM (14 years ago)
Author:
vboxsync
Message:

vboxnetadp: moved SetExtraData calls to Host::CreateHostOnlyNetworkInterface (#5817)

File:
1 edited

Legend:

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

    r37955 r38406  
    11021102    int r = NetIfCreateHostOnlyNetworkInterface(m->pParent, aHostNetworkInterface, aProgress);
    11031103    if (RT_SUCCESS(r))
     1104    {
     1105#if !defined(RT_OS_WINDOWS)
     1106        Bstr tmpAddr, tmpMask, tmpName;
     1107        HRESULT hrc;
     1108        hrc = (*aHostNetworkInterface)->COMGETTER(Name)(tmpName.asOutParam());
     1109        ComAssertComRCRet(hrc, hrc);
     1110        hrc = (*aHostNetworkInterface)->COMGETTER(IPAddress)(tmpAddr.asOutParam());
     1111        ComAssertComRCRet(hrc, hrc);
     1112        hrc = (*aHostNetworkInterface)->COMGETTER(NetworkMask)(tmpMask.asOutParam());
     1113        ComAssertComRCRet(hrc, hrc);
     1114        /*
     1115         * We need to write the default IP address and mask to extra data now,
     1116         * so the interface gets re-created after vboxnetadp.ko reload.
     1117         * Note that we avoid calling EnableStaticIpConfig since it would
     1118         * change the address on host's interface as well and we want to
     1119         * postpone the change until VM actually starts.
     1120         */
     1121        hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress",
     1122                                               tmpName.raw()).raw(),
     1123                                       tmpAddr.raw());
     1124        ComAssertComRCRet(hrc, hrc);
     1125
     1126        hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask",
     1127                                               tmpName.raw()).raw(),
     1128                                       tmpMask.raw());
     1129        ComAssertComRCRet(hrc, hrc);
     1130#endif
    11041131        return S_OK;
     1132    }
    11051133
    11061134    return r == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL;
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