From 265d0f767ca851650ac40d8a483111d997497a9e Mon Sep 17 00:00:00 2001 From: Richard Scheffenegger Date: Fri, 7 Oct 2022 01:43:14 +0200 Subject: [PATCH] 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 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, * 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; /*