MSS is used in the TCP protocol. It determines the maximum size of a TCP segment that can be sent over a network, excluding the TCP header and IP header (the non-header portion of the packet).

MTU - (TCP header + IP header) = MSS

image.png

image.png

MSS Announcement

  • shared during tcp handshake
  • default: 536
    • MTU = 576
    • MDDS = MTU - IPHdrLen = 576 - 20 = 556
    • MSS = MDDS - TCPHdrLen = 556 - 20 = 536
    • MDDS: Maximum Datagram Data Size

How to Know MSS

  • The Network Driver (ND) or interface should know the MTU of the directly attached network.
  • The IP should ask the Network Driver for the Maximum Transmission Unit.
  • The TCP should ask the IP for the Maximum Datagram Data Size (MDDS). This is the MTU minus the IP header length (MDDS = MTU - IPHdrLen).
  • When opening a connection, TCP can send an MSS option with the value equal to: MDDS - TCPHdrLen. In other words, the MSS value to send is: MSS = MTU - TCPHdrLen - IPHdrLen

MSS Clamping

Idea: to avoid bottleneck

  • Client/Server side
    • When TCP finished handshake, we choose the smaller one between the two.
  • MiddleBox side:
    • a router along a network path has an MTU value set lower than the typical 1,500 bytes. This can result in packet loss and can be difficult to discover.
    • during the TCP handshake, the server can signal the MSS for packets it is willing to receive, “clamping” the maximum payload size from the other server.