mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
Kernel: Set MSS option for outbound TCP SYN packets
When the MSS option header is missing the default maximum segment size is 536 which results in lots of very small TCP packets that NetworkTask has to handle. This adds the MSS option header to outbound TCP SYN packets and sets it to an appropriate value depending on the interface's MTU. Note that we do not currently do path MTU discovery so this could cause problems when hops don't fragment packets properly.
This commit is contained in:
parent
5feeb62843
commit
aff4d22de9
3 changed files with 40 additions and 16 deletions
|
@ -21,6 +21,23 @@ struct TCPFlags {
|
|||
};
|
||||
};
|
||||
|
||||
class [[gnu::packed]] TCPOptionMSS {
|
||||
public:
|
||||
TCPOptionMSS(u16 value)
|
||||
: m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
u16 value() const { return m_value; }
|
||||
|
||||
private:
|
||||
u8 m_option_kind { 0x02 };
|
||||
u8 m_option_length { sizeof(TCPOptionMSS) };
|
||||
NetworkOrdered<u16> m_value;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TCPOptionMSS) == 4);
|
||||
|
||||
class [[gnu::packed]] TCPPacket {
|
||||
public:
|
||||
TCPPacket() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue