mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-11 18:36:41 +00:00
Fix bug #54506 (LWIP_CHECKSUM_ON_COPY causes wrong checksum (0xFFFF))
one's complement sum was not correctly done, which could result in the checksum being 0xFFFF instead of 0 in some cases.
This commit is contained in:
parent
cdfa3dfa9d
commit
bc48eb512e
@ -1585,8 +1585,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
seg->chksum = SWAP_BYTES_IN_WORD(seg->chksum);
|
||||
seg->chksum_swapped = 0;
|
||||
}
|
||||
acc += (u16_t)~(seg->chksum);
|
||||
seg->tcphdr->chksum = FOLD_U32T(acc);
|
||||
acc = (u16_t)~acc + seg->chksum;
|
||||
seg->tcphdr->chksum = (u16_t)~FOLD_U32T(acc);
|
||||
#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK
|
||||
if (chksum_slow != seg->tcphdr->chksum) {
|
||||
TCP_CHECKSUM_ON_COPY_SANITY_CHECK_FAIL(
|
||||
|
Loading…
Reference in New Issue
Block a user