diff options
author | Anton Kling <anton@kling.gg> | 2023-11-22 18:34:00 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-22 18:34:00 +0100 |
commit | b3866b0442f55b97833981a99c601f2143d10315 (patch) | |
tree | 2b0ae716da1e0d22311ecb119cc8d5cb2bbed822 /kernel/network/ipv4.c | |
parent | 615fb35efa8b13b7109e6974f86b295238163ebc (diff) |
Kernel/RTL8139/Networking fixes
This is just a commit containing multiple fixes since I am too lazy to
split them up.
Diffstat (limited to 'kernel/network/ipv4.c')
-rw-r--r-- | kernel/network/ipv4.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/network/ipv4.c b/kernel/network/ipv4.c index e38ab9b..9565bb5 100644 --- a/kernel/network/ipv4.c +++ b/kernel/network/ipv4.c @@ -41,8 +41,7 @@ u16 ip_checksum(void *vdata, size_t length) { } extern u8 ip_address[4]; -void send_ipv4_packet(u32 ip, u8 protocol, const u8 *payload, - u16 length) { +void send_ipv4_packet(u32 ip, u8 protocol, const u8 *payload, u16 length) { u8 header[20] = {0}; header[0] = (4 /*version*/ << 4) | (5 /*IHL*/); *((u16 *)(header + 2)) = htons(length + 20); @@ -74,7 +73,8 @@ void handle_ipv4(const u8 *payload, u32 packet_length) { *(u16 *)(payload + 10) = 0; u16 calc_checksum = ip_checksum((u8 *)payload, 20); *(u16 *)(payload + 10) = saved_checksum; - assert(calc_checksum == saved_checksum); + if(calc_checksum != saved_checksum) + return; u8 version = (*payload & 0xF0) >> 4; u8 IHL = (*payload & 0xF); |