diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-28 20:33:24 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-28 20:33:24 +0200 |
commit | a2ad0ae5fcdb0d2e95b32b68961bef4033a1a27c (patch) | |
tree | be1fcc70f90dcdeb7fc707d0aa9d9ba16f1cbb14 /Kernel/Net | |
parent | f5ac4da993af6512041f060e95d3e1c2be13d93b (diff) | |
download | serenity-a2ad0ae5fcdb0d2e95b32b68961bef4033a1a27c.zip |
Net: Fix IPv4 fragmentation not working for larger payloads
We were masking the fragment offset bits incorrectly in the IPv4 header
sent out with fragments. This worked up to ~32KB but after that, things
would get very confused. :^)
Diffstat (limited to 'Kernel/Net')
-rw-r--r-- | Kernel/Net/IPv4.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Net/IPv4.h b/Kernel/Net/IPv4.h index 096670deaa..89e5793519 100644 --- a/Kernel/Net/IPv4.h +++ b/Kernel/Net/IPv4.h @@ -81,7 +81,7 @@ public: const void* payload() const { return this + 1; } u16 flags_and_fragment() const { return m_flags_and_fragment; } - u16 fragment_offset() const { return ((u16)m_flags_and_fragment & 0x2fff); } + u16 fragment_offset() const { return ((u16)m_flags_and_fragment & 0x1fff); } u16 flags() const { return (((u16)m_flags_and_fragment) & (((u16)IPv4PacketFlags::MoreFragments) | ((u16)IPv4PacketFlags::DontFragment))); } void set_has_more_fragments(bool more_fragments) @@ -93,13 +93,13 @@ public: } void set_fragment_offset(u16 offset) { - m_flags_and_fragment = flags() | (offset & 0x2fff); + m_flags_and_fragment = flags() | (offset & 0x1fff); } bool is_a_fragment() const { // either has More-Fragments set, or has a fragment offset - return (((u16)m_flags_and_fragment) & ((u16)IPv4PacketFlags::MoreFragments)) || ((u16)m_flags_and_fragment & 0x2fff); + return (((u16)m_flags_and_fragment) & ((u16)IPv4PacketFlags::MoreFragments)) || ((u16)m_flags_and_fragment & 0x1fff); } u16 payload_size() const { return m_length - sizeof(IPv4Packet); } |