Skip to main content

Module checksum

Module checksum 

Source
Expand description

TCP checksum calculation.

TCP uses the Internet checksum (RFC 1071) computed over a pseudo-header followed by the TCP header and payload.

§IPv4 Pseudo-header

+--------+--------+--------+--------+
|           Source Address          |
+--------+--------+--------+--------+
|         Destination Address       |
+--------+--------+--------+--------+
|  zero  |  PTCL  |    TCP Length   |
+--------+--------+--------+--------+

§IPv6 Pseudo-header

+--------+--------+--------+--------+
|                                   |
+                                   +
|           Source Address          |
+                                   +
|                                   |
+                                   +
|                                   |
+--------+--------+--------+--------+
|                                   |
+                                   +
|         Destination Address       |
+                                   +
|                                   |
+                                   +
|                                   |
+--------+--------+--------+--------+
|         Upper-Layer Packet Length |
+--------+--------+--------+--------+
|           zero          |Next Hdr|
+--------+--------+--------+--------+

Constants§

TCP_PROTOCOL
TCP protocol number for pseudo-header.

Functions§

ipv4_pseudo_header
Build the IPv4 pseudo-header bytes for TCP.
ipv6_pseudo_header
Build the IPv6 pseudo-header bytes for TCP.
tcp_checksum
Compute TCP checksum (generic version).
tcp_checksum_ipv4
Compute TCP checksum with IPv4 pseudo-header.
tcp_checksum_ipv6
Compute TCP checksum with IPv6 pseudo-header.
tcp_partial_checksum
Compute checksum for partial data (for segmented computation).
verify_tcp_checksum
Verify TCP checksum with IPv4 pseudo-header.
verify_tcp_checksum_ipv6
Verify TCP checksum with IPv6 pseudo-header.