From owner-svn-src-stable@freebsd.org Wed Oct 11 06:28:48 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00BDAE47F40; Wed, 11 Oct 2017 06:28:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1DED80594; Wed, 11 Oct 2017 06:28:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9B6SkJv018020; Wed, 11 Oct 2017 06:28:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9B6SkLN018019; Wed, 11 Oct 2017 06:28:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201710110628.v9B6SkLN018019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 11 Oct 2017 06:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r324520 - stable/10/sys/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/netinet X-SVN-Commit-Revision: 324520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Oct 2017 06:28:48 -0000 Author: sephe Date: Wed Oct 11 06:28:46 2017 New Revision: 324520 URL: https://svnweb.freebsd.org/changeset/base/324520 Log: MFC 324050 tcp: Don't "negotiate" MSS. _NO_ OSes actually "negotiate" MSS. RFC 879: "... This Maximum Segment Size (MSS) announcement (often mistakenly called a negotiation) ..." This negotiation behaviour was introduced 11 years ago by r159955 without any explaination about why FreeBSD had to "negotiate" MSS: In syncache_respond() do not reply with a MSS that is larger than what the peer announced to us but make it at least tcp_minmss in size. Sponsored by: TCP/IP Optimization Fundraise 2005 The tcp_minmss behaviour is still kept. Syncookie fix was prodded by tuexen, who also helped to test this patch w/ packetdrill. Reviewed by: tuexen, karels, bz (previous version) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12430 Modified: stable/10/sys/netinet/tcp_syncache.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Wed Oct 11 06:08:01 2017 (r324519) +++ stable/10/sys/netinet/tcp_syncache.c Wed Oct 11 06:28:46 2017 (r324520) @@ -1551,9 +1551,7 @@ syncache_respond(struct syncache *sc, const struct mbu tlen = hlen + sizeof(struct tcphdr); /* Determine MSS we advertize to other end of connection. */ - mssopt = tcp_mssopt(&sc->sc_inc); - if (sc->sc_peer_mss) - mssopt = max( min(sc->sc_peer_mss, mssopt), V_tcp_minmss); + mssopt = max(tcp_mssopt(&sc->sc_inc), V_tcp_minmss); /* XXX: Assume that the entire packet will fit in a header mbuf. */ KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN, @@ -1896,7 +1894,7 @@ syncookie_mac(struct in_conninfo *inc, tcp_seq irs, ui static tcp_seq syncookie_generate(struct syncache_head *sch, struct syncache *sc) { - u_int i, mss, secbit, wscale; + u_int i, secbit, wscale; uint32_t iss, hash; uint8_t *secbits; union syncookie cookie; @@ -1906,9 +1904,8 @@ syncookie_generate(struct syncache_head *sch, struct s cookie.cookie = 0; /* Map our computed MSS into the 3-bit index. */ - mss = min(tcp_mssopt(&sc->sc_inc), max(sc->sc_peer_mss, V_tcp_minmss)); for (i = sizeof(tcp_sc_msstab) / sizeof(*tcp_sc_msstab) - 1; - tcp_sc_msstab[i] > mss && i > 0; + tcp_sc_msstab[i] > sc->sc_peer_mss && i > 0; i--) ; cookie.flags.mss_idx = i;