Page MenuHomeFreeBSD

D28142.id82231.diff
No OneTemporary

D28142.id82231.diff

diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4
--- 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 December 19, 2020
+.Dd January 11, 2021
.Dt TCP 4
.Os
.Sh NAME
@@ -369,8 +369,17 @@
.Bl -tag -width ".Va TCPCTL_DO_RFC1323"
.It Dv TCPCTL_DO_RFC1323
.Pq Va rfc1323
-Implement the window scaling and timestamp options of RFC 1323
+Implement the window scaling and timestamp options of RFC 1323/RFC 7323
(default is true).
+.It Va tolerate_missing_ts
+Tolerate the missing of timestamps (RFC 1323/RFC 7323) for
+.Tn TCP
+segments belonging to
+.Tn TCP
+connections for which support of
+.Tn TCP
+timestamps has been negotiated.
+(default is 0, i.e., the missing of timestamps is not tolerated).
.It Dv TCPCTL_MSSDFLT
.Pq Va mssdflt
The default value used for the maximum segment size
@@ -728,12 +737,20 @@
.Xr tcp_functions 9
.Rs
.%A "V. Jacobson"
-.%A "R. Braden"
+.%A "B. Braden"
.%A "D. Borman"
.%T "TCP Extensions for High Performance"
.%O "RFC 1323"
.Re
.Rs
+.%A "D. Borman"
+.%A "B. Braden"
+.%A "V. Jacobson"
+.%A "R. Scheffenegger"
+.%T "TCP Extensions for High Performance"
+.%O "RFC 7323"
+.Re
+.Rs
.%A "A. Heffernan"
.%T "Protection of BGP Sessions via the TCP MD5 Signature Option"
.%O "RFC 2385"
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1692,16 +1692,25 @@
/*
* If timestamps were negotiated during SYN/ACK and a
* segment without a timestamp is received, silently drop
- * the segment.
+ * the segment, unless the missing timestamps are tolerated.
* See section 3.2 of RFC 7323.
*/
if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
- if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
- log(LOG_DEBUG, "%s; %s: Timestamp missing, "
- "segment silently dropped\n", s, __func__);
- free(s, M_TCPLOG);
+ if (V_tcp_tolerate_missing_ts) {
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: Timestamp missing, "
+ "segment processed normally\n",
+ s, __func__);
+ free(s, M_TCPLOG);
+ }
+ } else {
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: Timestamp missing, "
+ "segment silently dropped\n", s, __func__);
+ free(s, M_TCPLOG);
+ }
+ goto drop;
}
- goto drop;
}
/*
* If timestamps were not negotiated during SYN/ACK and a
diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c
--- a/sys/netinet/tcp_stacks/bbr.c
+++ b/sys/netinet/tcp_stacks/bbr.c
@@ -11463,10 +11463,11 @@
/*
* If timestamps were negotiated during SYN/ACK and a
* segment without a timestamp is received, silently drop
- * the segment.
+ * the segment, unless the missing timestamps are tolerated.
* See section 3.2 of RFC 7323.
*/
- if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
+ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) &&
+ (!V_tcp_tolerate_missing_ts)) {
retval = 0;
goto done_with_input;
}
diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -10879,10 +10879,11 @@
/*
* If timestamps were negotiated during SYN/ACK and a
* segment without a timestamp is received, silently drop
- * the segment.
+ * the segment, unless the missing timestamps are tolerated.
* See section 3.2 of RFC 7323.
*/
- if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
+ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) &&
+ (!V_tcp_tolerate_missing_ts)) {
way_out = 5;
retval = 0;
goto done_with_input;
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -256,6 +256,11 @@
&VNET_NAME(tcp_do_rfc1323), 0,
"Enable rfc1323 (high performance TCP) extensions");
+VNET_DEFINE(int, tcp_tolerate_missing_ts) = 0;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, tolerate_missing_ts, CTLFLAG_VNET | CTLFLAG_RW,
+ &VNET_NAME(tcp_tolerate_missing_ts), 0,
+ "Tolerate missing TCP timestamps");
+
VNET_DEFINE(int, tcp_ts_offset_per_conn) = 1;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, ts_offset_per_conn, CTLFLAG_VNET | CTLFLAG_RW,
&VNET_NAME(tcp_ts_offset_per_conn), 0,
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1231,18 +1231,30 @@
/*
* If timestamps were negotiated during SYN/ACK and a
* segment without a timestamp is received, silently drop
- * the segment.
+ * the segment, unless the missing timestamps are tolerated.
* See section 3.2 of RFC 7323.
*/
if ((sc->sc_flags & SCF_TIMESTAMP) &&
!(to->to_flags & TOF_TS)) {
- SCH_UNLOCK(sch);
- if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
- log(LOG_DEBUG, "%s; %s: Timestamp missing, "
- "segment silently dropped\n", s, __func__);
- free(s, M_TCPLOG);
+ if (V_tcp_tolerate_missing_ts) {
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+ log(LOG_DEBUG,
+ "%s; %s: Timestamp missing, "
+ "segment processed normally\n",
+ s, __func__);
+ free(s, M_TCPLOG);
+ }
+ } else {
+ SCH_UNLOCK(sch);
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+ log(LOG_DEBUG,
+ "%s; %s: Timestamp missing, "
+ "segment silently dropped\n",
+ s, __func__);
+ free(s, M_TCPLOG);
+ }
+ return (-1); /* Do not send RST */
}
- return (-1); /* Do not send RST */
}
/*
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -451,10 +451,11 @@
/*
* If timestamps were negotiated during SYN/ACK and a
* segment without a timestamp is received, silently drop
- * the segment.
+ * the segment, unless the missing timestamps are tolerated.
* See section 3.2 of RFC 7323.
*/
- if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
+ if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0) &&
+ (!V_tcp_tolerate_missing_ts)) {
goto drop;
}
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -840,6 +840,7 @@
VNET_DECLARE(int, tcp_do_ecn);
VNET_DECLARE(int, tcp_do_newcwv);
VNET_DECLARE(int, tcp_do_rfc1323);
+VNET_DECLARE(int, tcp_tolerate_missing_ts);
VNET_DECLARE(int, tcp_do_rfc3042);
VNET_DECLARE(int, tcp_do_rfc3390);
VNET_DECLARE(int, tcp_do_rfc3465);
@@ -883,6 +884,7 @@
#define V_tcp_do_autosndbuf VNET(tcp_do_autosndbuf)
#define V_tcp_do_ecn VNET(tcp_do_ecn)
#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323)
+#define V_tcp_tolerate_missing_ts VNET(tcp_tolerate_missing_ts)
#define V_tcp_ts_offset_per_conn VNET(tcp_ts_offset_per_conn)
#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042)
#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390)

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 2, 6:35 AM (1 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34588662
Default Alt Text
D28142.id82231.diff (6 KB)

Event Timeline