VirtualBox

Ignore:
Timestamp:
Apr 7, 2010 11:20:09 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59780
Message:

VBoxNetFlt: Deal with multi segment SG buffers. TODO: One weird windows code path.

File:
1 edited

Legend:

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

    r28025 r28070  
    386386        {
    387387            mbuf_setlen(pCur, pSG->cbTotal);
    388             memcpy(mbuf_data(pCur), pSG->aSegs[0].pv, pSG->cbTotal);
     388            INTNETSgRead(pSG, mbuf_data(pCur));
    389389        }
    390390        else
    391391        {
    392392            /* Multi buffer copying. */
    393             size_t         cbSrc = pSG->cbTotal;
    394             uint8_t const *pbSrc = (uint8_t const *)pSG->aSegs[0].pv;
    395             while (cbSrc > 0 && pCur)
     393            size_t  cbLeft = pSG->cbTotal;
     394            size_t  offSrc = 0;
     395            while (cbLeft > 0 && pCur)
    396396            {
    397397                size_t cb = mbuf_maxlen(pCur);
    398                 if (cbSrc < cb)
    399                     cb = cbSrc;
     398                if (cb > cbLeft)
     399                    cb = cbLeft;
    400400                mbuf_setlen(pCur, cb);
    401                 memcpy(mbuf_data(pCur), pbSrc, cb);
     401                INTNETSgReadEx(pSG, off, cb, mbuf_data(pCur));
    402402
    403403                /* advance */
    404                 pbSrc += cb;
    405                 cbSrc -= cb;
     404                offSrc += cb;
     405                cbLeft -= cb;
    406406                pCur = mbuf_next(pCur);
    407407            }
     408            Assert(cbSrc == 0);
    408409        }
    409410        if (!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