Changeset 38406 in vbox
- Timestamp:
- Aug 10, 2011 3:40:47 PM (13 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostImpl.cpp
r37955 r38406 1102 1102 int r = NetIfCreateHostOnlyNetworkInterface(m->pParent, aHostNetworkInterface, aProgress); 1103 1103 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 1104 1131 return S_OK; 1132 } 1105 1133 1106 1134 return r == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL; -
trunk/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
r37353 r38406 564 564 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(), tmpMask.asOutParam()); 565 565 if (tmpAddr.isEmpty()) 566 {567 566 tmpAddr = getDefaultIPv4Address(mInterfaceName); 568 /*569 * We need to write the default IP address and mask to extra data now,570 * so the interface gets re-created after vboxnetadp.ko reload.571 * Note that we avoid calling EnableStaticIpConfig since it would572 * change the address on host's interface as well and we want to573 * postpone the change until VM actually starts.574 */575 hrc = mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress",576 mInterfaceName.raw()).raw(),577 tmpAddr.raw());578 ComAssertComRCRet(hrc, hrc);579 }580 567 581 568 if (tmpMask.isEmpty()) 582 {583 569 tmpMask = Bstr(VBOXNET_IPV4MASK_DEFAULT); 584 hrc = mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", 585 mInterfaceName.raw()).raw(), 586 Bstr(VBOXNET_IPV4MASK_DEFAULT).raw()); 587 ComAssertComRCRet(hrc, hrc); 588 } 570 589 571 m.IPAddress = inet_addr(Utf8Str(tmpAddr).c_str()); 590 572 m.networkMask = inet_addr(Utf8Str(tmpMask).c_str());
Note:
See TracChangeset
for help on using the changeset viewer.