儲存庫 vbox 的更動 11993
- 時間撮記:
- 2008-9-2 下午03:23:17 (16 年 以前)
- 位置:
- trunk/src/VBox/Main
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r11870 r11993 1225 1225 1226 1226 # elif defined(RT_OS_SOLARIS) 1227 /* The name is on the form BSD format 'ifX'; use as-is. */ 1228 const char *pszTrunk = pszHifName; 1227 /* The name is on the form BSD format 'ifX - long name, chop it off at space. */ 1228 char szTrunk[8]; 1229 strncpy(szTrunk, pszHifName, sizeof(szTrunk)); 1230 char *pszSpace = (char *)memchr(szTrunk, ' ', sizeof(szTrunk)); 1231 if (!pszSpace) 1232 { 1233 hrc = networkAdapter->Detach(); H(); 1234 return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 1235 N_("Malformed host interface networking name '%ls'"), 1236 HifName.raw()); 1237 } 1238 *pszSpace = '\0'; 1239 const char *pszTrunk = szTrunk; 1229 1240 # else 1230 1241 # error "PORTME (VBOX_WITH_NETFLT)" -
trunk/src/VBox/Main/HostImpl.cpp
r11869 r11993 52 52 # include <limits.h> 53 53 # include <stdio.h> 54 # include <net/if.h> 54 55 # include <sys/socket.h> 55 56 # include <sys/sockio.h> … … 109 110 #ifdef RT_OS_SOLARIS 110 111 # include <iprt/path.h> 112 # include <iprt/ctype.h> 111 113 #endif 112 114 … … 556 558 # elif defined(RT_OS_SOLARIS) 557 559 560 typedef std::map <std::string, std::string> NICMap; 561 typedef std::pair <std::string, std::string> NICPair; 562 static NICMap SolarisNICMap; 563 SolarisNICMap.insert(NICPair("bge", "Broadcom BCM57xx Gigabit Ethernet")); 564 SolarisNICMap.insert(NICPair("ce", "Cassini Gigabit Ethernet")); 565 SolarisNICMap.insert(NICPair("chxge", "Chelsio Ethernet")); 566 SolarisNICMap.insert(NICPair("dmfe", "Davicom Fast Ethernet")); 567 SolarisNICMap.insert(NICPair("dnet", "DEC 21040/41 21140 Ethernet")); 568 SolarisNICMap.insert(NICPair("e1000", "Intel PRO/1000 Gigabit Ethernet")); 569 SolarisNICMap.insert(NICPair("e1000g", "Intel PRO/1000 Gigabit Ethernet")); 570 SolarisNICMap.insert(NICPair("elx", "3COM EtherLink III Ethernet")); 571 SolarisNICMap.insert(NICPair("elxl", "3COM Ethernet")); 572 SolarisNICMap.insert(NICPair("elxl", "eri Fast Ethernet")); 573 SolarisNICMap.insert(NICPair("ge", "GEM Gigabit Ethernet")); 574 SolarisNICMap.insert(NICPair("hme", "SUNW,hme Fast-Ethernet")); 575 SolarisNICMap.insert(NICPair("ipge", "PCI-E Gigabit Ethernet")); 576 SolarisNICMap.insert(NICPair("iprb", "Intel 82557/58/59 Ethernet")); 577 SolarisNICMap.insert(NICPair("nge", "nVidia Gigabit Ethernet")); 578 SolarisNICMap.insert(NICPair("pcelx", "3COM EtherLink III PCMCIA Ethernet")); 579 SolarisNICMap.insert(NICPair("pcn", "AMD PCnet Ethernet")); 580 SolarisNICMap.insert(NICPair("qfe", "SUNW,qfe Quad Fast-Ethernet")); 581 SolarisNICMap.insert(NICPair("rge", "Realtek Gigabit Ethernet")); 582 SolarisNICMap.insert(NICPair("rtls", "Realtek 8139 Fast Ethernet")); 583 SolarisNICMap.insert(NICPair("skge", "SksKonnect Gigabit Ethernet")); 584 SolarisNICMap.insert(NICPair("spwr", "SMC EtherPower II 10/100 (9432) Ethernet")); 585 SolarisNICMap.insert(NICPair("xge", "Neterior Xframe Gigabit Ethernet")); 586 SolarisNICMap.insert(NICPair("xge", "Neterior Xframe 10Gigabit Ethernet")); 587 558 588 int Sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); 559 589 if (Sock > 0) … … 604 634 memset(&Mac, 0, sizeof(Mac)); 605 635 636 char szNICDesc[LIFNAMSIZ + 256]; 606 637 char *pszIface = Ifaces[i].lifr_name; 607 638 strcpy(szNICDesc, pszIface); 639 640 /* 641 * Clip off the instance number from the interface name. 642 */ 643 int cbInstance = 0; 644 int cbIface = strlen(pszIface); 645 char *pszEnd = pszIface + cbIface - 1; 646 for (int i = 0; i < cbIface - 1; i++) 647 { 648 if (!RT_C_IS_DIGIT(*pszEnd)) 649 break; 650 cbInstance++; 651 pszEnd--; 652 } 653 654 /* 655 * Try picking up description from our NIC map. 656 */ 657 char szIfaceName[LIFNAMSIZ + 1]; 658 strncpy(szIfaceName, pszIface, cbIface - cbInstance); 659 szIfaceName[cbIface - cbInstance] = '\0'; 660 std::string Description = SolarisNICMap[szIfaceName]; 661 if (Description != "") 662 RTStrPrintf(szNICDesc, sizeof(szNICDesc), "%s - %s", pszIface, Description.c_str()); 663 else 664 RTStrPrintf(szNICDesc, sizeof(szNICDesc), "%s - Ethernet", pszIface); 665 666 /* 667 * Construct UUID with BSD-name of the interface and the MAC address. 668 */ 608 669 RTUUID Uuid; 609 670 RTUuidClear(&Uuid); … … 620 681 ComObjPtr<HostNetworkInterface> IfObj; 621 682 IfObj.createObject(); 622 if (SUCCEEDED(IfObj->init(Bstr( pszIface), Guid(Uuid))))683 if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid)))) 623 684 list.push_back(IfObj); 624 685 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器