diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-04-14 04:20:58 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-04-14 04:20:58 +0000 |
commit | 70b952647d47a4852956759535afcd2448e77fcf (patch) | |
tree | d1a2db665fc28c49ce324ddf6a8a3e4767e1bda9 /sys/netinet | |
parent | 098a59a2d3b040731d74b7b1a6f5653a8c5a6041 (diff) |
for layer 3 protocols that does not support path MTU discovery
(I mean, IPv4) do not try to use rmx_mtu on routing table.
this symptom was introduced by rmx_mtu initialization (necessary for IPv6
path MTU discovery) in net/route.c. now prior behavior is recovered.
From: Hugh Graham <hugh@openbsd.org>
there are several question about mssdflt semantics, though:
Question 1: with the current code, mssdflt does not override rmx_mtu value
(mssdflt overrides interface mtu only). should we override rmx_mtu by
mssdflt as well?
Question 2: with the current code, mssdflt overrides mss computed from
if mtu, only when the destination is IPv4 non-local. is it safe enough?
we may want to use mssdflt, whenever we are uncertain.
mss = if mtu - hdrsiz;
if (IPv4 non-local destination)
mss = min(mss, mssdflt);
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_input.c | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index d84f9583b87..c5663d4dce3 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.57 2000/02/21 21:42:13 provos Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.58 2000/04/14 04:20:57 itojun Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -2787,37 +2787,49 @@ tcp_mss(tp, offer) tp->t_rttmin, TCPTV_REXMTMAX); } /* - * if there's an mtu associated with the route, use it + * if there's an mtu associated with the route and we support + * path MTU discovery for the underlying protocol family, use it. */ - if (rt->rt_rmx.rmx_mtu) -#ifdef INET6 - { - /* - * One may wish to lower MSS to take into account options, - * especially security-related options. - */ - if (tp->pf == AF_INET6) - mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpipv6hdr); - else -#endif /* INET6 */ - mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr); + if (rt->rt_rmx.rmx_mtu) { + /* + * One may wish to lower MSS to take into account options, + * especially security-related options. + */ + mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcphdr); + switch (tp->pf) { #ifdef INET6 - } -#endif /* INET6 */ - else + case AF_INET6: + mss -= sizeof(struct ip6_hdr); + break; +#endif +#ifdef notdef /* no IPv4 path MTU discovery yet */ + case AF_INET: + mss -= sizeof(struct ip); + break; +#endif + default: + /* the family does not support path MTU discovery */ + mss = 0; + break; + } + } else + mss = 0; +#else + mss = 0; #endif /* RTV_MTU */ - { - /* - * ifp may be null and rmx_mtu may be zero in certain - * v6 cases (e.g., if ND wasn't able to resolve the - * destination host. - */ + if (mss == 0) { + /* + * ifp may be null and rmx_mtu may be zero in certain + * v6 cases (e.g., if ND wasn't able to resolve the + * destination host. + */ mss = ifp ? ifp->if_mtu - sizeof(struct tcpiphdr) : 0; -#ifdef INET6 - if (tp->pf == AF_INET) -#endif /* INET6 */ - if (!in_localaddr(inp->inp_faddr)) - mss = min(mss, tcp_mssdflt); + switch (tp->pf) { + case AF_INET: + if (!in_localaddr(inp->inp_faddr)) + mss = min(mss, tcp_mssdflt); + break; + } } /* * The current mss, t_maxseg, is initialized to the default value. |