Bug 32717

Summary: ppp(8) change mss to wrong size
Product: Base System Reporter: MORI Kouji <moriko>
Component: binAssignee: Brian Somers <brian>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-RELEASE   
Hardware: Any   
OS: Any   

Description MORI Kouji 2001-12-12 03:10:01 UTC
ppp(8) rewrite mss information in tcp packet, and the size is calculated
the follow equation.

  mss = mtu - 20 (ip header) - 20 (tcp header)

but, enable rfc1323 (sysctl -w net.inet.tcp.rfc1323=1),
tcp header has timestamp in the option field.  so, over 20 octets.
some cases, the tcp header length is 32 (20+12) octets.

in the worst case, tcp header length is 60 octets. (see. rfc 879)

same problem may happen for ip header, but maybe ip header option
is not used with tcp packet, no problem.

Fix: 

this patch is for ppp(8) src/usr.sbin/ppp/tcpmss.c

--- tcpmss.c    2001/07/19 11:39:54     1.1.4.3
+++ tcpmss.c    2001/12/12 00:10:44
@@ -67,7 +67,7 @@
  * We are in a liberal position about MSS
  * (RFC 879, section 7).
  */
-#define MAXMSS(mtu) (mtu - sizeof(struct ip) - sizeof(struct tcphdr)) 
+#define MAXMSS(mtu) (mtu - sizeof(struct ip) - sizeof(struct tcphdr) - 12) 
 
 
 /*-

after patch, I tested.  mtu is 1454.

09:38:24.207511 PPPoE  [ses 0x1395] IP 62: myhost.4826 > remotehost.80: S 3329176101:3329176101(0) win 16384 <mss 1402,nop,wscale 0,nop,nop,timestamp 33339458 0> (DF)

patched ppp(8) send <mss 1402> to remotehost.

09:38:24.542333 PPPoE  [ses 0x1395] IP 1456: 204.152.186.171.80 > xxx.xxx.xxx.xxx.4826: . 1:1403(1402) ack 192 win 33580 <nop,nop,timestamp 2964938 33339474>

received tcp packet is 1402 octets,
and the ip packet length is 1454 (but not printed here, sorry).
How-To-Repeat: in my case, my FreeBSD talk to web site (www.netbsd.org) via tcp over
pppoe (mtu is 1454), then ppp(8) rewrite mss length to 1414 (= 1454 - 20 - 20).
web site send tcp packet size of 1456 octets, and the packet is fragmented.
because 1456 > 1454 (mtu).

next, I disable rfc1323 extention (stsctl -l net.inet.tcp.rfc1323=0),
connect to the same host.  packet is not fragmented.
Comment 1 Brian Somers freebsd_committer freebsd_triage 2001-12-12 03:38:59 UTC
Responsible Changed
From-To: freebsd-bugs->brian

I'll look after this
Comment 2 Brian Somers freebsd_committer freebsd_triage 2004-06-29 08:34:42 UTC
State Changed
From-To: open->patched

Committed to -current.  I'll MFC in 2 weeks given no problems.
Comment 3 Brian Somers freebsd_committer freebsd_triage 2004-07-15 10:46:18 UTC
State Changed
From-To: patched->closed

This has been MFC'd