Changeset 66940 in vbox
- Timestamp:
- May 17, 2017 4:44:04 PM (8 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/NATEngineImpl.h
r61170 r66940 48 48 void i_commit(); 49 49 void i_copyFrom(NATEngine *aThat); 50 void i_applyDefaults(); 51 bool i_hasDefaults(); 50 52 HRESULT i_loadSettings(const settings::NAT &data); 51 53 HRESULT i_saveSettings(settings::NAT &data); -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r61170 r66940 58 58 void i_copyFrom(NetworkAdapter *aThat); 59 59 void i_applyDefaults(GuestOSType *aOsType); 60 bool i_hasDefaults(); 60 61 61 62 ComObjPtr<NetworkAdapter> i_getPeer(); -
trunk/src/VBox/Main/src-server/NATEngineImpl.cpp
r64193 r66940 178 178 /* this will back up current data */ 179 179 mData->m.assignCopy(aThat->mData->m); 180 } 181 182 void NATEngine::i_applyDefaults() 183 { 184 /* sanity */ 185 AutoCaller autoCaller(this); 186 AssertComRCReturnVoid(autoCaller.rc()); 187 188 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 189 190 /* so far nothing to do */ 191 } 192 193 bool NATEngine::i_hasDefaults() 194 { 195 /* sanity */ 196 AutoCaller autoCaller(this); 197 AssertComRCReturn(autoCaller.rc(), true); 198 199 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 200 201 return mData->m->areDefaultSettings(); 180 202 } 181 203 -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r65103 r66940 1181 1181 } 1182 1182 1183 /** 1184 * Applies the defaults for this network adapter. 1185 * 1186 * @note This method currently assumes that the object is in the state after 1187 * calling init(), it does not set defaults from an arbitrary state. 1188 */ 1183 1189 void NetworkAdapter::i_applyDefaults(GuestOSType *aOsType) 1184 1190 { 1185 AssertReturnVoid(aOsType != NULL);1186 1187 1191 /* sanity */ 1188 1192 AutoCaller autoCaller(this); 1189 1193 AssertComRCReturnVoid(autoCaller.rc()); 1194 1195 mNATEngine->i_applyDefaults(); 1190 1196 1191 1197 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1196 1202 #endif // VBOX_WITH_E1000 1197 1203 1198 NetworkAdapterType_T defaultType = aOsType->i_networkAdapterType(); 1204 NetworkAdapterType_T defaultType = NetworkAdapterType_Am79C973; 1205 if (aOsType) 1206 defaultType = aOsType->i_networkAdapterType(); 1199 1207 1200 1208 /* Set default network adapter for this OS type */ … … 1203 1211 defaultType == NetworkAdapterType_I82545EM) 1204 1212 { 1205 if (e1000enabled) mData->type = defaultType; 1206 } 1207 else mData->type = defaultType; 1208 1209 /* Enable the first one adapter to the NAT */ 1210 if (mData->ulSlot == 0) 1213 if (e1000enabled) 1214 mData->type = defaultType; 1215 } 1216 else 1217 mData->type = defaultType; 1218 1219 /* Enable the first one adapter and set it to NAT */ 1220 /** @todo r=klaus remove this long term, since a newly created VM should 1221 * have no additional hardware components unless configured either 1222 * explicitly or through Machine::applyDefaults. */ 1223 if (aOsType && mData->ulSlot == 0) 1211 1224 { 1212 1225 mData->fEnabled = true; … … 1216 1229 } 1217 1230 mData->fCableConnected = true; 1231 } 1232 1233 bool NetworkAdapter::i_hasDefaults() 1234 { 1235 /* sanity */ 1236 AutoCaller autoCaller(this); 1237 AssertComRCReturn(autoCaller.rc(), true); 1238 1239 ComObjPtr<GuestOSType> pGuestOSType; 1240 HRESULT rc = mParent->i_getVirtualBox()->i_findGuestOSType(mParent->i_getOSTypeId(), 1241 pGuestOSType); 1242 if (FAILED(rc)) 1243 return false; 1244 1245 NetworkAdapterType_T defaultType = pGuestOSType->i_networkAdapterType(); 1246 1247 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1248 1249 if ( !mData->fEnabled 1250 && mData->strMACAddress.isEmpty() 1251 && mData->type == defaultType 1252 && mData->fCableConnected 1253 && mData->ulLineSpeed == 0 1254 && mData->enmPromiscModePolicy == NetworkAdapterPromiscModePolicy_Deny 1255 && mData->mode == NetworkAttachmentType_Null 1256 && mData->strBridgedName.isEmpty() 1257 && mData->strInternalNetworkName.isEmpty() 1258 && mData->strHostOnlyName.isEmpty() 1259 && mData->strNATNetworkName.isEmpty() 1260 && mData->strGenericDriver.isEmpty() 1261 && mData->genericProperties.size() == 0) 1262 { 1263 /* Could be default, check NAT defaults. */ 1264 return mNATEngine->i_hasDefaults(); 1265 } 1266 1267 return false; 1218 1268 } 1219 1269
Note:
See TracChangeset
for help on using the changeset viewer.