Changeset 57968 in vbox
- Timestamp:
- Sep 30, 2015 2:10:00 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r56001 r57968 1430 1430 1431 1431 # Resolve missing MAC address prefix 1432 cchMacAddr = len(sMacAddr) > 0;1432 cchMacAddr = len(sMacAddr) 1433 1433 if cchMacAddr > 0 and cchMacAddr < 12: 1434 sHostName = ''; 1435 try: 1436 sHostName = socket.getfqdn(); 1437 if sys.platform == 'win32' \ 1438 and sHostName.endswith('.sun.com') \ 1439 and not sHostName.endswith('.germany.sun.com'): 1440 sHostName = socket.gethostname(); # klugde. 1441 abHostIP = socket.inet_aton(socket.gethostbyname(sHostName)); 1442 except: 1443 reporter.errorXcpt('failed to determin the host IP for "%s".' % (sHostName,)); 1444 abHostIP = array.array('B', (0x80, 0x86, 0x00, 0x00)).tostring(); 1434 sHostName = '' 1435 try: 1436 sHostName = socket.getfqdn() 1437 sHostIP = socket.gethostbyname(sHostName) 1438 abHostIP = socket.inet_aton(sHostIP) 1439 if ord(abHostIP[0]) == 127 \ 1440 or ord(abHostIP[0]) == 169 and ord(abHostIP[1]) == 254 \ 1441 or ord(abHostIP[0]) == 192 and ord(abHostIP[1]) == 168 and ord(abHostIP[2]) == 56: 1442 reporter.log('warning: host IP for "%s" is %s, most likely not unique.' % (sHostName, sHostIP)) 1443 except: 1444 reporter.errorXcpt('failed to determine the host IP for "%s".' % (sHostName,)) 1445 abHostIP = array.array('B', (0x80, 0x86, 0x00, 0x00)).tostring() 1445 1446 sDefaultMac = '%02X%02X%02X%02X%02X%02X' \ 1446 % (0x02, ord(abHostIP[0]), ord(abHostIP[1]), ord(abHostIP[2]), ord(abHostIP[3]), iNic) ;1447 sMacAddr = sDefaultMac[0:(1 1 - cchMacAddr)] + sMacAddr;1447 % (0x02, ord(abHostIP[0]), ord(abHostIP[1]), ord(abHostIP[2]), ord(abHostIP[3]), iNic) 1448 sMacAddr = sDefaultMac[0:(12 - cchMacAddr)] + sMacAddr 1448 1449 1449 1450 # Get the NIC object and try set it address.
Note:
See TracChangeset
for help on using the changeset viewer.