diff options
author | Andre Oppermann <andre@FreeBSD.org> | 2005-05-04 13:48:44 +0000 |
---|---|---|
committer | Andre Oppermann <andre@FreeBSD.org> | 2005-05-04 13:48:44 +0000 |
commit | 9e4ca6315d85e564d20ca375f14abf89509604d4 (patch) | |
tree | 469364b2d77732f787ef2033f8b6cd245e492edf /sys/netinet/tcp_subr.c | |
parent | 1f8f08e1c933238d9afab7261bd1db83f8d26a39 (diff) | |
download | src-9e4ca6315d85e564d20ca375f14abf89509604d4.tar.gz src-9e4ca6315d85e564d20ca375f14abf89509604d4.zip |
If we don't get a suggested MTU during path MTU discovery
look up the packet size of the packet that generated the
response, step down the MTU by one step through ip_next_mtu()
and try again.
Suggested by: dwmalone
Notes
Notes:
svn path=/head/; revision=145869
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 25a92667054b..bde7f095f26c 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1168,22 +1168,33 @@ tcp_ctlinput(cmd, sa, vip) * If we got a needfrag set the MTU * in the route to the suggested new * value (if given) and then notify. - * If no new MTU was suggested, then - * we guess a new one less than the - * current value. - * If the new MTU is unreasonably - * small (defined by sysctl tcp_minmss), - * then we up the MTU value to minimum. */ bzero(&inc, sizeof(inc)); inc.inc_flags = 0; /* IPv4 */ inc.inc_faddr = faddr; mtu = ntohs(icp->icmp_nextmtu); + /* + * If no alternative MTU was + * proposed, try the next smaller + * one. + */ + if (!mtu) + mtu = ip_next_mtu(ntohs(ip->ip_len), + 1); + if (mtu < max(296, (tcp_minmss) + + sizeof(struct tcpiphdr))) + mtu = 0; if (!mtu) - mtu = ip_next_mtu(mtu, 1); - if (mtu >= max(296, (tcp_minmss - + sizeof(struct tcpiphdr)))) + mtu = tcp_mssdflt + + sizeof(struct tcpiphdr); + /* + * Only cache the the MTU if it + * is smaller than the interface + * or route MTU. tcp_mtudisc() + * will do right thing by itself. + */ + if (mtu <= tcp_maxmtu(&inc)) tcp_hc_updatemtu(&inc, mtu); } |