VirtualBox

Ignore:
Timestamp:
Jul 12, 2018 9:06:33 PM (6 years ago)
Author:
vboxsync
Message:

*: Made RT_UOFFSETOF, RT_OFFSETOF, RT_UOFFSETOF_ADD and RT_OFFSETOF_ADD work like builtin_offsetof() and require compile time resolvable requests, adding RT_UOFFSETOF_DYN for the dynamic questions that can only be answered at runtime.

File:
1 edited

Legend:

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

    r70708 r73097  
    653653    else if (pSG->cbTotal >= sizeof(RTNETETHERHDR))
    654654    {
    655         uint32_t off = RT_OFFSETOF(RTNETETHERHDR, EtherType);
     655        uint32_t off = RT_UOFFSETOF(RTNETETHERHDR, EtherType);
    656656        uint32_t i;
    657657        for (i = 0; i < pSG->cSegsUsed; ++i)
     
    768768        pPkt->csum_start = skb_headroom(pPkt) + pSG->GsoCtx.offHdr2;
    769769        if (fGsoType & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))
    770             pPkt->csum_offset = RT_OFFSETOF(RTNETTCP, th_sum);
     770            pPkt->csum_offset = RT_UOFFSETOF(RTNETTCP, th_sum);
    771771        else
    772             pPkt->csum_offset = RT_OFFSETOF(RTNETUDP, uh_sum);
     772            pPkt->csum_offset = RT_UOFFSETOF(RTNETUDP, uh_sum);
    773773# else
    774774        pPkt->h.raw = pPkt->data + pSG->GsoCtx.offHdr2;
    775775        if (fGsoType & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))
    776             pPkt->csum = RT_OFFSETOF(RTNETTCP, th_sum);
     776            pPkt->csum = RT_UOFFSETOF(RTNETTCP, th_sum);
    777777        else
    778             pPkt->csum = RT_OFFSETOF(RTNETUDP, uh_sum);
     778            pPkt->csum = RT_UOFFSETOF(RTNETUDP, uh_sum);
    779779# endif
    780780        if (!fDstWire)
     
    14571457    unsigned    cbExtra;
    14581458    unsigned    cSegs = vboxNetFltLinuxCalcSGSegments(pSkb, &cbExtra);
    1459     PINTNETSG pSG = (PINTNETSG)alloca(RT_OFFSETOF(INTNETSG, aSegs[cSegs]) + cbExtra);
     1459    PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs]) + cbExtra);
    14601460    if (RT_LIKELY(pSG))
    14611461    {
     
    14911491    unsigned    cbExtra;
    14921492    unsigned    cSegs = vboxNetFltLinuxCalcSGSegments(pBuf, &cbExtra);
    1493     PINTNETSG pSG = (PINTNETSG)alloca(RT_OFFSETOF(INTNETSG, aSegs[cSegs]) + cbExtra);
     1493    PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs]) + cbExtra);
    14941494    if (RT_LIKELY(pSG))
    14951495    {
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