diff options
author | 2001-04-04 05:42:57 +0000 | |
---|---|---|
committer | 2001-04-04 05:42:57 +0000 | |
commit | 78e8d2849328e19e710d5da76a20e850a5d5300d (patch) | |
tree | 5da4f49697250cafef071e621fb9b92d9de3ec3b /sys/netinet/tcp_input.c | |
parent | check for return value of ENODEV from ifpromisc(). This will happen (diff) | |
download | wireguard-openbsd-78e8d2849328e19e710d5da76a20e850a5d5300d.tar.xz wireguard-openbsd-78e8d2849328e19e710d5da76a20e850a5d5300d.zip |
do not check ip_mtudisc on IPv6 TCP.
with IPv6 TCP PMTUD is mandatory, compute mss size accordingly.
sync with kame
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 98c64f08210..12fc0029f9d 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.83 2001/03/28 20:03:07 angelos Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.84 2001/04/04 05:42:57 itojun Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -2761,9 +2761,7 @@ tcp_mss(tp, offer) struct ifnet *ifp; int mss, mssopt; int iphlen; -#ifdef INET6 int is_ipv6 = 0; -#endif struct inpcb *inp; inp = tp->t_inpcb; @@ -2812,24 +2810,31 @@ tcp_mss(tp, offer) * destination host. */ goto out; - else if (ip_mtudisc || ifp->if_flags & IFF_LOOPBACK) + else if (ifp->if_flags & IFF_LOOPBACK) mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); + else if (!is_ipv6) { + if (ip_mtudisc) + mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); + else if (inp && in_localaddr(inp->inp_faddr)) + mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); + } #ifdef INET6 else if (is_ipv6) { - if (IN6_IS_ADDR_V4MAPPED(&inp->inp_faddr6)) { + if (inp && IN6_IS_ADDR_V4MAPPED(&inp->inp_faddr6)) { /* mapped addr case */ struct in_addr d; bcopy(&inp->inp_faddr6.s6_addr32[3], &d, sizeof(d)); - if (in_localaddr(d)) + if (ip_mtudisc || in_localaddr(d)) mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); } else { - if (in6_localaddr(&inp->inp_faddr6)) - mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); + /* + * for IPv6, path MTU discovery is always turned on, + * or the node must use packet size <= 1280. + */ + mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); } } #endif /* INET6 */ - else if (inp && in_localaddr(inp->inp_faddr)) - mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr); /* Calculate the value that we offer in TCPOPT_MAXSEG */ if (offer != -1) { |