VirtualBox

Ignore:
Timestamp:
Jul 31, 2008 5:20:59 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33933
Message:

iprt/RTNetIPv4: The checksums are in network endian, corrected the validators.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/checksum/ipv4.cpp

    r11013 r11038  
    4040 * Calculates the checksum of the IPv4 header.
    4141 *
    42  * @returns Checksum.
     42 * @returns Checksum (network endian).
    4343 * @param   pIpHdr      Pointer to the IPv4 header to checksum, network endian (big).
    4444 *                      Assumes the caller already checked the minimum size requirement.
     
    120120     */
    121121    uint16_t u16Sum = RTNetIPv4HdrChecksum(pIpHdr);
    122     if (RT_UNLIKELY(RT_BE2H_U16(pIpHdr->ip_sum) != u16Sum))
     122    if (RT_UNLIKELY(pIpHdr->ip_sum != u16Sum))
    123123        return false;
    124124    return true;
     
    348348 * Finalizes a IPv4 checksum [inlined].
    349349 *
    350  * @returns The checksum.
     350 * @returns The checksum (network endian).
    351351 * @param   u32Sum          The 32-bit intermediate checksum value.
    352352 */
     
    363363 * Finalizes a IPv4 checksum.
    364364 *
    365  * @returns The checksum.
     365 * @returns The checksum (network endian).
    366366 * @param   u32Sum          The 32-bit intermediate checksum value.
    367367 */
     
    370370    return rtNetIPv4FinalizeChecksum(u32Sum);
    371371}
    372 
    373372
    374373
     
    377376 * UDP header and payload.
    378377 *
    379  * @returns The checksum.
     378 * @returns The checksum (network endian).
    380379 * @param   pIpHdr          Pointer to the IPv4 header, in network endian (big).
    381380 * @param   pUdpHdr         Pointer to the UDP header, in network endian (big).
     
    450449        return false;
    451450    uint16_t u16Sum = RTNetIPv4UDPChecksum(pIpHdr, pUdpHdr, pvData);
    452     if (RT_UNLIKELY(RT_BE2H_U16(pUdpHdr->uh_sum) != u16Sum))
     451    if (RT_UNLIKELY(pUdpHdr->uh_sum != u16Sum))
    453452        return false;
    454453    return true;
    455454}
     455
     456
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