tcp: set net.inet.tcp.nolocaltimewait to 0 and deprecate it

Set the default value of the sysctl-variable
net.inet.tcp.nolocaltimewait to 0. This will make the behavior
compliant with RFC 9293.
Furthermore document that using the sysctl-variable is deprecated
and will be removed in FreeBSD 16.

Reviewed by:		glebius, Peter Lei
Relnotes:		yes
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D5106
This commit is contained in:
Michael Tuexen
2025-06-27 22:47:21 +02:00
parent 9c014cc25c
commit c3fc0db3bc
2 changed files with 31 additions and 7 deletions
+10 -4
View File
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd June 26, 2025 .Dd June 27, 2025
.Dt TCP 4 .Dt TCP 4
.Os .Os
.Sh NAME .Sh NAME
@@ -785,8 +785,8 @@ The Maximum Segment Lifetime, in milliseconds, for a packet when both endpoints
are local. are local.
.Va msl_local .Va msl_local
is only used if is only used if
.Va nolocaltimewait .Va nolocaltimewait ,
is zero. which is deprecated, is zero.
.It Va mssdflt .It Va mssdflt
The default value used for the TCP Maximum Segment Size The default value used for the TCP Maximum Segment Size
.Pq Dq MSS .Pq Dq MSS
@@ -798,10 +798,16 @@ application limited and the network bandwidth is not utilized completely.
That prevents self-inflicted packet losses once the application starts to That prevents self-inflicted packet losses once the application starts to
transmit data at a higher speed. transmit data at a higher speed.
.It Va nolocaltimewait .It Va nolocaltimewait
Suppress creation of TCP Suppress the creation of TCP
.Dv TIME_WAIT .Dv TIME_WAIT
states for connections in states for connections in
which both endpoints are local. which both endpoints are local.
The default is 0.
.Va nolocaltimewait
is deprecated and will be removed in
.Fx 16 .
.Va msl_local
can be used instead.
.It Va path_mtu_discovery .It Va path_mtu_discovery
Enable Path MTU Discovery. Enable Path MTU Discovery.
.It Va pcbcount .It Va pcbcount
+21 -3
View File
@@ -87,10 +87,28 @@
#include <security/mac/mac_framework.h> #include <security/mac/mac_framework.h>
VNET_DEFINE_STATIC(bool, nolocaltimewait) = true; VNET_DEFINE_STATIC(bool, nolocaltimewait) = false;
#define V_nolocaltimewait VNET(nolocaltimewait) #define V_nolocaltimewait VNET(nolocaltimewait)
SYSCTL_BOOL(_net_inet_tcp, OID_AUTO, nolocaltimewait,
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nolocaltimewait), 0, static int
sysctl_net_inet_tcp_nolocaltimewait(SYSCTL_HANDLER_ARGS)
{
int error;
bool new;
new = V_nolocaltimewait;
error = sysctl_handle_bool(oidp, &new, 0, req);
if (error == 0 && req->newptr) {
V_nolocaltimewait = new;
gone_in(16, "net.inet.tcp.nolocaltimewait is obsolete."
" Use net.inet.tcp.local_msl instead.\n");
}
return (error);
}
SYSCTL_PROC(_net_inet_tcp, OID_AUTO, nolocaltimewait,
CTLFLAG_VNET | CTLFLAG_RW | CTLTYPE_U8,
&VNET_NAME(nolocaltimewait), 0, sysctl_net_inet_tcp_nolocaltimewait, "CU",
"Do not create TCP TIME_WAIT state for local connections"); "Do not create TCP TIME_WAIT state for local connections");
static u_int static u_int