VirtualBox

Ignore:
Timestamp:
Nov 21, 2017 8:07:22 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119216
Message:

Linux/NetFlt: (bugref:8599) Fixed duplicate EtherType when re-inserting VLAN tags stripped by hardware

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r69539 r69797  
    867867        Assert(ETH_ALEN * 2 + VLAN_HLEN <= cbExtra);
    868868        memmove(pVHdr, pMac, ETH_ALEN * 2);
    869         cbConsumed += ETH_ALEN * 2;
     869        /* Consume whole Ethernet header: 2 addresses + EtherType (see @bugref{8599}) */
     870        cbConsumed += ETH_ALEN * 2 + sizeof(uint16_t);
    870871        pVHdr->h_vlan_proto = RT_H2N_U16(ETH_P_8021Q);
    871872        pVHdr->h_vlan_TCI   = RT_H2N_U16(vlan_tx_tag_get(pBuf));
     
    898899
    899900    if (!pGsoCtx)
    900         IntNetSgInitTempSegs(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/);
     901        IntNetSgInitTempSegs(pSG, pBuf->len + cbProduced - cbConsumed, cSegs, 0 /*cSegsUsed*/);
    901902    else
    902         IntNetSgInitTempSegsGso(pSG, pBuf->len, cSegs, 0 /*cSegsUsed*/, pGsoCtx);
     903        IntNetSgInitTempSegsGso(pSG, pBuf->len + cbProduced - cbConsumed, cSegs, 0 /*cSegsUsed*/, pGsoCtx);
    903904
    904905    int iSeg = 0;
     
    956957
    957958    pSG->cSegsUsed = iSeg;
     959
     960#if 0
     961    if (cbProduced)
     962    {
     963        LogRel(("vboxNetFltLinuxSkBufToSG: original packet dump:\n%.*Rhxd\n", pBuf->len-pBuf->data_len, skb_mac_header(pBuf)));
     964        LogRel(("vboxNetFltLinuxSkBufToSG: cbConsumed=%u cbProduced=%u cbExtra=%u\n", cbConsumed, cbProduced, cbExtra));
     965        uint32_t offset = 0;
     966        for (i = 0; i < pSG->cSegsUsed; ++i)
     967        {
     968            LogRel(("vboxNetFltLinuxSkBufToSG: seg#%d (%d bytes, starting at 0x%x):\n%.*Rhxd\n",
     969                    i, pSG->aSegs[i].cb, offset, pSG->aSegs[i].cb, pSG->aSegs[i].pv));
     970            offset += pSG->aSegs[i].cb;
     971        }
     972    }
     973#endif
    958974
    959975#ifdef PADD_RUNT_FRAMES_FROM_HOST
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