Subject: Re: MSS doesn't honour route MTU
To: None <tech-net@netbsd.org>
From: Rui Paulo <rpaulo@fnop.net>
List: tech-net
Date: 06/08/2006 21:31:48
At Thu, 8 Jun 2006 21:07:32 +0300,
Mihai CHELARU wrote:
> 
> Hi,
> 
> While doing some tests I've seen that the announced MSS in a syn packet sent 
> to host doesn't honour the route MTU to that host. Here is what I done:
> 
> mpls# host www.cisco.com
> www.cisco.com has address 198.133.219.25
> mpls# route -n get 198.133.219.25
>    route to: 198.133.219.25
> destination: default
>        mask: default
>     gateway: 193.28.151.1
>  local addr: 193.28.151.36
>   interface: xennet0
>       flags: <UP,GATEWAY,DONE,STATIC>
>  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu 
> expire
>        0         0         0         0         0         0         0 
> 0
> mpls# route add -mtu 1200 198.133.219.25 193.28.151.1
> add host 198.133.219.25: gateway 193.28.151.1
> mpls# route -n get 198.133.219.25
>    route to: 198.133.219.25
> destination: 198.133.219.25
>     gateway: 193.28.151.1
>  local addr: 193.28.151.36
>   interface: xennet0
>       flags: <UP,GATEWAY,HOST,DONE,STATIC>
>  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu 
> expire
>        0         0         0         0         0         0      1200 
> 0
> mpls# tcpdump -p -l -n -vvv -i xennet0 proto \\tcp and port 80 and host 
> 198.133.219.25 > dump &
> [1] 1722
> mpls# tcpdump: listening on xennet0, link-type EN10MB (Ethernet), capture 
> size 96 bytes
> 
> mpls# telnet -NK 198.133.219.25 80
> Trying 198.133.219.25...
> Connected to 198.133.219.25.
> Escape character is '^]'.
> ^]
> telnet> q
> Connection closed.
> mpls# kill %1
> 5 packets captured
> 604 packets received by filter
> 0 packets dropped by kernel
> [1]    Done                   tcpdump -p -l -n -vvv -i xennet0 proto \tcp 
> and port 80 and host 198.133.219.25 ...
> mpls# head dump
> 20:07:25.601293 IP (tos 0x0, ttl  64, id 63512, offset 0, flags [DF], 
> length: 64) 193.28.151.36.65527 > 198.133.219.25.80: S [tcp sum ok] 
> 2677780569:2677780569(0) win 32768 <mss 1460,nop,wscale 
> 0,sackOK,nop,nop,nop,nop,timestamp 0 0>
> 20:07:25.794759 IP (tos 0x0, ttl 241, id 13, offset 0, flags [none], length: 
> 44) 198.133.219.25.80 > 193.28.151.36.65527: S [tcp sum ok] 
> 3127864846:3127864846(0) ack 2677780570 win 8192 <mss 1460>
> 20:07:25.794810 IP (tos 0x0, ttl  64, id 63518, offset 0, flags [DF], 
> length: 40) 193.28.151.36.65527 > 198.133.219.25.80: . [tcp sum ok] 1:1(0) 
> ack 1 win 33580
> 20:07:28.011011 IP (tos 0x0, ttl  64, id 63528, offset 0, flags [DF], 
> length: 40) 193.28.151.36.65527 > 198.133.219.25.80: F [tcp sum ok] 1:1(0) 
> ack 1 win 33580
> 20:07:28.206164 IP (tos 0x0, ttl 241, id 6, offset 0, flags [none], length: 
> 40) 198.133.219.25.80 > 193.28.151.36.65527: R [tcp sum ok] 1:1(0) ack 1 win 
> 33580
> 
> mpls# uname -a
> NetBSD mpls.girsa.ro 3.99.20 NetBSD 3.99.20 (ayame-mpls) #26: Thu Jun  8 
> 14:53:31 UTC 2006 
> root@mpls.girsa.ro:/mnt/src/sys/arch/i386/compile/obj/ayame-mpls i386
> 
> 
> Shouldn't it announce MSS 1160 (ROUTE_MTU - 40, as RFC879 says) instead of 
> 1460(probably IF_MTU - 40), honouring the route MTU I've just added ?

My guess is that route -mtu doesn't work as it should.
tcp_mss_to_advertise() doesn't even traverse the routing table to find
a proper MTU, it basicly uses the interface mtu and ignores the rest.