mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
tcp: fix checksum calculation bug
The new function in_delayed_cksum_o() was introduced to compute
the checksum in the case the mbuf chain does not start with the
IP header. The offset of the IP header is specified by the
parameter iph_offset.
If iph_offset was positive, the function computed an incorrect
checksum.
Reviewed by: sobomax, tuexen
Fixes: 5feb38e378 ("netinet: provide "at offset" variant of the in_delayed_cksum() API")
Differential Revision: https://reviews.freebsd.org/D54269
(cherry picked from commit c8b3b605ae854ead6c8804e0400d80cb8fa73fdf)
This commit is contained in:
parent
1877dad3cf
commit
fc112dc6eb
1 changed files with 2 additions and 2 deletions
|
|
@ -1083,8 +1083,8 @@ in_delayed_cksum_o(struct mbuf *m, uint16_t iph_offset)
|
|||
if (csum == 0)
|
||||
csum = 0xffff;
|
||||
} else {
|
||||
cklen = ntohs(ip->ip_len);
|
||||
csum = in_cksum_skip(m, cklen, offset);
|
||||
cklen = ntohs(ip->ip_len) - (ip->ip_hl << 2);
|
||||
csum = in_cksum_skip(m, cklen + offset, offset);
|
||||
}
|
||||
offset += m->m_pkthdr.csum_data; /* checksum offset */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue