VirtualBox

vbox的更動 68500 路徑 trunk/src/VBox/HostDrivers


忽略:
時間撮記:
2017-8-22 上午10:16:26 (7 年 以前)
作者:
vboxsync
訊息:

NetLwf/Win: (bugref:8976) Align outgoing packets at word boundary.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetLwf-win.cpp

    r68112 r68500  
    13961396        return NULL;
    13971397    }
     1398    const ULONG cbAlignmentMask = sizeof(USHORT) - 1; /* Microsoft LB/FO provider expects packets to be aligned at word boundary. */
     1399    ULONG cbAlignedFrame = (pSG->cbTotal + cbAlignmentMask) & ~cbAlignmentMask;
     1400    Assert(cbAlignedFrame >= pSG->cbTotal);
     1401    Assert(cbFrame >= cbAlignedFrame);
    13981402    NET_BUFFER *pBuffer = NET_BUFFER_LIST_FIRST_NB(pBufList);
    1399     NDIS_STATUS Status = NdisRetreatNetBufferDataStart(pBuffer, pSG->cbTotal, 0 /** @todo DataBackfill */, NULL);
     1403    NDIS_STATUS Status = NdisRetreatNetBufferDataStart(pBuffer, cbAlignedFrame, 0 /** @todo DataBackfill */, NULL);
    14001404    if (Status == NDIS_STATUS_SUCCESS)
    14011405    {
     
    14081412                pDst += pSG->aSegs[i].cb;
    14091413            }
     1414            if (cbAlignedFrame > pSG->cbTotal)
     1415            {
     1416                Log4(("vboxNetLwfWinSGtoNB: padding %d-byte packet with %d zero bytes", pSG->cbTotal, cbAlignedFrame - pSG->cbTotal));
     1417                NdisZeroMemory(pDst, cbAlignedFrame - pSG->cbTotal);
     1418            }
    14101419            Log4(("vboxNetLwfWinSGtoNB: allocated NBL+NB 0x%p\n", pBufList));
    14111420            pBufList->SourceHandle = pModule->hFilter;
     
    14141423        {
    14151424            LogError(("vboxNetLwfWinSGtoNB: failed to obtain the buffer pointer (size=%u)\n", pSG->cbTotal));
    1416             NdisAdvanceNetBufferDataStart(pBuffer, pSG->cbTotal, false, NULL); /** @todo why bother? */
     1425            NdisAdvanceNetBufferDataStart(pBuffer, cbAlignedFrame, false, NULL); /** @todo why bother? */
    14171426            NdisFreeNetBufferList(pBufList);
    14181427            pBufList = NULL;
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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