Subject: kern/14806: Trivial: Default TCP MSS is wrong (patch included)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rb-netbsd@bigscarychildren.net>
List: netbsd-bugs
Date: 12/02/2001 00:28:33
	Note: There was a bad value `not-critical' for the field `>Severity:'.
	It was set to the default value of `serious'.


>Number:         14806
>Category:       kern
>Synopsis:       NetBSD uses the wrong default TCP MSS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 01 21:29:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Rick Byers
>Release:        NetBSD 1.5Y
>Organization:
	
>Environment:
	
	
System: NetBSD Rick.Apenheul.BigScaryChildren.net 1.5Y NetBSD 1.5Y (RICK) #0: Fri Nov 30 23:44:58 EST 2001 rick@Rick.Apenheul.BigScaryChildren.net:/usr/src/sys/arch/i386/compile/RICK i386
Architecture: i386
Machine: i386
>Description:
	When a TCP connection is established and the peer doesn't 
	advertise an MSS, NetBSD uses 512.  This is in violation
	of RFC 1122 Sec 4.2.2.6 which says "If an MSS option is not 
	received at connection setup, TCP MUST assume a default send MSS 
	of 536".

	Most (all?) TCP stacks today send an MSS option, but regardless
	this behaviour is wrong.  Even though using a smaller send
	MSS than advertised is OK, there doesn't appear to be any
	advantage to doing so.

	The code says that "512 may be more convenient".  This may be
	legacy code from when the VAX would use 512 byte segments 
	so that the data block could be mapped directly into memory.

>How-To-Repeat:
	Send a TCP syn packet without an MSS option and watch to see
	what the maximum return segment size is.
>Fix:
This patch corrects the default TCP MSS to 536, as defined by 
RFC 1122.

Index: tcp.h
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/tcp.h,v
retrieving revision 1.13
diff -c -r1.13 tcp.h
*** tcp.h	2001/05/26 21:40:55	1.13
--- tcp.h	2001/12/02 05:16:32
***************
*** 90,100 ****
  
  /*
   * Default maximum segment size for TCP.
!  * With an IP MSS of 576, this is 536,
!  * but 512 is probably more convenient.
!  * This should be defined as min(512, IP_MSS - sizeof (struct tcpiphdr)).
   */
! #define	TCP_MSS		512
  
  #define	TCP_MAXWIN	65535	/* largest value for (unscaled) window */
  
--- 90,98 ----
  
  /*
   * Default maximum segment size for TCP.
!  * This is defined by RFC 1112 Sec 4.2.2.6
   */
! #define	TCP_MSS		536
  
  #define	TCP_MAXWIN	65535	/* largest value for (unscaled) window */
  
	
>Release-Note:
>Audit-Trail:
>Unformatted: