Changeset 73097 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Jul 12, 2018 9:06:33 PM (7 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r69500 r73097 134 134 135 135 /** Converts a pointer to TAP::INetworkUp to a PRDVTAP. */ 136 #define PDMINETWORKUP_2_DRVTAP(pInterface) ( (PDRVTAP)((uintptr_t)pInterface - RT_ OFFSETOF(DRVTAP, INetworkUp)) )136 #define PDMINETWORKUP_2_DRVTAP(pInterface) ( (PDRVTAP)((uintptr_t)pInterface - RT_UOFFSETOF(DRVTAP, INetworkUp)) ) 137 137 138 138 -
trunk/src/VBox/Devices/Network/DrvUDPTunnel.cpp
r69500 r73097 101 101 102 102 /** Converts a pointer to UDPTUNNEL::INetworkUp to a PRDVUDPTUNNEL. */ 103 #define PDMINETWORKUP_2_DRVUDPTUNNEL(pInterface) ( (PDRVUDPTUNNEL)((uintptr_t)pInterface - RT_ OFFSETOF(DRVUDPTUNNEL, INetworkUp)) )103 #define PDMINETWORKUP_2_DRVUDPTUNNEL(pInterface) ( (PDRVUDPTUNNEL)((uintptr_t)pInterface - RT_UOFFSETOF(DRVUDPTUNNEL, INetworkUp)) ) 104 104 105 105 -
trunk/src/VBox/Devices/Network/DrvVDE.cpp
r69500 r73097 107 107 108 108 /** Converts a pointer to VDE::INetworkUp to a PRDVVDE. */ 109 #define PDMINETWORKUP_2_DRVVDE(pInterface) ( (PDRVVDE)((uintptr_t)pInterface - RT_ OFFSETOF(DRVVDE, INetworkUp)) )109 #define PDMINETWORKUP_2_DRVVDE(pInterface) ( (PDRVVDE)((uintptr_t)pInterface - RT_UOFFSETOF(DRVVDE, INetworkUp)) ) 110 110 111 111 -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r69500 r73097 2108 2108 { 2109 2109 PINTNETDSTTAB pDstTab; 2110 *ppDstTab = pDstTab = (PINTNETDSTTAB)RTMemAlloc(RT_ OFFSETOF(INTNETDSTTAB, aIfs[cEntries]));2110 *ppDstTab = pDstTab = (PINTNETDSTTAB)RTMemAlloc(RT_UOFFSETOF_DYN(INTNETDSTTAB, aIfs[cEntries])); 2111 2111 if (RT_UNLIKELY(!pDstTab)) 2112 2112 return VERR_NO_MEMORY; … … 2523 2523 { 2524 2524 /* check if the protocol is UDP */ 2525 if ( intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETIPV4, ip_p))2525 if ( intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETIPV4, ip_p)) 2526 2526 != RTNETIPV4_PROT_UDP) 2527 2527 return; … … 2547 2547 { 2548 2548 /* get the lower byte of the UDP source port number. */ 2549 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_ OFFSETOF(RTNETUDP, uh_sport) + 1);2549 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_UOFFSETOF(RTNETUDP, uh_sport) + 1); 2550 2550 if ( b != RTNETIPV4_PORT_BOOTPS 2551 2551 && b != RTNETIPV4_PORT_BOOTPC) 2552 2552 return; 2553 2553 uint8_t SrcPort = b; 2554 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_ OFFSETOF(RTNETUDP, uh_sport));2554 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_UOFFSETOF(RTNETUDP, uh_sport)); 2555 2555 if (b) 2556 2556 return; 2557 2557 2558 2558 /* get the lower byte of the UDP destination port number. */ 2559 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_ OFFSETOF(RTNETUDP, uh_dport) + 1);2559 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_UOFFSETOF(RTNETUDP, uh_dport) + 1); 2560 2560 if ( b != RTNETIPV4_PORT_BOOTPS 2561 2561 && b != RTNETIPV4_PORT_BOOTPC) … … 2563 2563 if (b == SrcPort) 2564 2564 return; 2565 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_ OFFSETOF(RTNETUDP, uh_dport));2565 b = intnetR0SgReadByte(pSG, sizeof(RTNETETHERHDR) + cbIpHdr + RT_UOFFSETOF(RTNETUDP, uh_dport)); 2566 2566 if (b) 2567 2567 return; … … 3223 3223 { 3224 3224 uint16_t ar_oper; 3225 if (!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETARPHDR, ar_oper),3225 if (!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETARPHDR, ar_oper), 3226 3226 sizeof(ar_oper), &ar_oper)) 3227 3227 return false; … … 3242 3242 { 3243 3243 RTNETADDRIPV4 ip_dst; 3244 if (!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETIPV4, ip_dst),3244 if (!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETIPV4, ip_dst), 3245 3245 sizeof(ip_dst), &ip_dst)) 3246 3246 return false; … … 3272 3272 { 3273 3273 RTNETADDRIPV6 ip6_dst; 3274 if (!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETIPV6, ip6_dst),3274 if (!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETIPV6, ip6_dst), 3275 3275 sizeof(ip6_dst), &ip6_dst)) 3276 3276 return false; … … 3295 3295 * Update ethernet destination in the segment. 3296 3296 */ 3297 intnetR0SgWritePart(pSG, RT_ OFFSETOF(RTNETETHERHDR, DstMac), sizeof(pEthHdr->DstMac), &pEthHdr->DstMac);3297 intnetR0SgWritePart(pSG, RT_UOFFSETOF(RTNETETHERHDR, DstMac), sizeof(pEthHdr->DstMac), &pEthHdr->DstMac); 3298 3298 3299 3299 return true; … … 3424 3424 pEthHdr->DstMac = pIf->MacAddr; 3425 3425 if ((void *)pEthHdr != pSG->aSegs[0].pv) 3426 intnetR0SgWritePart(pSG, RT_ OFFSETOF(RTNETETHERHDR, DstMac), sizeof(RTMAC), &pIf->MacAddr);3426 intnetR0SgWritePart(pSG, RT_UOFFSETOF(RTNETETHERHDR, DstMac), sizeof(RTMAC), &pIf->MacAddr); 3427 3427 } 3428 3428 intnetR0BusyDecIf(pIf); … … 3557 3557 Log(("intnetR0NetworkEditDhcpFromIntNet: cleared ip_tos (was %#04x); ip_sum=%#06x -> %#06x\n", 3558 3558 uTos, RT_BE2H_U16(pIpHdr->ip_sum), RT_BE2H_U16(uChecksum) )); 3559 intnetR0SgWritePart(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETIPV4, ip_sum),3559 intnetR0SgWritePart(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETIPV4, ip_sum), 3560 3560 sizeof(pIpHdr->ip_sum), &uChecksum); 3561 3561 } … … 3750 3750 { 3751 3751 case RTNET_ETHERTYPE_IPV4: 3752 if (RT_UNLIKELY(!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETIPV4, ip_dst), sizeof(Addr.IPv4), &Addr)))3752 if (RT_UNLIKELY(!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETIPV4, ip_dst), sizeof(Addr.IPv4), &Addr))) 3753 3753 { 3754 3754 Log(("intnetshareduni: failed to read ip_dst! cbTotal=%#x\n", pSG->cbTotal)); … … 3761 3761 3762 3762 case RTNET_ETHERTYPE_IPV6: 3763 if (RT_UNLIKELY(!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_ OFFSETOF(RTNETIPV6, ip6_dst), sizeof(Addr.IPv6), &Addr)))3763 if (RT_UNLIKELY(!intnetR0SgReadPart(pSG, sizeof(RTNETETHERHDR) + RT_UOFFSETOF(RTNETIPV6, ip6_dst), sizeof(Addr.IPv6), &Addr))) 3764 3764 { 3765 3765 Log(("intnetshareduni: failed to read ip6_dst! cbTotal=%#x\n", pSG->cbTotal)); … … 5774 5774 */ 5775 5775 RTCPUID cCpus = RTMpGetCount(); Assert(cCpus > 0); 5776 PINTNETTRUNKIF pTrunk = (PINTNETTRUNKIF)RTMemAllocZ(RT_ OFFSETOF(INTNETTRUNKIF, apIntDstTabs[cCpus]));5776 PINTNETTRUNKIF pTrunk = (PINTNETTRUNKIF)RTMemAllocZ(RT_UOFFSETOF_DYN(INTNETTRUNKIF, apIntDstTabs[cCpus])); 5777 5777 if (!pTrunk) 5778 5778 return VERR_NO_MEMORY; -
trunk/src/VBox/Devices/Network/slirp/bootp.c
r70842 r73097 863 863 size_t vlen; 864 864 865 if (mlen < RT_ OFFSETOF(struct bootp_t, bp_vend) + sizeof(rfc1533_cookie))865 if (mlen < RT_UOFFSETOF(struct bootp_t, bp_vend) + sizeof(rfc1533_cookie)) 866 866 { 867 867 LogRelMax(50, ("NAT: ignoring invalid BOOTP request (mlen %u too short)\n", mlen)); … … 893 893 } 894 894 895 vlen = mlen - RT_ OFFSETOF(struct bootp_t, bp_vend);895 vlen = mlen - RT_UOFFSETOF(struct bootp_t, bp_vend); 896 896 dhcp_decode(pData, bp, vlen); 897 897 } -
trunk/src/VBox/Devices/Network/slirp/ip_icmpwin.c
r69500 r73097 155 155 bufsize += 16; /* whatever that is; empirically at least XP needs it */ 156 156 157 pongsize = RT_ OFFSETOF(struct pong, buf) + bufsize;157 pongsize = RT_UOFFSETOF(struct pong, buf) + bufsize; 158 158 if (pData->cbIcmpPending + pongsize > 1024 * 1024) 159 159 return; … … 327 327 size_t sz; 328 328 329 sz = RT_ OFFSETOF(struct pong, buf) + pong->bufsize;329 sz = RT_UOFFSETOF(struct pong, buf) + pong->bufsize; 330 330 Assert(pData->cbIcmpPending >= sz); 331 331 pData->cbIcmpPending -= sz; -
trunk/src/VBox/Devices/Network/slirp/tftp.c
r69500 r73097 266 266 267 267 pszTftpRRQRaw = (char *)&pcTftpIpHeader->Core; 268 cbTftpRRQRaw = RT_H2N_U16(pcTftpIpHeader->UdpHdr.uh_ulen) + sizeof(struct ip) - RT_ OFFSETOF(TFTPIPHDR, Core);268 cbTftpRRQRaw = RT_H2N_U16(pcTftpIpHeader->UdpHdr.uh_ulen) + sizeof(struct ip) - RT_UOFFSETOF(TFTPIPHDR, Core); 269 269 while (cbTftpRRQRaw) 270 270 {
Note:
See TracChangeset
for help on using the changeset viewer.