mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 16:10:20 +00:00
Kernel: Make sure outgoing ICMP packets have the correct checksum
The internet_checksum() function relies on the buffer - or at least the checksum field - to be all zeroes.
This commit is contained in:
parent
c4c577b2bf
commit
7f7897c900
Notes:
sideshowbarker
2024-07-18 16:56:43 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/7f7897c9001 Pull-request: https://github.com/SerenityOS/serenity/pull/7741
1 changed files with 1 additions and 0 deletions
|
@ -253,6 +253,7 @@ void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet,
|
|||
return;
|
||||
}
|
||||
adapter->fill_in_ipv4_header(*packet, adapter->ipv4_address(), eth.source(), ipv4_packet.source(), IPv4Protocol::ICMP, icmp_packet_size, 64);
|
||||
memset(packet->buffer.data() + ipv4_payload_offset, 0, sizeof(ICMPEchoPacket));
|
||||
auto& response = *(ICMPEchoPacket*)(packet->buffer.data() + ipv4_payload_offset);
|
||||
response.header.set_type(ICMPType::EchoReply);
|
||||
response.header.set_code(0);
|
||||
|
|
Loading…
Reference in a new issue