mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
icmp: fix checksum on replies of echo request with ID 0, sequence 0 and either no data or any amount of 0x00 Bytes as data (closes: #45322)
When a client sends an ICMP echo request with ID 0, sequence 0 and either no data or any amount of 0x00 bytes as data, the checksum in the reply is wrong (off-by-one). Expected checksum is 0xffff in that case, observed is 0x0000.
This commit is contained in:
parent
232cf8c28b
commit
7856141fc4
@ -196,7 +196,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
ICMPH_TYPE_SET(iecho, ICMP_ER);
|
||||
#if CHECKSUM_GEN_ICMP
|
||||
/* adjust the checksum */
|
||||
if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
|
||||
if (iecho->chksum > PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
|
||||
iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
|
||||
} else {
|
||||
iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user