VirtualBox

Changeset 44726 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Feb 18, 2013 6:38:05 AM (12 years ago)
Author:
vboxsync
Message:

Main/Metrics: Do not query interface speed for inactive ones on Solaris (#6345)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp

    r44528 r44726  
    7474}
    7575
    76 static uint64_t kstatGet(const char *name)
     76static uint32_t kstatGet(const char *name)
    7777{
    7878    kstat_ctl_t *kc;
    79     uint64_t uSpeed = 0;
     79    uint32_t uSpeed = 0;
    8080
    8181    if ((kc = kstat_open()) == 0)
     
    104104            LogRel(("kstat_data_lookup(ifspeed) -> %d, name=%s\n", errno, name));
    105105        else
    106             uSpeed = kn->value.ul;
     106            uSpeed = kn->value.ul / 1000000; /* bits -> Mbits */
    107107    }
    108108    kstat_close(kc);
     109    LogFlow(("kstatGet(%s) -> %u Mbit/s\n", name, uSpeed));
    109110    return uSpeed;
    110111}
     
    112113static void queryIfaceSpeed(PNETIFINFO pInfo)
    113114{
    114     pInfo->uSpeedMbits = kstatGet(pInfo->szShortName) / 1000000; /* bits -> Mbits */
     115    /* Don't query interface speed for inactive interfaces (see @bugref{6345}). */
     116    if (pInfo->enmStatus == NETIF_S_UP)
     117        pInfo->uSpeedMbits =  kstatGet(pInfo->szShortName);
     118    else
     119        pInfo->uSpeedMbits = 0;
     120    LogFlow(("queryIfaceSpeed(%s) -> %u\n", pInfo->szShortName, pInfo->uSpeedMbits));
    115121}
    116122
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette