1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:37:34 +00:00

Kernel: Fix up the ICMP implementation to generate correct Echo replies.

Serenity now responds to ping. :^)
This commit is contained in:
Andreas Kling 2019-03-12 11:44:38 +01:00
parent 75e0ddd46a
commit 9858be636f
5 changed files with 66 additions and 28 deletions

View file

@ -14,7 +14,7 @@ NetworkAdapter::~NetworkAdapter()
void NetworkAdapter::send(const MACAddress& destination, const ARPPacket& packet)
{
int size_in_bytes = sizeof(EthernetFrameHeader) + sizeof(ARPPacket) + sizeof(EthernetFrameCheckSequence);
int size_in_bytes = sizeof(EthernetFrameHeader) + sizeof(ARPPacket);
auto* eth = (EthernetFrameHeader*)kmalloc(size_in_bytes);
eth->set_source(mac_address());
eth->set_destination(destination);
@ -26,7 +26,7 @@ void NetworkAdapter::send(const MACAddress& destination, const ARPPacket& packet
void NetworkAdapter::send_ipv4(const MACAddress& destination, const void* packet, size_t packet_size)
{
size_t size_in_bytes = sizeof(EthernetFrameHeader) + packet_size + sizeof(EthernetFrameCheckSequence);
size_t size_in_bytes = sizeof(EthernetFrameHeader) + packet_size;
auto* eth = (EthernetFrameHeader*)kmalloc(size_in_bytes);
eth->set_source(mac_address());
eth->set_destination(destination);