VirtualBox

Ignore:
Timestamp:
Sep 27, 2015 12:36:44 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102884
Message:

VBoxNetFlt/darwin, VBoxNetAdp/darwin: increment interface statistic
for packets to and from intnet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp

    r57904 r57912  
    941941             * A packet from the host to a guest.  As we won't pass it
    942942             * to the drvier/wire we need to feed it to bpf ourselves.
     943             *
     944             * XXX: TODO: bpf should be done before; use pfnPreRecv?
    943945             */
    944946            if (fSrc == INTNETTRUNKDIR_HOST)
    945947            {
    946948                bpf_tap_out(pThis->u.s.pIfNet, DLT_EN10MB, pMBuf, NULL, 0);
     949                ifnet_stat_increment_out(pThis->u.s.pIfNet, 1, mbuf_len(pMBuf), 0);
    947950            }
    948951        }
     
    11511154        /*
    11521155         * Create a mbuf for the gather list and push it onto the wire.
     1156         * BPF tap and stats will be taken care of by the driver.
    11531157         */
    11541158        if (fDst & INTNETTRUNKDIR_WIRE)
     
    11671171        /*
    11681172         * Create a mbuf for the gather list and push it onto the host stack.
     1173         * BPF tap and stats are on us.
    11691174         */
    11701175        if (fDst & INTNETTRUNKDIR_HOST)
     
    11751180                void *pvEthHdr = mbuf_data(pMBuf);
    11761181                unsigned const cbEthHdr = 14;
     1182                struct ifnet_stat_increment_param stats;
     1183
     1184                RT_ZERO(stats);
     1185                stats.packets_in = 1;
     1186                stats.bytes_in = mbuf_len(pMBuf); /* full ethernet frame */
    11771187
    11781188                mbuf_pkthdr_setrcvif(pMBuf, pIfNet);
     
    11811191
    11821192                bpf_tap_in(pIfNet, DLT_EN10MB, pMBuf, pvEthHdr, cbEthHdr);
    1183                 errno_t err = ifnet_input(pIfNet, pMBuf, NULL);
     1193                errno_t err = ifnet_input(pIfNet, pMBuf, &stats);
    11841194                if (err)
    11851195                    rc = RTErrConvertFromErrno(err);
Note: See TracChangeset for help on using the changeset viewer.

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