mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 21:10:30 +00:00
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. :^)
This commit is contained in:
parent
f5ac4da993
commit
a2ad0ae5fc
Notes:
sideshowbarker
2024-07-19 04:29:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a2ad0ae5fcd
1 changed files with 3 additions and 3 deletions
|
@ -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); }
|
||||
|
|
Loading…
Reference in a new issue