git: 265d0f767ca8 - main - tcp: honor rfc1323 sysctl on passive sessions

From: Richard Scheffenegger <rscheff_at_FreeBSD.org>
Date: Fri, 07 Oct 2022 14:56:24 UTC
The branch main has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=265d0f767ca851650ac40d8a483111d997497a9e

commit 265d0f767ca851650ac40d8a483111d997497a9e
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2022-10-06 23:43:14 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2022-10-06 23:49:10 +0000

    tcp: honor rfc1323 sysctl on passive sessions
    
    On passive sessions, honor the local settings disabling or
    enabling window scaling and timestamp options.
    
    Reviewed By:            tuexen, #transport
    Sponsored by:           NetApp, Inc.
    Differential Revision:  https://reviews.freebsd.org/D36874
---
 share/man/man4/tcp.4       | 2 +-
 sys/netinet/tcp_syncache.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4
index e6f4ced0c1cf..ba5d57bcf46c 100644
--- a/share/man/man4/tcp.4
+++ b/share/man/man4/tcp.4
@@ -34,7 +34,7 @@
 .\"     From: @(#)tcp.4	8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd August 1, 2022
+.Dd October 7, 2022
 .Dt TCP 4
 .Os
 .Sh NAME
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index d5380c32391b..2f0e6236f612 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1679,12 +1679,12 @@ skip_alloc:
 		 * A timestamp received in a SYN makes
 		 * it ok to send timestamp requests and replies.
 		 */
-		if (to->to_flags & TOF_TS) {
+		if ((to->to_flags & TOF_TS) && (V_tcp_do_rfc1323 != 2)) {
 			sc->sc_tsreflect = to->to_tsval;
 			sc->sc_flags |= SCF_TIMESTAMP;
 			sc->sc_tsoff = tcp_new_ts_offset(inc);
 		}
-		if (to->to_flags & TOF_SCALE) {
+		if ((to->to_flags & TOF_SCALE) && (V_tcp_do_rfc1323 != 3)) {
 			int wscale = 0;
 
 			/*