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 @@ -785,8 +785,8 @@ are local. .Va msl_local is only used if -.Va nolocaltimewait -is zero. +.Va nolocaltimewait , +which is deprecated, is zero. .It Va mssdflt The default value used for the TCP Maximum Segment Size .Pq Dq MSS @@ -798,10 +798,16 @@ That prevents self-inflicted packet losses once the application starts to transmit data at a higher speed. .It Va nolocaltimewait -Suppress creation of TCP +Suppress the creation of TCP .Dv TIME_WAIT states for connections in 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 Enable Path MTU Discovery. .It Va pcbcount 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 @@ -87,10 +87,28 @@ #include -VNET_DEFINE_STATIC(bool, nolocaltimewait) = true; +VNET_DEFINE_STATIC(bool, nolocaltimewait) = false; #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"); static u_int