Changeset 98021 in vbox
- Timestamp:
- Jan 6, 2023 8:41:20 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155115
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp
r96407 r98021 116 116 { 117 117 kstat_named_t *kn; 118 if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"ifspeed")) == 0) 118 if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"ifspeed")) != NULL) 119 uSpeed = (uint32_t)(kn->value.ul / 1000000); /* bits -> Mbits */ 120 else 119 121 LogRel(("kstat_data_lookup(ifspeed) -> %d, name=%s\n", errno, name)); 120 else121 uSpeed = kn->value.ul / 1000000; /* bits -> Mbits */122 122 } 123 123 kstat_close(kc); … … 130 130 /* Don't query interface speed for inactive interfaces (see @bugref{6345}). */ 131 131 if (pInfo->enmStatus == NETIF_S_UP) 132 pInfo->uSpeedMbits = 132 pInfo->uSpeedMbits = kstatGet(pInfo->szShortName); 133 133 else 134 134 pInfo->uSpeedMbits = 0; … … 430 430 } 431 431 432 int NetIfList(std::list 432 int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list) 433 433 { 434 434 /* … … 465 465 { 466 466 int cIfaces = RT_MIN(1024, IfNum.lifn_count); /* sane limit */ 467 int cbIfaces = cIfaces* sizeof(struct lifreq);468 struct lifreq * Ifaces = (struct lifreq *)RTMemTmpAlloc(cbIfaces);469 if ( Ifaces)467 size_t cbIfaces = (unsigned)RT_MAX(cIfaces, 1) * sizeof(struct lifreq); 468 struct lifreq *paIfaces = (struct lifreq *)RTMemTmpAlloc(cbIfaces); 469 if (paIfaces) 470 470 { 471 471 struct lifconf IfConfig; 472 472 RT_ZERO(IfConfig); 473 473 IfConfig.lifc_family = AF_INET; 474 IfConfig.lifc_len = cbIfaces;475 IfConfig.lifc_buf = (caddr_t) Ifaces;474 IfConfig.lifc_len = (int)cbIfaces; 475 IfConfig.lifc_buf = (caddr_t)paIfaces; 476 476 rc = ioctl(Sock, SIOCGLIFCONF, &IfConfig); 477 477 if (!rc) … … 482 482 * Skip loopback interfaces. 483 483 */ 484 if (!strncmp( Ifaces[i].lifr_name, RT_STR_TUPLE("lo")))484 if (!strncmp(paIfaces[i].lifr_name, RT_STR_TUPLE("lo"))) 485 485 continue; 486 486 487 487 #if 0 488 rc = ioctl(Sock, SIOCGLIFADDR, &( Ifaces[i]));488 rc = ioctl(Sock, SIOCGLIFADDR, &(paIfaces[i])); 489 489 if (rc >= 0) 490 490 { 491 memcpy(Info.IPAddress.au8, ((struct sockaddr *)& Ifaces[i].lifr_addr)->sa_data,491 memcpy(Info.IPAddress.au8, ((struct sockaddr *)&paIfaces[i].lifr_addr)->sa_data, 492 492 sizeof(Info.IPAddress.au8)); 493 493 // SIOCGLIFNETMASK 494 494 struct arpreq ArpReq; 495 memcpy(&ArpReq.arp_pa, & Ifaces[i].lifr_addr, sizeof(struct sockaddr_in));495 memcpy(&ArpReq.arp_pa, &paIfaces[i].lifr_addr, sizeof(struct sockaddr_in)); 496 496 497 497 /* … … 506 506 507 507 char szNICDesc[LIFNAMSIZ + 256]; 508 char *pszIface = Ifaces[i].lifr_name;508 char *pszIface = paIfaces[i].lifr_name; 509 509 strcpy(szNICDesc, pszIface); 510 510 … … 513 513 #endif 514 514 515 char *pszIface = Ifaces[i].lifr_name; 516 vboxSolarisAddLinkHostIface(pszIface, &list); 515 vboxSolarisAddLinkHostIface(paIfaces[i].lifr_name, &list); 517 516 } 518 517 } 519 RTMemTmpFree( Ifaces);518 RTMemTmpFree(paIfaces); 520 519 } 521 520 }
Note:
See TracChangeset
for help on using the changeset viewer.