Changeset 13426 in vbox
- Timestamp:
- Oct 21, 2008 9:59:54 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38186
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r13286 r13426 54 54 # ifdef VBOX_SOLARIS_NSL_RESOLVED 55 55 # include <libdevinfo.h> 56 # else 57 # include <net/if.h> 58 # include <sys/socket.h> 59 # include <sys/sockio.h> 60 # include <net/if_arp.h> 61 # include <net/if.h> 62 # endif /* VBOX_SOLARIS_USE_DEVINFO */ 56 # endif 57 # include <net/if.h> 58 # include <sys/socket.h> 59 # include <sys/sockio.h> 60 # include <net/if_arp.h> 61 # include <net/if.h> 63 62 # include <sys/types.h> 64 63 # include <sys/stat.h> … … 617 616 { 618 617 /* 619 * Clip off the instance number from the interface name. 618 * Clip off the zone instance number from the interface name (if any). 619 */ 620 char szIfaceName[128]; 621 strcpy(szIfaceName, pszIface); 622 char *pszColon = (char *)memchr(szIfaceName, ':', sizeof(szIfaceName)); 623 if (pszColon) 624 *pszColon = '\0'; 625 626 /* 627 * Get the instance number from the interface name, then clip it off. 620 628 */ 621 629 int cbInstance = 0; 622 int cbIface = strlen( pszIface);630 int cbIface = strlen(szIfaceName); 623 631 const char *pszEnd = pszIface + cbIface - 1; 624 632 for (int i = 0; i < cbIface - 1; i++) … … 630 638 } 631 639 640 int Instance = atoi(pszEnd + 1); 641 strncpy(szIfaceName, pszIface, cbIface - cbInstance); 642 szIfaceName[cbIface - cbInstance] = '\0'; 643 632 644 /* 633 645 * Add the interface. 634 646 */ 635 char szIfaceName[128];636 strncpy(szIfaceName, pszIface, cbIface - cbInstance);637 szIfaceName[cbIface - cbInstance] = '\0';638 int Instance = atoi(pszEnd + 1);639 647 vboxSolarisAddHostIface(szIfaceName, Instance, NULL, pvHostNetworkInterfaceList); 640 648 … … 643 651 */ 644 652 return _B_FALSE; 653 } 654 655 static bool vboxSolarisSortNICList(const ComObjPtr <HostNetworkInterface> Iface1, const ComObjPtr <HostNetworkInterface> Iface2) 656 { 657 Bstr Iface1Str; 658 (*Iface1).COMGETTER(Name) (Iface1Str.asOutParam()); 659 660 Bstr Iface2Str; 661 (*Iface2).COMGETTER(Name) (Iface2Str.asOutParam()); 662 663 return Iface1Str < Iface2Str; 664 } 665 666 static bool vboxSolarisSameNIC(const ComObjPtr <HostNetworkInterface> Iface1, const ComObjPtr <HostNetworkInterface> Iface2) 667 { 668 Bstr Iface1Str; 669 (*Iface1).COMGETTER(Name) (Iface1Str.asOutParam()); 670 671 Bstr Iface2Str; 672 (*Iface2).COMGETTER(Name) (Iface2Str.asOutParam()); 673 674 return (Iface1Str == Iface2Str); 645 675 } 646 676 … … 663 693 return DI_WALK_CONTINUE; 664 694 } 665 666 static bool vboxSolarisSameNIC(ComObjPtr <HostNetworkInterface> Iface1, ComObjPtr <HostNetworkInterface> Iface2) 667 { 668 Bstr Iface1Str; 669 (*Iface1).COMGETTER(Name) (Iface1Str.asOutParam()); 670 671 Bstr Iface2Str; 672 (*Iface2).COMGETTER(Name) (Iface2Str.asOutParam()); 673 674 return (Iface1Str == Iface2Str); 675 } 676 677 # endif /* VBOX_SOLARIS_USE_DEVINFO */ 695 # endif /* VBOX_SOLARIS_NSL_RESOLVED */ 678 696 679 697 #endif … … 1067 1085 # elif defined(RT_OS_SOLARIS) 1068 1086 1069 # ifdef VBOX_SOLARIS_NSL_RESOLVED1087 # ifdef VBOX_SOLARIS_NSL_RESOLVED 1070 1088 1071 1089 /* … … 1086 1104 g_pfnLibDlpiWalk(vboxSolarisAddLinkHostIface, &list, 0); 1087 1105 1088 /* 1089 * Weed out duplicates caused by dlpi_walk inconsistencies across Nevadas. 1090 */ 1091 list.unique(vboxSolarisSameNIC); 1092 1093 #else 1106 # endif /* VBOX_SOLARIS_NSL_RESOLVED */ 1107 1094 1108 /* 1095 1109 * This gets only the list of all plumbed logical interfaces. 1110 * This is needed for zones which cannot access the device tree 1111 * and in this case we just let them use the list of plumbed interfaces 1112 * on the zone. 1096 1113 */ 1097 1114 int Sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); … … 1113 1130 if (!rc) 1114 1131 { 1115 /*1116 * Ok now we go the interfaces, get the info we need (i.e MAC address).1117 */1118 1132 for (int i = 0; i < IfNum.lifn_count; i++) 1119 1133 { … … 1124 1138 continue; 1125 1139 1140 #if 0 1126 1141 rc = ioctl(Sock, SIOCGLIFADDR, &(Ifaces[i])); 1127 1142 if (!rc) … … 1149 1164 vboxSolarisAddLinkHostIface(pszIface, &list); 1150 1165 } 1166 #endif 1167 1168 char *pszIface = Ifaces[i].lifr_name; 1169 vboxSolarisAddLinkHostIface(pszIface, &list); 1151 1170 } 1152 1171 } … … 1154 1173 close(Sock); 1155 1174 } 1156 #endif 1175 1176 /* 1177 * Weed out duplicates caused by dlpi_walk inconsistencies across Nevadas. 1178 */ 1179 list.sort(vboxSolarisSortNICList); 1180 list.unique(vboxSolarisSameNIC); 1157 1181 1158 1182 # elif defined RT_OS_WINDOWS -
trunk/src/VBox/Main/Makefile.kmk
r13222 r13426 238 238 ifdef VBOX_SOLARIS_NSL_RESOLVED 239 239 VBoxSVC_LIBS.solaris += devinfo 240 else241 VBoxSVC_LIBS.solaris += socket242 240 endif 241 VBoxSVC_LIBS.solaris += socket 243 242 endif 244 243 ifdef VBOX_WITH_USB
Note:
See TracChangeset
for help on using the changeset viewer.