Changeset 28583 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 22, 2010 9:31:09 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60415
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r28456 r28583 531 531 RTMemFree(pvFree); 532 532 } 533 534 # elif defined(RT_OS_SOLARIS)535 536 # ifdef VBOX_SOLARIS_NSL_RESOLVED537 538 /*539 * Use libdevinfo for determining all physical interfaces.540 */541 di_node_t Root;542 Root = di_init("/", DINFOCACHE);543 if (Root != DI_NODE_NIL)544 {545 di_walk_minor(Root, DDI_NT_NET, 0, &list, vboxSolarisAddPhysHostIface);546 di_fini(Root);547 }548 549 /*550 * Use libdlpi for determining all DLPI interfaces.551 */552 if (VBoxSolarisLibDlpiFound())553 g_pfnLibDlpiWalk(vboxSolarisAddLinkHostIface, &list, 0);554 555 # endif /* VBOX_SOLARIS_NSL_RESOLVED */556 557 /*558 * This gets only the list of all plumbed logical interfaces.559 * This is needed for zones which cannot access the device tree560 * and in this case we just let them use the list of plumbed interfaces561 * on the zone.562 */563 int Sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);564 if (Sock > 0)565 {566 struct lifnum IfNum;567 memset(&IfNum, 0, sizeof(IfNum));568 IfNum.lifn_family = AF_INET;569 int rc = ioctl(Sock, SIOCGLIFNUM, &IfNum);570 if (!rc)571 {572 struct lifreq Ifaces[24];573 struct lifconf IfConfig;574 memset(&IfConfig, 0, sizeof(IfConfig));575 IfConfig.lifc_family = AF_INET;576 IfConfig.lifc_len = sizeof(Ifaces);577 IfConfig.lifc_buf = (caddr_t)&(Ifaces[0]);578 rc = ioctl(Sock, SIOCGLIFCONF, &IfConfig);579 if (!rc)580 {581 for (int i = 0; i < IfNum.lifn_count; i++)582 {583 /*584 * Skip loopback interfaces.585 */586 if (!strncmp(Ifaces[i].lifr_name, "lo", 2))587 continue;588 589 #if 0590 rc = ioctl(Sock, SIOCGLIFADDR, &(Ifaces[i]));591 if (!rc)592 {593 RTMAC Mac;594 struct arpreq ArpReq;595 memcpy(&ArpReq.arp_pa, &Ifaces[i].lifr_addr, sizeof(struct sockaddr_in));596 597 /*598 * We might fail if the interface has not been assigned an IP address.599 * That doesn't matter; as long as it's plumbed we can pick it up.600 * But, if it has not acquired an IP address we cannot obtain it's MAC601 * address this way, so we just use all zeros there.602 */603 rc = ioctl(Sock, SIOCGARP, &ArpReq);604 if (!rc)605 memcpy(&Mac, ArpReq.arp_ha.sa_data, sizeof(RTMAC));606 else607 memset(&Mac, 0, sizeof(Mac));608 609 char szNICDesc[LIFNAMSIZ + 256];610 char *pszIface = Ifaces[i].lifr_name;611 strcpy(szNICDesc, pszIface);612 613 vboxSolarisAddLinkHostIface(pszIface, &list);614 }615 #endif616 617 char *pszIface = Ifaces[i].lifr_name;618 vboxSolarisAddLinkHostIface(pszIface, &list);619 }620 }621 }622 close(Sock);623 }624 625 /*626 * Weed out duplicates caused by dlpi_walk inconsistencies across Nevadas.627 */628 list.sort(vboxSolarisSortNICList);629 list.unique(vboxSolarisSameNIC);630 533 631 534 # elif defined RT_OS_WINDOWS
Note:
See TracChangeset
for help on using the changeset viewer.