summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2000-04-14 04:20:57 +0000
committeritojun <itojun@openbsd.org>2000-04-14 04:20:57 +0000
commit362a1c190f49f64acac485f876fd85750b31a0f6 (patch)
treef56072c2e4e91c17694b9c54da66b734025e1130 /sys/netinet/tcp_input.c
parentSome documentation for future generations of maintainers (diff)
downloadwireguard-openbsd-362a1c190f49f64acac485f876fd85750b31a0f6.tar.xz
wireguard-openbsd-362a1c190f49f64acac485f876fd85750b31a0f6.zip
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/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c68
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.