summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-02-05 04:23:14 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-02-05 04:23:14 +0000
commit4cfc2d1aa1181e9af5ef65dc11ed7db41e5a8726 (patch)
treea7b563b12cae4db0c5e04e0bd27747efd802f86e /sys/netinet/tcp_input.c
parent3551c1d384fd35f693df733b33154a9bd79d307f (diff)
take RFC2460 section 5 last paragraph into consideration when we compute MSS
(if path MTU < 1280, use 1280 as packet size and attach fragment header). markus ok
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 2aae18d0f3f..1d99cc37794 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.152 2004/01/31 19:40:09 markus Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.153 2004/02/05 04:23:13 itojun Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -3001,7 +3001,16 @@ tcp_mss(tp, offer)
* One may wish to lower MSS to take into account options,
* especially security-related options.
*/
- mss = rt->rt_rmx.rmx_mtu - iphlen - sizeof(struct tcphdr);
+ if (tp->pf == AF_INET6 && rt->rt_rmx.rmx_mtu < IPV6_MMTU) {
+ /*
+ * RFC2460 section 5, last paragraph: if path MTU is
+ * smaller than 1280, use 1280 as packet size and
+ * attach fragment header.
+ */
+ mss = IPV6_MMTU - iphlen - sizeof(struct ip6_frag) -
+ sizeof(struct tcphdr);
+ } else
+ mss = rt->rt_rmx.rmx_mtu - iphlen - sizeof(struct tcphdr);
} else
#endif /* RTV_MTU */
if (!ifp)
@@ -3034,11 +3043,11 @@ tcp_mss(tp, offer)
#ifndef INET6
mssopt = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
#else
- if (tp->pf == AF_INET)
- mssopt = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
- else
+ if (tp->pf == AF_INET6)
mssopt = IN6_LINKMTU(ifp) - iphlen -
sizeof(struct tcphdr);
+ else
+ mssopt = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
#endif
mssopt = max(tcp_mssdflt, mssopt);