Changeset 112
- Timestamp:
- Apr 29, 2016, 3:08:01 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Main/src-server/os2/NetIf-os2.cpp ¶
r102 r112 46 46 int i, num; 47 47 struct ifmib ifmib; 48 char pszIfName[20]; 48 49 49 50 // get network interface list … … 61 62 { 62 63 // lanX 63 strcpy(psz Name, "lan");64 itoa(ifindex, psz Name + strlen(pszName), 10);64 strcpy(pszIfName, "lan"); 65 itoa(ifindex, pszIfName + strlen(pszIfName), 10); 65 66 } 66 67 else if (strstr(ifmib.iftable[i].iftDescr, "back")) 67 68 { 68 69 // loopback 69 strcpy(psz Name, "lo");70 strcpy(pszIfName, "lo"); 70 71 } 71 72 else if (strstr(ifmib.iftable[i].iftDescr, "ace ppp")) 72 73 { 73 74 // pppX 74 strcpy(psz Name, "ppp");75 itoa(ifindex, psz Name + strlen(pszName), 10);75 strcpy(pszIfName, "ppp"); 76 itoa(ifindex, pszIfName + strlen(pszIfName), 10); 76 77 } 77 78 else if (strstr(ifmib.iftable[i].iftDescr,"ace sl")) 78 79 { 79 80 // slX 80 strcpy(psz Name, "sl");81 itoa(ifindex, psz Name + strlen(pszName), 10);81 strcpy(pszIfName, "sl"); 82 itoa(ifindex, pszIfName + strlen(pszIfName), 10); 82 83 } 83 84 else if (strstr(ifmib.iftable[i].iftDescr,"ace dod")) 84 85 { 85 86 // dodX 86 strcpy(psz Name, "dod");87 itoa(ifindex, psz Name + strlen(pszName), 10);87 strcpy(pszIfName, "dod"); 88 itoa(ifindex, pszIfName + strlen(pszIfName), 10); 88 89 } 89 90 else 90 91 { 91 92 // unknown 92 strcpy(pszName, "unk"); 93 itoa(ifindex, pszName + strlen(pszName), 10); 94 } 93 strcpy(pszIfName, "unk"); 94 itoa(ifindex, pszIfName + strlen(pszIfName), 10); 95 } 96 97 if (stricmp(pszIfName, pszName)) continue; 95 98 96 99 RT_ZERO(Req); … … 194 197 // interface name is contained in char * field at the start of the structure 195 198 // pointed to by rt_ifp pointer. So, we just do this strange typecast: 196 strcpy(pszName, (char *)*(unsigned long *)(rt_table[j].rt_ifp)); 199 //strcpy(pszName, (char *)*(unsigned long *)(rt_table[j].rt_ifp)); 200 // hardcode it for the mean time, before repairing 201 strcpy(pszName, "lan0"); 197 202 break; 198 203 } … … 227 232 NETIFINFO Info; 228 233 RT_ZERO(Info); 229 rc = getInterfaceInfo(sock, pszName, &Info); 230 if (RT_FAILURE(rc)) 231 return VERR_INTERNAL_ERROR; 232 233 if (Info.enmMediumType == NETIF_T_ETHERNET) 234 { 235 ComObjPtr<HostNetworkInterface> IfObj; 236 IfObj.createObject(); 237 238 HostNetworkInterfaceType_T enmType; 239 if (strncmp(pszName, RT_STR_TUPLE("vboxnet"))) 240 enmType = HostNetworkInterfaceType_Bridged; 234 235 for (i = 0; i < ifmib.ifNumber; i++) 236 { 237 struct ifreq Req; 238 239 int ifindex = ifmib.iftable[i].iftIndex; 240 241 if (ifindex >=0 && ifindex <= 9) 242 { 243 // lanX 244 strcpy(pszName, "lan"); 245 itoa(ifindex, pszName + strlen(pszName), 10); 246 } 247 else if (strstr(ifmib.iftable[i].iftDescr, "back")) 248 { 249 // loopback 250 strcpy(pszName, "lo"); 251 } 252 else if (strstr(ifmib.iftable[i].iftDescr, "ace ppp")) 253 { 254 // pppX 255 strcpy(pszName, "ppp"); 256 itoa(ifindex, pszName + strlen(pszName), 10); 257 } 258 else if (strstr(ifmib.iftable[i].iftDescr,"ace sl")) 259 { 260 // slX 261 strcpy(pszName, "sl"); 262 itoa(ifindex, pszName + strlen(pszName), 10); 263 } 264 else if (strstr(ifmib.iftable[i].iftDescr,"ace dod")) 265 { 266 // dodX 267 strcpy(pszName, "dod"); 268 itoa(ifindex, pszName + strlen(pszName), 10); 269 } 241 270 else 242 enmType = HostNetworkInterfaceType_HostOnly; 243 244 if (SUCCEEDED(IfObj->init(Bstr(pszName), enmType, &Info))) 245 { 246 if (strcmp(pszName, szDefaultIface) == 0) 247 list.push_front(IfObj); 271 { 272 // unknown 273 strcpy(pszName, "unk"); 274 itoa(ifindex, pszName + strlen(pszName), 10); 275 } 276 277 rc = getInterfaceInfo(sock, pszName, &Info); 278 279 if (RT_FAILURE(rc)) 280 break; 281 282 if (Info.enmMediumType == NETIF_T_ETHERNET) 283 { 284 ComObjPtr<HostNetworkInterface> IfObj; 285 IfObj.createObject(); 286 287 HostNetworkInterfaceType_T enmType; 288 if (strncmp(pszName, RT_STR_TUPLE("vboxnet"))) 289 enmType = HostNetworkInterfaceType_Bridged; 248 290 else 249 list.push_back(IfObj); 291 enmType = HostNetworkInterfaceType_HostOnly; 292 293 if (SUCCEEDED(IfObj->init(Bstr(pszName), enmType, &Info))) 294 { 295 if (strcmp(pszName, szDefaultIface) == 0) 296 list.push_front(IfObj); 297 else 298 list.push_back(IfObj); 299 } 250 300 } 251 301 }
Note:
See TracChangeset
for help on using the changeset viewer.