Changeset 36615 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Apr 7, 2011 12:45:27 PM (14 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostImpl.cpp
r36451 r36615 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1511 1511 return E_NOTIMPL; 1512 1512 #endif /* !VBOX_WITH_USB */ 1513 } 1514 1515 STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress) 1516 { 1517 CheckComArgOutPointerValid(aAddress); 1518 // no locking required 1519 Utf8Str mac; 1520 generateMACAddress(mac); 1521 Bstr(mac).cloneTo(aAddress); 1522 return S_OK; 1513 1523 } 1514 1524 … … 2796 2806 ramUsageFree); 2797 2807 aCollector->registerBaseMetric (ramUsage); 2798 pm::BaseMetric *ramVmm = new pm::HostRamVmm(aCollector->getGuestManager(), objptr, 2808 pm::BaseMetric *ramVmm = new pm::HostRamVmm(aCollector->getGuestManager(), objptr, 2799 2809 ramVMMUsed, 2800 2810 ramVMMFree, … … 2898 2908 } 2899 2909 2910 2911 /* static */ 2912 void Host::generateMACAddress(Utf8Str &mac) 2913 { 2914 /* 2915 * Our strategy is as follows: the first three bytes are our fixed 2916 * vendor ID (080027). The remaining 3 bytes will be taken from the 2917 * start of a GUID. This is a fairly safe algorithm. 2918 */ 2919 Guid guid; 2920 guid.create(); 2921 mac = Utf8StrFmt("080027%02X%02X%02X", 2922 guid.raw()->au8[0], guid.raw()->au8[1], guid.raw()->au8[2]); 2923 } 2924 2900 2925 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 2901 2926 -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r36276 r36615 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 #include "MachineImpl.h" 23 23 #include "GuestOSTypeImpl.h" 24 #include "HostImpl.h" 24 25 25 26 #include <iprt/string.h> … … 1265 1266 if (FAILED(rc)) return rc; 1266 1267 } 1267 1268 1268 1269 // leave the lock before attaching 1269 1270 alock.release(); … … 1573 1574 void NetworkAdapter::generateMACAddress() 1574 1575 { 1575 /* 1576 * Our strategy is as follows: the first three bytes are our fixed 1577 * vendor ID (080027). The remaining 3 bytes will be taken from the 1578 * start of a GUID. This is a fairly safe algorithm. 1579 */ 1580 char strMAC[13]; 1581 Guid guid; 1582 guid.create(); 1583 RTStrPrintf (strMAC, sizeof(strMAC), "080027%02X%02X%02X", 1584 guid.raw()->au8[0], guid.raw()->au8[1], guid.raw()->au8[2]); 1585 LogFlowThisFunc(("generated MAC: '%s'\n", strMAC)); 1586 mData->mMACAddress = strMAC; 1576 Utf8Str mac; 1577 Host::generateMACAddress(mac); 1578 LogFlowThisFunc(("generated MAC: '%s'\n", mac.c_str())); 1579 mData->mMACAddress = mac; 1587 1580 } 1588 1581
Note:
See TracChangeset
for help on using the changeset viewer.