Maximum segment size




The maximum segment size (MSS) is a parameter of the options field of the TCP header that specifies the largest amount of data, specified in bytes, that a computer or communications device can receive in a single TCP segment. It does not count the TCP header or the IP header (unlike, for example, the MTU for IP datagrams).[1] The IP datagram containing a TCP segment may be self-contained within a single packet, or it may be reconstructed from several fragmented pieces; either way, the MSS limit applies to the total amount of data contained in the final, reconstructed TCP segment.


To avoid fragmentation in the IP layer, a host must specify the maximum segment size as equal to the largest IP datagram that the host can handle minus the IP and TCP header sizes.[2] Therefore, IPv4 hosts are required to be able to handle an MSS of 536 octets (= 576[3] - 20 - 20) and IPv6 hosts are required to be able to handle an MSS of 1220 octets (= 1280[4] - 40 - 20).


Small MSS values will reduce or eliminate IP fragmentation, but will result in higher overhead.[5]


Each direction of data flow can use a different MSS.


For most computer users, the MSS option is established by the operating system.




Contents






  • 1 Default value


  • 2 Inter-Layer Communication


  • 3 MSS and PMTU


  • 4 Further reading


  • 5 See also


  • 6 References





Default value


The default TCP Maximum Segment Size is 536.[6] Where a host wishes to set the maximum segment size to a value other than the default, the maximum segment size is specified as a TCP option, initially in the TCP SYN packet during the TCP handshake. The value cannot be changed after the connection is established.[7]



Inter-Layer Communication


In order to notify MSS to the other end, an inter-layer communication is done as follows:[8]



  • The Network Driver (ND) or interface should know the Maximum Transmission Unit (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


While sending TCP segments to the other end, an inter-layer communication is done as follows:[9]



  • TCP should determine the Maximum Segment Data Size (MSDS) from either the default or the received value of the MSS option.

  • TCP should determine if source fragmentation is possible (by asking the IP) and desirable.

    • If so, TCP may hand to IP, segments (including the TCP header) up to MSDS + TCPHdrLen.

    • If not, TCP may hand to IP, segments (including the TCP header) up to the lesser of (MSDS + TCPHdrLen) and MDDS.



  • IP checks the length of data passed to it by TCP. If the length is less than or equal MDDS, IP attaches the IP header and hands it to the ND. Otherwise the IP must do source fragmentation.



MSS and PMTU


MSS is sometimes mistaken for PMTU. MSS is a concept used by TCP in the Transport layer and it specifies the largest amount of data that a computer or communications device can receive in a single TCP segment. While PMTU is used by the IP layer and it specifies the largest packet size that can be sent over this path without suffering fragmentation.



Further reading




  • Comer, Douglas E. (2006). Internetworking with TCP/IP. Vol. 1 (5/E ed.). Upper Saddle River, NJ, USA: Prentice Hall..mw-parser-output cite.citation{font-style:inherit}.mw-parser-output q{quotes:"""""""'""'"}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:inherit;padding:inherit}.mw-parser-output .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-lock-limited a,.mw-parser-output .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}


  • Kozierok, Charles M. (2005-09-20). The TCP/IP Guide (3.0 ed.). Retrieved 2011-09-08.



See also


  • Path MTU Discovery


References





  1. ^ RFC 879, page 2, Section 3, "The MSS counts only data octets in the segment, it does not count the TCP header or the IP header."


  2. ^ RFC 2460, page 28, Section 8.3


  3. ^ RFC 879, page 1, Section 1


  4. ^ RFC 2460, page 24, Section 5


  5. ^ The TCP/IP Guide, TCP Maximum Segment Size (MSS) and Relationship to IP Datagram Size


  6. ^ RFC 879, page 1, Section 1, "The default TCP Maximum Segment Size is 536."


  7. ^ RFC 793, page 19, Section 3.1, "This field must only be sent in the initial connection request (i.e., in segments with the SYN control bit set)."


  8. ^ RFC 879, page 1, Section 11


  9. ^ RFC 879, page 1, Section 11











Popular posts from this blog

Italian cuisine

Bulgarian cuisine

Carrot