1994-05-30 19:09:18 +00:00
|
|
|
.\" Copyright (c) 1983, 1991, 1993
|
2011-02-21 11:56:11 +00:00
|
|
|
.\" The Regents of the University of California.
|
|
|
|
.\" Copyright (c) 2010-2011 The FreeBSD Foundation
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Portions of this documentation were written at the Centre for Advanced
|
|
|
|
.\" Internet Architectures, Swinburne University of Technology, Melbourne,
|
|
|
|
.\" Australia by David Hayes under sponsorship from the FreeBSD Foundation.
|
1994-05-30 19:09:18 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2014-03-14 03:07:51 +00:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1994-05-30 19:09:18 +00:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1995-02-15 03:30:54 +00:00
|
|
|
.\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-30 19:09:18 +00:00
|
|
|
.\"
|
2019-12-02 20:58:04 +00:00
|
|
|
.Dd December 2, 2019
|
1994-05-30 19:09:18 +00:00
|
|
|
.Dt TCP 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1994-05-30 19:09:18 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm tcp
|
|
|
|
.Nd Internet Transmission Control Protocol
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/types.h
|
|
|
|
.In sys/socket.h
|
|
|
|
.In netinet/in.h
|
2013-11-08 13:04:14 +00:00
|
|
|
.In netinet/tcp.h
|
1994-05-30 19:09:18 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn socket AF_INET SOCK_STREAM 0
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Tn TCP
|
|
|
|
protocol provides reliable, flow-controlled, two-way
|
2003-03-22 13:43:06 +00:00
|
|
|
transmission of data.
|
|
|
|
It is a byte-stream protocol used to
|
1994-05-30 19:09:18 +00:00
|
|
|
support the
|
|
|
|
.Dv SOCK_STREAM
|
2003-03-22 13:43:06 +00:00
|
|
|
abstraction.
|
|
|
|
.Tn TCP
|
|
|
|
uses the standard
|
1994-05-30 19:09:18 +00:00
|
|
|
Internet address format and, in addition, provides a per-host
|
|
|
|
collection of
|
2003-03-22 13:43:06 +00:00
|
|
|
.Dq "port addresses" .
|
1994-05-30 19:09:18 +00:00
|
|
|
Thus, each address is composed
|
2003-03-22 13:43:06 +00:00
|
|
|
of an Internet address specifying the host and network,
|
|
|
|
with a specific
|
1994-05-30 19:09:18 +00:00
|
|
|
.Tn TCP
|
|
|
|
port on the host identifying the peer entity.
|
|
|
|
.Pp
|
2003-03-22 13:43:06 +00:00
|
|
|
Sockets utilizing the
|
|
|
|
.Tn TCP
|
|
|
|
protocol are either
|
1994-05-30 19:09:18 +00:00
|
|
|
.Dq active
|
|
|
|
or
|
|
|
|
.Dq passive .
|
|
|
|
Active sockets initiate connections to passive
|
2003-03-22 13:43:06 +00:00
|
|
|
sockets.
|
|
|
|
By default,
|
1994-05-30 19:09:18 +00:00
|
|
|
.Tn TCP
|
|
|
|
sockets are created active; to create a
|
2003-03-22 13:43:06 +00:00
|
|
|
passive socket, the
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr listen 2
|
|
|
|
system call must be used
|
|
|
|
after binding the socket with the
|
|
|
|
.Xr bind 2
|
2003-03-22 13:43:06 +00:00
|
|
|
system call.
|
|
|
|
Only passive sockets may use the
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr accept 2
|
2003-03-22 13:43:06 +00:00
|
|
|
call to accept incoming connections.
|
|
|
|
Only active sockets may use the
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr connect 2
|
|
|
|
call to initiate connections.
|
|
|
|
.Pp
|
|
|
|
Passive sockets may
|
|
|
|
.Dq underspecify
|
|
|
|
their location to match
|
2003-03-22 13:43:06 +00:00
|
|
|
incoming connection requests from multiple networks.
|
|
|
|
This technique, termed
|
|
|
|
.Dq "wildcard addressing" ,
|
1994-05-30 19:09:18 +00:00
|
|
|
allows a single
|
|
|
|
server to provide service to clients on multiple networks.
|
|
|
|
To create a socket which listens on all networks, the Internet
|
|
|
|
address
|
|
|
|
.Dv INADDR_ANY
|
2003-03-22 13:43:06 +00:00
|
|
|
must be bound.
|
|
|
|
The
|
1994-05-30 19:09:18 +00:00
|
|
|
.Tn TCP
|
|
|
|
port may still be specified
|
2003-03-22 13:43:06 +00:00
|
|
|
at this time; if the port is not specified, the system will assign one.
|
|
|
|
Once a connection has been established, the socket's address is
|
|
|
|
fixed by the peer entity's location.
|
|
|
|
The address assigned to the
|
1994-05-30 19:09:18 +00:00
|
|
|
socket is the address associated with the network interface
|
2003-03-22 13:43:06 +00:00
|
|
|
through which packets are being transmitted and received.
|
|
|
|
Normally, this address corresponds to the peer entity's network.
|
1994-05-30 19:09:18 +00:00
|
|
|
.Pp
|
|
|
|
.Tn TCP
|
1995-02-15 03:30:54 +00:00
|
|
|
supports a number of socket options which can be set with
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr setsockopt 2
|
|
|
|
and tested with
|
1995-02-15 03:30:54 +00:00
|
|
|
.Xr getsockopt 2 :
|
2016-06-28 13:37:01 +00:00
|
|
|
.Bl -tag -width ".Dv TCP_FUNCTION_BLK"
|
2007-01-22 14:16:47 +00:00
|
|
|
.It Dv TCP_INFO
|
|
|
|
Information about a socket's underlying TCP session may be retrieved
|
|
|
|
by passing the read-only option
|
|
|
|
.Dv TCP_INFO
|
|
|
|
to
|
|
|
|
.Xr getsockopt 2 .
|
|
|
|
It accepts a single argument: a pointer to an instance of
|
|
|
|
.Vt "struct tcp_info" .
|
|
|
|
.Pp
|
|
|
|
This API is subject to change; consult the source to determine
|
|
|
|
which fields are currently filled out by this option.
|
|
|
|
.Fx
|
|
|
|
specific additions include
|
|
|
|
send window size,
|
|
|
|
receive window size,
|
|
|
|
and
|
|
|
|
bandwidth-controlled window space.
|
2016-01-22 02:07:48 +00:00
|
|
|
.It Dv TCP_CCALGOOPT
|
|
|
|
Set or query congestion control algorithm specific parameters.
|
|
|
|
See
|
|
|
|
.Xr mod_cc 4
|
|
|
|
for details.
|
2011-02-21 11:56:11 +00:00
|
|
|
.It Dv TCP_CONGESTION
|
|
|
|
Select or query the congestion control algorithm that TCP will use for the
|
|
|
|
connection.
|
|
|
|
See
|
2011-09-15 12:15:36 +00:00
|
|
|
.Xr mod_cc 4
|
2011-02-21 11:56:11 +00:00
|
|
|
for details.
|
2016-06-28 13:37:01 +00:00
|
|
|
.It Dv TCP_FUNCTION_BLK
|
|
|
|
Select or query the set of functions that TCP will use for this connection.
|
|
|
|
This allows a user to select an alternate TCP stack.
|
|
|
|
The alternate TCP stack must already be loaded in the kernel.
|
|
|
|
To list the available TCP stacks, see
|
|
|
|
.Va functions_available
|
|
|
|
in the
|
|
|
|
.Sx MIB Variables
|
|
|
|
section further down.
|
|
|
|
To list the default TCP stack, see
|
|
|
|
.Va functions_default
|
|
|
|
in the
|
|
|
|
.Sx MIB Variables
|
|
|
|
section.
|
2012-02-05 16:53:02 +00:00
|
|
|
.It Dv TCP_KEEPINIT
|
2013-11-08 13:04:14 +00:00
|
|
|
This
|
2012-02-05 16:53:02 +00:00
|
|
|
.Xr setsockopt 2
|
|
|
|
option accepts a per-socket timeout argument of
|
|
|
|
.Vt "u_int"
|
|
|
|
in seconds, for new, non-established
|
|
|
|
.Tn TCP
|
|
|
|
connections.
|
|
|
|
For the global default in milliseconds see
|
|
|
|
.Va keepinit
|
|
|
|
in the
|
|
|
|
.Sx MIB Variables
|
|
|
|
section further down.
|
|
|
|
.It Dv TCP_KEEPIDLE
|
2013-11-08 13:04:14 +00:00
|
|
|
This
|
2012-02-05 16:53:02 +00:00
|
|
|
.Xr setsockopt 2
|
|
|
|
option accepts an argument of
|
|
|
|
.Vt "u_int"
|
|
|
|
for the amount of time, in seconds, that the connection must be idle
|
|
|
|
before keepalive probes (if enabled) are sent for the connection of this
|
|
|
|
socket.
|
|
|
|
If set on a listening socket, the value is inherited by the newly created
|
|
|
|
socket upon
|
|
|
|
.Xr accept 2 .
|
|
|
|
For the global default in milliseconds see
|
|
|
|
.Va keepidle
|
|
|
|
in the
|
|
|
|
.Sx MIB Variables
|
|
|
|
section further down.
|
|
|
|
.It Dv TCP_KEEPINTVL
|
2013-11-08 13:04:14 +00:00
|
|
|
This
|
2012-02-05 16:53:02 +00:00
|
|
|
.Xr setsockopt 2
|
|
|
|
option accepts an argument of
|
|
|
|
.Vt "u_int"
|
|
|
|
to set the per-socket interval, in seconds, between keepalive probes sent
|
|
|
|
to a peer.
|
|
|
|
If set on a listening socket, the value is inherited by the newly created
|
|
|
|
socket upon
|
|
|
|
.Xr accept 2 .
|
|
|
|
For the global default in milliseconds see
|
|
|
|
.Va keepintvl
|
|
|
|
in the
|
|
|
|
.Sx MIB Variables
|
|
|
|
section further down.
|
|
|
|
.It Dv TCP_KEEPCNT
|
2013-11-08 13:04:14 +00:00
|
|
|
This
|
2012-02-05 16:53:02 +00:00
|
|
|
.Xr setsockopt 2
|
|
|
|
option accepts an argument of
|
|
|
|
.Vt "u_int"
|
|
|
|
and allows a per-socket tuning of the number of probes sent, with no response,
|
|
|
|
before the connection will be dropped.
|
|
|
|
If set on a listening socket, the value is inherited by the newly created
|
|
|
|
socket upon
|
|
|
|
.Xr accept 2 .
|
|
|
|
For the global default see the
|
|
|
|
.Va keepcnt
|
|
|
|
in the
|
|
|
|
.Sx MIB Variables
|
|
|
|
section further down.
|
1995-02-15 03:30:54 +00:00
|
|
|
.It Dv TCP_NODELAY
|
1994-05-30 19:09:18 +00:00
|
|
|
Under most circumstances,
|
|
|
|
.Tn TCP
|
|
|
|
sends data when it is presented;
|
|
|
|
when outstanding data has not yet been acknowledged, it gathers
|
|
|
|
small amounts of output to be sent in a single packet once
|
|
|
|
an acknowledgement is received.
|
|
|
|
For a small number of clients, such as window systems
|
|
|
|
that send a stream of mouse events which receive no replies,
|
|
|
|
this packetization may cause significant delays.
|
1995-02-15 03:30:54 +00:00
|
|
|
The boolean option
|
1994-05-30 19:09:18 +00:00
|
|
|
.Dv TCP_NODELAY
|
1995-02-15 03:30:54 +00:00
|
|
|
defeats this algorithm.
|
|
|
|
.It Dv TCP_MAXSEG
|
2003-03-22 13:43:06 +00:00
|
|
|
By default, a sender- and
|
|
|
|
.No receiver- Ns Tn TCP
|
1995-02-15 03:30:54 +00:00
|
|
|
will negotiate among themselves to determine the maximum segment size
|
2003-03-22 13:43:06 +00:00
|
|
|
to be used for each connection.
|
|
|
|
The
|
1995-02-15 03:30:54 +00:00
|
|
|
.Dv TCP_MAXSEG
|
|
|
|
option allows the user to determine the result of this negotiation,
|
|
|
|
and to reduce it if desired.
|
|
|
|
.It Dv TCP_NOOPT
|
|
|
|
.Tn TCP
|
|
|
|
usually sends a number of options in each packet, corresponding to
|
|
|
|
various
|
|
|
|
.Tn TCP
|
2003-03-22 13:43:06 +00:00
|
|
|
extensions which are provided in this implementation.
|
|
|
|
The boolean option
|
1995-02-15 03:30:54 +00:00
|
|
|
.Dv TCP_NOOPT
|
2001-07-14 19:41:16 +00:00
|
|
|
is provided to disable
|
1995-02-15 03:30:54 +00:00
|
|
|
.Tn TCP
|
|
|
|
option use on a per-connection basis.
|
|
|
|
.It Dv TCP_NOPUSH
|
2003-03-22 13:43:06 +00:00
|
|
|
By convention, the
|
|
|
|
.No sender- Ns Tn TCP
|
1995-02-15 03:30:54 +00:00
|
|
|
will set the
|
|
|
|
.Dq push
|
2003-03-22 13:43:06 +00:00
|
|
|
bit, and begin transmission immediately (if permitted) at the end of
|
1995-02-15 03:30:54 +00:00
|
|
|
every user call to
|
1996-04-08 04:18:31 +00:00
|
|
|
.Xr write 2
|
1995-02-15 03:30:54 +00:00
|
|
|
or
|
1996-04-08 04:18:31 +00:00
|
|
|
.Xr writev 2 .
|
2003-03-22 13:43:06 +00:00
|
|
|
When this option is set to a non-zero value,
|
1995-02-15 03:30:54 +00:00
|
|
|
.Tn TCP
|
|
|
|
will delay sending any data at all until either the socket is closed,
|
|
|
|
or the internal send buffer is filled.
|
2004-02-16 22:21:16 +00:00
|
|
|
.It Dv TCP_MD5SIG
|
Initial import of RFC 2385 (TCP-MD5) digest support.
This is the first of two commits; bringing in the kernel support first.
This can be enabled by compiling a kernel with options TCP_SIGNATURE
and FAST_IPSEC.
For the uninitiated, this is a TCP option which provides for a means of
authenticating TCP sessions which came into being before IPSEC. It is
still relevant today, however, as it is used by many commercial router
vendors, particularly with BGP, and as such has become a requirement for
interconnect at many major Internet points of presence.
Several parts of the TCP and IP headers, including the segment payload,
are digested with MD5, including a shared secret. The PF_KEY interface
is used to manage the secrets using security associations in the SADB.
There is a limitation here in that as there is no way to map a TCP flow
per-port back to an SPI without polluting tcpcb or using the SPD; the
code to do the latter is unstable at this time. Therefore this code only
supports per-host keying granularity.
Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6),
TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective
users of this feature, this will not pose any problem.
This implementation is output-only; that is, the option is honoured when
responding to a host initiating a TCP session, but no effort is made
[yet] to authenticate inbound traffic. This is, however, sufficient to
interwork with Cisco equipment.
Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with
local patches. Patches for tcpdump to validate TCP-MD5 sessions are also
available from me upon request.
Sponsored by: sentex.net
2004-02-11 04:26:04 +00:00
|
|
|
This option enables the use of MD5 digests (also known as TCP-MD5)
|
|
|
|
on writes to the specified socket.
|
2012-03-08 01:37:01 +00:00
|
|
|
Outgoing traffic is digested;
|
2017-02-06 08:49:57 +00:00
|
|
|
digests on incoming traffic are verified.
|
|
|
|
When this option is enabled on a socket, all inbound and outgoing
|
|
|
|
TCP segments must be signed with MD5 digests.
|
Initial import of RFC 2385 (TCP-MD5) digest support.
This is the first of two commits; bringing in the kernel support first.
This can be enabled by compiling a kernel with options TCP_SIGNATURE
and FAST_IPSEC.
For the uninitiated, this is a TCP option which provides for a means of
authenticating TCP sessions which came into being before IPSEC. It is
still relevant today, however, as it is used by many commercial router
vendors, particularly with BGP, and as such has become a requirement for
interconnect at many major Internet points of presence.
Several parts of the TCP and IP headers, including the segment payload,
are digested with MD5, including a shared secret. The PF_KEY interface
is used to manage the secrets using security associations in the SADB.
There is a limitation here in that as there is no way to map a TCP flow
per-port back to an SPI without polluting tcpcb or using the SPD; the
code to do the latter is unstable at this time. Therefore this code only
supports per-host keying granularity.
Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6),
TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective
users of this feature, this will not pose any problem.
This implementation is output-only; that is, the option is honoured when
responding to a host initiating a TCP session, but no effort is made
[yet] to authenticate inbound traffic. This is, however, sufficient to
interwork with Cisco equipment.
Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with
local patches. Patches for tcpdump to validate TCP-MD5 sessions are also
available from me upon request.
Sponsored by: sentex.net
2004-02-11 04:26:04 +00:00
|
|
|
.Pp
|
2004-06-16 08:33:57 +00:00
|
|
|
One common use for this in a
|
|
|
|
.Fx
|
|
|
|
router deployment is to enable
|
Initial import of RFC 2385 (TCP-MD5) digest support.
This is the first of two commits; bringing in the kernel support first.
This can be enabled by compiling a kernel with options TCP_SIGNATURE
and FAST_IPSEC.
For the uninitiated, this is a TCP option which provides for a means of
authenticating TCP sessions which came into being before IPSEC. It is
still relevant today, however, as it is used by many commercial router
vendors, particularly with BGP, and as such has become a requirement for
interconnect at many major Internet points of presence.
Several parts of the TCP and IP headers, including the segment payload,
are digested with MD5, including a shared secret. The PF_KEY interface
is used to manage the secrets using security associations in the SADB.
There is a limitation here in that as there is no way to map a TCP flow
per-port back to an SPI without polluting tcpcb or using the SPD; the
code to do the latter is unstable at this time. Therefore this code only
supports per-host keying granularity.
Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6),
TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective
users of this feature, this will not pose any problem.
This implementation is output-only; that is, the option is honoured when
responding to a host initiating a TCP session, but no effort is made
[yet] to authenticate inbound traffic. This is, however, sufficient to
interwork with Cisco equipment.
Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with
local patches. Patches for tcpdump to validate TCP-MD5 sessions are also
available from me upon request.
Sponsored by: sentex.net
2004-02-11 04:26:04 +00:00
|
|
|
based routers to interwork with Cisco equipment at peering points.
|
|
|
|
Support for this feature conforms to RFC 2385.
|
|
|
|
.Pp
|
|
|
|
In order for this option to function correctly, it is necessary for the
|
|
|
|
administrator to add a tcp-md5 key entry to the system's security
|
|
|
|
associations database (SADB) using the
|
|
|
|
.Xr setkey 8
|
|
|
|
utility.
|
2017-02-06 08:49:57 +00:00
|
|
|
This entry can only be specified on a per-host basis at this time.
|
Initial import of RFC 2385 (TCP-MD5) digest support.
This is the first of two commits; bringing in the kernel support first.
This can be enabled by compiling a kernel with options TCP_SIGNATURE
and FAST_IPSEC.
For the uninitiated, this is a TCP option which provides for a means of
authenticating TCP sessions which came into being before IPSEC. It is
still relevant today, however, as it is used by many commercial router
vendors, particularly with BGP, and as such has become a requirement for
interconnect at many major Internet points of presence.
Several parts of the TCP and IP headers, including the segment payload,
are digested with MD5, including a shared secret. The PF_KEY interface
is used to manage the secrets using security associations in the SADB.
There is a limitation here in that as there is no way to map a TCP flow
per-port back to an SPI without polluting tcpcb or using the SPD; the
code to do the latter is unstable at this time. Therefore this code only
supports per-host keying granularity.
Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6),
TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective
users of this feature, this will not pose any problem.
This implementation is output-only; that is, the option is honoured when
responding to a host initiating a TCP session, but no effort is made
[yet] to authenticate inbound traffic. This is, however, sufficient to
interwork with Cisco equipment.
Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with
local patches. Patches for tcpdump to validate TCP-MD5 sessions are also
available from me upon request.
Sponsored by: sentex.net
2004-02-11 04:26:04 +00:00
|
|
|
.Pp
|
2017-02-06 08:49:57 +00:00
|
|
|
If an SADB entry cannot be found for the destination,
|
|
|
|
the system does not send any outgoing segments and drops any inbound segments.
|
2019-12-02 20:58:04 +00:00
|
|
|
.It Dv TCP_STATS
|
|
|
|
Manage collection of connection level statistics using the
|
|
|
|
.Xr stats 3
|
|
|
|
framework.
|
2017-02-06 08:49:57 +00:00
|
|
|
.Pp
|
|
|
|
Each dropped segment is taken into account in the TCP protocol statistics.
|
Add kernel-side support for in-kernel TLS.
KTLS adds support for in-kernel framing and encryption of Transport
Layer Security (1.0-1.2) data on TCP sockets. KTLS only supports
offload of TLS for transmitted data. Key negotation must still be
performed in userland. Once completed, transmit session keys for a
connection are provided to the kernel via a new TCP_TXTLS_ENABLE
socket option. All subsequent data transmitted on the socket is
placed into TLS frames and encrypted using the supplied keys.
Any data written to a KTLS-enabled socket via write(2), aio_write(2),
or sendfile(2) is assumed to be application data and is encoded in TLS
frames with an application data type. Individual records can be sent
with a custom type (e.g. handshake messages) via sendmsg(2) with a new
control message (TLS_SET_RECORD_TYPE) specifying the record type.
At present, rekeying is not supported though the in-kernel framework
should support rekeying.
KTLS makes use of the recently added unmapped mbufs to store TLS
frames in the socket buffer. Each TLS frame is described by a single
ext_pgs mbuf. The ext_pgs structure contains the header of the TLS
record (and trailer for encrypted records) as well as references to
the associated TLS session.
KTLS supports two primary methods of encrypting TLS frames: software
TLS and ifnet TLS.
Software TLS marks mbufs holding socket data as not ready via
M_NOTREADY similar to sendfile(2) when TLS framing information is
added to an unmapped mbuf in ktls_frame(). ktls_enqueue() is then
called to schedule TLS frames for encryption. In the case of
sendfile_iodone() calls ktls_enqueue() instead of pru_ready() leaving
the mbufs marked M_NOTREADY until encryption is completed. For other
writes (vn_sendfile when pages are available, write(2), etc.), the
PRUS_NOTREADY is set when invoking pru_send() along with invoking
ktls_enqueue().
A pool of worker threads (the "KTLS" kernel process) encrypts TLS
frames queued via ktls_enqueue(). Each TLS frame is temporarily
mapped using the direct map and passed to a software encryption
backend to perform the actual encryption.
(Note: The use of PHYS_TO_DMAP could be replaced with sf_bufs if
someone wished to make this work on architectures without a direct
map.)
KTLS supports pluggable software encryption backends. Internally,
Netflix uses proprietary pure-software backends. This commit includes
a simple backend in a new ktls_ocf.ko module that uses the kernel's
OpenCrypto framework to provide AES-GCM encryption of TLS frames. As
a result, software TLS is now a bit of a misnomer as it can make use
of hardware crypto accelerators.
Once software encryption has finished, the TLS frame mbufs are marked
ready via pru_ready(). At this point, the encrypted data appears as
regular payload to the TCP stack stored in unmapped mbufs.
ifnet TLS permits a NIC to offload the TLS encryption and TCP
segmentation. In this mode, a new send tag type (IF_SND_TAG_TYPE_TLS)
is allocated on the interface a socket is routed over and associated
with a TLS session. TLS records for a TLS session using ifnet TLS are
not marked M_NOTREADY but are passed down the stack unencrypted. The
ip_output_send() and ip6_output_send() helper functions that apply
send tags to outbound IP packets verify that the send tag of the TLS
record matches the outbound interface. If so, the packet is tagged
with the TLS send tag and sent to the interface. The NIC device
driver must recognize packets with the TLS send tag and schedule them
for TLS encryption and TCP segmentation. If the the outbound
interface does not match the interface in the TLS send tag, the packet
is dropped. In addition, a task is scheduled to refresh the TLS send
tag for the TLS session. If a new TLS send tag cannot be allocated,
the connection is dropped. If a new TLS send tag is allocated,
however, subsequent packets will be tagged with the correct TLS send
tag. (This latter case has been tested by configuring both ports of a
Chelsio T6 in a lagg and failing over from one port to another. As
the connections migrated to the new port, new TLS send tags were
allocated for the new port and connections resumed without being
dropped.)
ifnet TLS can be enabled and disabled on supported network interfaces
via new '[-]txtls[46]' options to ifconfig(8). ifnet TLS is supported
across both vlan devices and lagg interfaces using failover, lacp with
flowid enabled, or lacp with flowid enabled.
Applications may request the current KTLS mode of a connection via a
new TCP_TXTLS_MODE socket option. They can also use this socket
option to toggle between software and ifnet TLS modes.
In addition, a testing tool is available in tools/tools/switch_tls.
This is modeled on tcpdrop and uses similar syntax. However, instead
of dropping connections, -s is used to force KTLS connections to
switch to software TLS and -i is used to switch to ifnet TLS.
Various sysctls and counters are available under the kern.ipc.tls
sysctl node. The kern.ipc.tls.enable node must be set to true to
enable KTLS (it is off by default). The use of unmapped mbufs must
also be enabled via kern.ipc.mb_use_ext_pgs to enable KTLS.
KTLS is enabled via the KERN_TLS kernel option.
This patch is the culmination of years of work by several folks
including Scott Long and Randall Stewart for the original design and
implementation; Drew Gallatin for several optimizations including the
use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records
awaiting software encryption, and pluggable software crypto backends;
and John Baldwin for modifications to support hardware TLS offload.
Reviewed by: gallatin, hselasky, rrs
Obtained from: Netflix
Sponsored by: Netflix, Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D21277
2019-08-27 00:01:56 +00:00
|
|
|
.It Dv TCP_TXTLS_ENABLE
|
|
|
|
Enable in-kernel Transport Layer Security (TLS) for data written to this
|
|
|
|
socket.
|
|
|
|
The
|
|
|
|
.Vt struct tls_so_enable
|
|
|
|
argument defines the encryption and authentication algorithms and keys
|
|
|
|
used to encrypt the socket data as well as the maximum TLS record
|
|
|
|
payload size.
|
|
|
|
.Pp
|
|
|
|
All data written to this socket will be encapsulated in TLS records
|
|
|
|
and subsequently encrypted.
|
|
|
|
By default all data written to this socket is treated as application data.
|
|
|
|
Individual TLS records with a type other than application data
|
|
|
|
(for example, handshake messages),
|
|
|
|
may be transmitted by invoking
|
|
|
|
.Xr sendmsg 2
|
|
|
|
with a custom TLS record type set in a
|
|
|
|
.Dv TLS_SET_RECORD_TYPE
|
|
|
|
control message.
|
|
|
|
The payload of this control message is a single byte holding the desired
|
|
|
|
TLS record type.
|
|
|
|
.Pp
|
|
|
|
Data read from this socket will still be encrypted and must be parsed by
|
|
|
|
a TLS-aware consumer.
|
|
|
|
.Pp
|
|
|
|
At present, only a single key may be set on a socket.
|
|
|
|
As such, users of this option must disable rekeying.
|
|
|
|
.It Dv TCP_TXTLS_MODE
|
|
|
|
The integer argument can be used to get or set the current TLS mode of a
|
|
|
|
socket.
|
|
|
|
Setting the mode can only used to toggle between software and NIC TLS after
|
|
|
|
TLS has been initially enabled via the
|
|
|
|
.Dv TCP_TXTLS_ENABLE
|
|
|
|
option.
|
|
|
|
The available modes are:
|
|
|
|
.Bl -tag -width "Dv TCP_TLS_MODE_IFNET"
|
|
|
|
.It Dv TCP_TLS_MODE_NONE
|
|
|
|
In-kernel TLS framing and encryption is not enabled for this socket.
|
|
|
|
.It Dv TCP_TLS_MODE_SW
|
|
|
|
TLS records are encrypted by the kernel prior to placing the data in the
|
|
|
|
socket buffer.
|
|
|
|
Typically this encryption is performed in software.
|
|
|
|
.It Dv TCP_TLS_MODE_IFNET
|
|
|
|
TLS records are encrypted by the network interface card (NIC).
|
|
|
|
.El
|
1995-02-15 03:30:54 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
1994-05-30 19:09:18 +00:00
|
|
|
The option level for the
|
1996-04-08 04:18:31 +00:00
|
|
|
.Xr setsockopt 2
|
1994-05-30 19:09:18 +00:00
|
|
|
call is the protocol number for
|
|
|
|
.Tn TCP ,
|
|
|
|
available from
|
1995-02-15 03:30:54 +00:00
|
|
|
.Xr getprotobyname 3 ,
|
|
|
|
or
|
|
|
|
.Dv IPPROTO_TCP .
|
|
|
|
All options are declared in
|
2003-09-08 19:57:22 +00:00
|
|
|
.In netinet/tcp.h .
|
1994-05-30 19:09:18 +00:00
|
|
|
.Pp
|
|
|
|
Options at the
|
|
|
|
.Tn IP
|
|
|
|
transport level may be used with
|
|
|
|
.Tn TCP ;
|
|
|
|
see
|
|
|
|
.Xr ip 4 .
|
|
|
|
Incoming connection requests that are source-routed are noted,
|
|
|
|
and the reverse source route is used in responding.
|
2011-02-21 11:56:11 +00:00
|
|
|
.Pp
|
|
|
|
The default congestion control algorithm for
|
|
|
|
.Tn TCP
|
|
|
|
is
|
|
|
|
.Xr cc_newreno 4 .
|
|
|
|
Other congestion control algorithms can be made available using the
|
2011-09-15 12:15:36 +00:00
|
|
|
.Xr mod_cc 4
|
2011-02-21 11:56:11 +00:00
|
|
|
framework.
|
2003-03-22 13:43:06 +00:00
|
|
|
.Ss MIB Variables
|
1995-02-15 03:30:54 +00:00
|
|
|
The
|
2003-03-22 13:43:06 +00:00
|
|
|
.Tn TCP
|
1999-08-17 14:54:26 +00:00
|
|
|
protocol implements a number of variables in the
|
2003-03-22 13:43:06 +00:00
|
|
|
.Va net.inet.tcp
|
1995-02-15 03:30:54 +00:00
|
|
|
branch of the
|
|
|
|
.Xr sysctl 3
|
|
|
|
MIB.
|
2004-11-02 22:22:22 +00:00
|
|
|
.Bl -tag -width ".Va TCPCTL_DO_RFC1323"
|
1995-02-15 03:30:54 +00:00
|
|
|
.It Dv TCPCTL_DO_RFC1323
|
2003-03-22 13:43:06 +00:00
|
|
|
.Pq Va rfc1323
|
1995-02-15 03:30:54 +00:00
|
|
|
Implement the window scaling and timestamp options of RFC 1323
|
2003-03-22 13:43:06 +00:00
|
|
|
(default is true).
|
1995-02-15 03:30:54 +00:00
|
|
|
.It Dv TCPCTL_MSSDFLT
|
2003-03-22 13:43:06 +00:00
|
|
|
.Pq Va mssdflt
|
1995-02-15 03:30:54 +00:00
|
|
|
The default value used for the maximum segment size
|
|
|
|
.Pq Dq MSS
|
|
|
|
when no advice to the contrary is received from MSS negotiation.
|
2001-09-06 22:50:12 +00:00
|
|
|
.It Dv TCPCTL_SENDSPACE
|
2003-03-22 13:43:06 +00:00
|
|
|
.Pq Va sendspace
|
|
|
|
Maximum
|
|
|
|
.Tn TCP
|
|
|
|
send window.
|
2001-09-06 22:50:12 +00:00
|
|
|
.It Dv TCPCTL_RECVSPACE
|
2003-03-22 13:43:06 +00:00
|
|
|
.Pq Va recvspace
|
|
|
|
Maximum
|
|
|
|
.Tn TCP
|
|
|
|
receive window.
|
|
|
|
.It Va log_in_vain
|
1999-08-17 14:54:26 +00:00
|
|
|
Log any connection attempts to ports where there is not a socket
|
|
|
|
accepting connections.
|
2003-03-22 13:43:06 +00:00
|
|
|
The value of 1 limits the logging to
|
|
|
|
.Tn SYN
|
|
|
|
(connection establishment) packets only.
|
|
|
|
That of 2 results in any
|
|
|
|
.Tn TCP
|
|
|
|
packets to closed ports being logged.
|
2002-04-16 13:19:33 +00:00
|
|
|
Any value unlisted above disables the logging
|
|
|
|
(default is 0, i.e., the logging is disabled).
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va msl
|
2002-01-21 12:09:13 +00:00
|
|
|
The Maximum Segment Lifetime, in milliseconds, for a packet.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va keepinit
|
|
|
|
Timeout, in milliseconds, for new, non-established
|
|
|
|
.Tn TCP
|
|
|
|
connections.
|
2012-02-05 16:53:02 +00:00
|
|
|
The default is 75000 msec.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va keepidle
|
2002-01-19 03:44:42 +00:00
|
|
|
Amount of time, in milliseconds, that the connection must be idle
|
|
|
|
before keepalive probes (if enabled) are sent.
|
2012-02-05 16:53:02 +00:00
|
|
|
The default is 7200000 msec (2 hours).
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va keepintvl
|
2002-01-19 03:44:42 +00:00
|
|
|
The interval, in milliseconds, between keepalive probes sent to remote
|
2011-01-08 00:44:17 +00:00
|
|
|
machines, when no response is received on a
|
|
|
|
.Va keepidle
|
|
|
|
probe.
|
2012-02-05 16:53:02 +00:00
|
|
|
The default is 75000 msec.
|
|
|
|
.It Va keepcnt
|
|
|
|
Number of probes sent, with no response, before a connection
|
|
|
|
is dropped.
|
|
|
|
The default is 8 packets.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va always_keepalive
|
2001-05-17 17:53:21 +00:00
|
|
|
Assume that
|
|
|
|
.Dv SO_KEEPALIVE
|
|
|
|
is set on all
|
|
|
|
.Tn TCP
|
|
|
|
connections, the kernel will
|
|
|
|
periodically send a packet to the remote host to verify the connection
|
|
|
|
is still up.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va icmp_may_rst
|
2001-05-17 17:53:21 +00:00
|
|
|
Certain
|
|
|
|
.Tn ICMP
|
|
|
|
unreachable messages may abort connections in
|
|
|
|
.Tn SYN-SENT
|
|
|
|
state.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va do_tcpdrain
|
2001-05-17 17:53:21 +00:00
|
|
|
Flush packets in the
|
|
|
|
.Tn TCP
|
|
|
|
reassembly queue if the system is low on mbufs.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va blackhole
|
1999-08-17 14:54:26 +00:00
|
|
|
If enabled, disable sending of RST when a connection is attempted
|
|
|
|
to a port where there is not a socket accepting connections.
|
|
|
|
See
|
|
|
|
.Xr blackhole 4 .
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va delayed_ack
|
1999-08-17 14:54:26 +00:00
|
|
|
Delay ACK to try and piggyback it onto a data packet.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va delacktime
|
2002-01-19 03:44:42 +00:00
|
|
|
Maximum amount of time, in milliseconds, before a delayed ACK is sent.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va path_mtu_discovery
|
|
|
|
Enable Path MTU Discovery.
|
|
|
|
.It Va tcbhashsize
|
2001-05-17 17:53:21 +00:00
|
|
|
Size of the
|
|
|
|
.Tn TCP
|
2003-03-22 13:43:06 +00:00
|
|
|
control-block hash table
|
2001-05-17 17:53:21 +00:00
|
|
|
(read-only).
|
|
|
|
This may be tuned using the kernel option
|
|
|
|
.Dv TCBHASHSIZE
|
|
|
|
or by setting
|
|
|
|
.Va net.inet.tcp.tcbhashsize
|
|
|
|
in the
|
|
|
|
.Xr loader 8 .
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va pcbcount
|
2001-05-17 17:53:21 +00:00
|
|
|
Number of active process control blocks
|
|
|
|
(read-only).
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va syncookies
|
|
|
|
Determines whether or not
|
|
|
|
.Tn SYN
|
|
|
|
cookies should be generated for outbound
|
|
|
|
.Tn SYN-ACK
|
|
|
|
packets.
|
|
|
|
.Tn SYN
|
|
|
|
cookies are a great help during
|
|
|
|
.Tn SYN
|
|
|
|
flood attacks, and are enabled by default.
|
|
|
|
(See
|
|
|
|
.Xr syncookies 4 . )
|
|
|
|
.It Va isn_reseed_interval
|
2001-09-06 22:50:12 +00:00
|
|
|
The interval (in seconds) specifying how often the secret data used in
|
|
|
|
RFC 1948 initial sequence number calculations should be reseeded.
|
|
|
|
By default, this variable is set to zero, indicating that
|
|
|
|
no reseeding will occur.
|
|
|
|
Reseeding should not be necessary, and will break
|
|
|
|
.Dv TIME_WAIT
|
|
|
|
recycling for a few minutes.
|
2018-08-06 17:36:57 +00:00
|
|
|
.It Va reass.cursegments
|
|
|
|
The current total number of segments present in all reassembly queues.
|
|
|
|
.It Va reass.maxsegments
|
|
|
|
The maximum limit on the total number of segments across all reassembly
|
|
|
|
queues.
|
|
|
|
The limit can be adjusted as a tunable.
|
|
|
|
.It Va reass.maxqueuelen
|
|
|
|
The maximum number of segments allowed in each reassembly queue.
|
|
|
|
By default, the system chooses a limit based on each TCP connection's
|
|
|
|
receive buffer size and maximum segment size (MSS).
|
|
|
|
The actual limit applied to a session's reassembly queue will be the lower of
|
|
|
|
the system-calculated automatic limit and the user-specified
|
|
|
|
.Va reass.maxqueuelen
|
|
|
|
limit.
|
2019-03-23 21:36:59 +00:00
|
|
|
.It Va rexmit_initial , rexmit_min , rexmit_slop
|
2003-03-22 13:43:06 +00:00
|
|
|
Adjust the retransmit timer calculation for
|
|
|
|
.Tn TCP .
|
|
|
|
The slop is
|
2002-08-25 01:51:57 +00:00
|
|
|
typically added to the raw calculation to take into account
|
2003-03-22 13:43:06 +00:00
|
|
|
occasional variances that the
|
|
|
|
.Tn SRTT
|
|
|
|
(smoothed round-trip time)
|
2004-06-21 17:42:49 +00:00
|
|
|
is unable to accommodate, while the minimum specifies an
|
2003-03-22 13:43:06 +00:00
|
|
|
absolute minimum.
|
|
|
|
While a number of
|
|
|
|
.Tn TCP
|
|
|
|
RFCs suggest a 1
|
|
|
|
second minimum, these RFCs tend to focus on streaming behavior,
|
2002-08-25 01:51:57 +00:00
|
|
|
and fail to deal with the fact that a 1 second minimum has severe
|
|
|
|
detrimental effects over lossy interactive connections, such
|
|
|
|
as a 802.11b wireless link, and over very fast but lossy
|
|
|
|
connections for those cases not covered by the fast retransmit
|
2003-03-22 13:43:06 +00:00
|
|
|
code.
|
|
|
|
For this reason, we use 200ms of slop and a near-0
|
|
|
|
minimum, which gives us an effective minimum of 200ms (similar to
|
|
|
|
.Tn Linux ) .
|
2019-03-23 21:36:59 +00:00
|
|
|
The initial value is used before an RTT measurement has been performed.
|
2015-10-27 09:43:05 +00:00
|
|
|
.It Va initcwnd_segments
|
|
|
|
Enable the ability to specify initial congestion window in number of segments.
|
|
|
|
The default value is 10 as suggested by RFC 6928.
|
|
|
|
Changing the value on fly would not affect connections using congestion window
|
|
|
|
from the hostcache.
|
|
|
|
Caution:
|
|
|
|
This regulates the burst of packets allowed to be sent in the first RTT.
|
|
|
|
The value should be relative to the link capacity.
|
|
|
|
Start with small values for lower-capacity links.
|
|
|
|
Large bursts can cause buffer overruns and packet drops if routers have small
|
|
|
|
buffers or the link is experiencing congestion.
|
2019-12-01 20:35:41 +00:00
|
|
|
.It Va newcwd
|
|
|
|
Enable the New Congestion Window Validation mechanism as described in RFC 7661.
|
|
|
|
This gently reduces the congestion window during periods, where TCP is
|
|
|
|
application limited and the network bandwidth is not utilized completely.
|
|
|
|
That prevents self-inflicted packet losses once the application starts to
|
|
|
|
transmit data at a higher speed.
|
2019-12-01 19:20:28 +00:00
|
|
|
.It Va rfc6675_pipe
|
|
|
|
Calculate the bytes in flight using the algorithm described in RFC 6675, and
|
|
|
|
is also a prerequisite to enable Proportional Rate Reduction.
|
2003-03-22 13:43:06 +00:00
|
|
|
.It Va rfc3042
|
|
|
|
Enable the Limited Transmit algorithm as described in RFC 3042.
|
2004-10-23 18:37:23 +00:00
|
|
|
It helps avoid timeouts on lossy links and also when the congestion window
|
2003-03-22 13:43:06 +00:00
|
|
|
is small, as happens on short transfers.
|
|
|
|
.It Va rfc3390
|
2003-03-13 01:44:58 +00:00
|
|
|
Enable support for RFC 3390, which allows for a variable-sized
|
|
|
|
starting congestion window on new connections, depending on the
|
2003-03-22 13:43:06 +00:00
|
|
|
maximum segment size.
|
|
|
|
This helps throughput in general, but
|
2003-03-13 01:44:58 +00:00
|
|
|
particularly affects short transfers and high-bandwidth large
|
2003-03-22 13:43:06 +00:00
|
|
|
propagation-delay connections.
|
2004-07-10 17:55:13 +00:00
|
|
|
.It Va sack.enable
|
|
|
|
Enable support for RFC 2018, TCP Selective Acknowledgment option,
|
|
|
|
which allows the receiver to inform the sender about all successfully
|
|
|
|
arrived segments, allowing the sender to retransmit the missing segments
|
|
|
|
only.
|
2007-02-28 19:32:46 +00:00
|
|
|
.It Va sack.maxholes
|
2007-02-28 21:36:11 +00:00
|
|
|
Maximum number of SACK holes per connection.
|
|
|
|
Defaults to 128.
|
2007-02-28 19:32:46 +00:00
|
|
|
.It Va sack.globalmaxholes
|
2007-02-28 22:40:21 +00:00
|
|
|
Maximum number of SACK holes per system, across all connections.
|
2007-02-28 19:32:46 +00:00
|
|
|
Defaults to 65536.
|
2006-09-13 15:24:27 +00:00
|
|
|
.It Va maxtcptw
|
|
|
|
When a TCP connection enters the
|
|
|
|
.Dv TIME_WAIT
|
|
|
|
state, its associated socket structure is freed, since it is of
|
|
|
|
negligible size and use, and a new structure is allocated to contain a
|
|
|
|
minimal amount of information necessary for sustaining a connection in
|
|
|
|
this state, called the compressed TCP TIME_WAIT state.
|
|
|
|
Since this structure is smaller than a socket structure, it can save
|
|
|
|
a significant amount of system memory.
|
|
|
|
The
|
|
|
|
.Va net.inet.tcp.maxtcptw
|
|
|
|
MIB variable controls the maximum number of these structures allocated.
|
|
|
|
By default, it is initialized to
|
|
|
|
.Va kern.ipc.maxsockets
|
2006-09-13 15:47:26 +00:00
|
|
|
/ 5.
|
2006-09-13 15:24:27 +00:00
|
|
|
.It Va nolocaltimewait
|
|
|
|
Suppress creating of compressed TCP TIME_WAIT states for connections in
|
|
|
|
which both endpoints are local.
|
2007-02-28 19:32:46 +00:00
|
|
|
.It Va fast_finwait2_recycle
|
2007-02-28 22:40:21 +00:00
|
|
|
Recycle
|
|
|
|
.Tn TCP
|
|
|
|
.Dv FIN_WAIT_2
|
2007-04-03 18:57:09 +00:00
|
|
|
connections faster when the socket is marked as
|
2007-02-28 22:40:21 +00:00
|
|
|
.Dv SBS_CANTRCVMORE
|
|
|
|
(no user process has the socket open, data received on
|
2007-02-28 21:36:11 +00:00
|
|
|
the socket cannot be read).
|
2007-02-28 22:40:21 +00:00
|
|
|
The timeout used here is
|
2007-02-28 21:36:11 +00:00
|
|
|
.Va finwait2_timeout .
|
2007-02-28 19:32:46 +00:00
|
|
|
.It Va finwait2_timeout
|
2007-02-28 22:40:21 +00:00
|
|
|
Timeout to use for fast recycling of
|
2007-02-28 19:32:46 +00:00
|
|
|
.Tn TCP
|
2007-02-28 22:40:21 +00:00
|
|
|
.Dv FIN_WAIT_2
|
2007-02-28 21:36:11 +00:00
|
|
|
connections.
|
|
|
|
Defaults to 60 seconds.
|
2008-08-16 21:12:25 +00:00
|
|
|
.It Va ecn.enable
|
|
|
|
Enable support for TCP Explicit Congestion Notification (ECN).
|
|
|
|
ECN allows a TCP sender to reduce the transmission rate in order to
|
|
|
|
avoid packet drops.
|
2016-05-19 23:03:07 +00:00
|
|
|
Settings:
|
|
|
|
.Bl -tag -compact
|
|
|
|
.It 0
|
|
|
|
Disable ECN.
|
|
|
|
.It 1
|
|
|
|
Allow incoming connections to request ECN.
|
|
|
|
Outgoing connections will request ECN.
|
|
|
|
.It 2
|
|
|
|
Allow incoming connections to request ECN.
|
|
|
|
Outgoing connections will not request ECN.
|
|
|
|
.El
|
2008-08-16 21:12:25 +00:00
|
|
|
.It Va ecn.maxretries
|
|
|
|
Number of retries (SYN or SYN/ACK retransmits) before disabling ECN on a
|
2014-10-14 12:29:24 +00:00
|
|
|
specific connection.
|
|
|
|
This is needed to help with connection establishment
|
2008-08-16 21:12:25 +00:00
|
|
|
when a broken firewall is in the network path.
|
2014-10-13 21:04:14 +00:00
|
|
|
.It Va pmtud_blackhole_detection
|
2014-10-14 12:29:24 +00:00
|
|
|
Turn on automatic path MTU blackhole detection.
|
2014-12-28 20:56:03 +00:00
|
|
|
In case of retransmits OS will
|
2014-10-14 12:29:24 +00:00
|
|
|
lower the MSS to check if it's MTU problem.
|
|
|
|
If current MSS is greater than
|
2014-12-28 20:56:03 +00:00
|
|
|
configured value to try, it will be set to configured value, otherwise,
|
|
|
|
MSS will be set to default values
|
2014-10-14 12:29:24 +00:00
|
|
|
.Po Va net.inet.tcp.mssdflt
|
|
|
|
and
|
|
|
|
.Va net.inet.tcp.v6mssdflt
|
|
|
|
.Pc .
|
2014-10-13 21:04:14 +00:00
|
|
|
.It Va pmtud_blackhole_mss
|
|
|
|
MSS to try for IPv4 if PMTU blackhole detection is turned on.
|
|
|
|
.It Va v6pmtud_blackhole_mss
|
|
|
|
MSS to try for IPv6 if PMTU blackhole detection is turned on.
|
|
|
|
.It Va pmtud_blackhole_activated
|
2014-12-28 20:56:03 +00:00
|
|
|
Number of times configured values were used in an attempt to downshift.
|
|
|
|
.It Va pmtud_blackhole_activated_min_mss
|
|
|
|
Number of times default MSS was used in an attempt to downshift.
|
2014-10-13 21:04:14 +00:00
|
|
|
.It Va pmtud_blackhole_failed
|
2014-12-28 20:56:03 +00:00
|
|
|
Number of connections for which retransmits continued even after MSS
|
|
|
|
downshift.
|
2016-06-28 13:37:01 +00:00
|
|
|
.It Va functions_available
|
|
|
|
List of available TCP function blocks (TCP stacks).
|
|
|
|
.It Va functions_default
|
|
|
|
The default TCP function block (TCP stack).
|
2017-01-30 02:25:55 +00:00
|
|
|
.It Va functions_inherit_listen_socket_stack
|
|
|
|
Determines whether to inherit listen socket's tcp stack or use the current
|
|
|
|
system default tcp stack, as defined by
|
2019-02-23 09:34:57 +00:00
|
|
|
.Va functions_default .
|
2017-01-30 02:25:55 +00:00
|
|
|
Default is true.
|
2016-10-21 11:29:25 +00:00
|
|
|
.It Va insecure_rst
|
2016-10-21 18:45:09 +00:00
|
|
|
Use criteria defined in RFC793 instead of RFC5961 for accepting RST segments.
|
2016-10-21 11:29:25 +00:00
|
|
|
Default is false.
|
|
|
|
.It Va insecure_syn
|
2016-10-21 18:45:09 +00:00
|
|
|
Use criteria defined in RFC793 instead of RFC5961 for accepting SYN segments.
|
2016-10-21 11:29:25 +00:00
|
|
|
Default is false.
|
2019-07-23 21:28:20 +00:00
|
|
|
.It Va ts_offset_per_conn
|
|
|
|
When initializing the TCP timestamps, use a per connection offset instead of a
|
|
|
|
per host pair offset.
|
|
|
|
Default is to use per connection offsets as recommended in RFC 7323.
|
2019-12-02 20:58:04 +00:00
|
|
|
.It Va perconn_stats_enable
|
|
|
|
Controls the default collection of statistics for all connections using the
|
|
|
|
.Xr stats 3
|
|
|
|
framework.
|
|
|
|
0 disables, 1 enables, 2 enables random sampling across log id connection
|
|
|
|
groups with all connections in a group receiving the same setting.
|
|
|
|
.It Va perconn_stats_sample_rates
|
|
|
|
A CSV list of template_spec=percent key-value pairs which controls the per
|
|
|
|
template sampling rates when
|
|
|
|
.Xr stats 3
|
|
|
|
sampling is enabled.
|
1995-02-15 03:30:54 +00:00
|
|
|
.El
|
2001-04-13 19:49:07 +00:00
|
|
|
.Sh ERRORS
|
1994-05-30 19:09:18 +00:00
|
|
|
A socket operation may fail with one of the following errors returned:
|
2001-04-13 19:49:07 +00:00
|
|
|
.Bl -tag -width Er
|
1994-05-30 19:09:18 +00:00
|
|
|
.It Bq Er EISCONN
|
|
|
|
when trying to establish a connection on a socket which
|
|
|
|
already has one;
|
2018-05-17 02:46:27 +00:00
|
|
|
.It Bo Er ENOBUFS Bc or Bo Er ENOMEM Bc
|
1994-05-30 19:09:18 +00:00
|
|
|
when the system runs out of memory for
|
|
|
|
an internal data structure;
|
|
|
|
.It Bq Er ETIMEDOUT
|
|
|
|
when a connection was dropped
|
|
|
|
due to excessive retransmissions;
|
|
|
|
.It Bq Er ECONNRESET
|
|
|
|
when the remote peer
|
|
|
|
forces the connection to be closed;
|
|
|
|
.It Bq Er ECONNREFUSED
|
|
|
|
when the remote
|
|
|
|
peer actively refuses connection establishment (usually because
|
|
|
|
no process is listening to the port);
|
|
|
|
.It Bq Er EADDRINUSE
|
|
|
|
when an attempt
|
|
|
|
is made to create a socket with a port which has already been
|
|
|
|
allocated;
|
|
|
|
.It Bq Er EADDRNOTAVAIL
|
2001-07-14 19:41:16 +00:00
|
|
|
when an attempt is made to create a
|
1994-05-30 19:09:18 +00:00
|
|
|
socket with a network address for which no network interface
|
2003-03-22 13:43:06 +00:00
|
|
|
exists;
|
1994-12-15 20:54:28 +00:00
|
|
|
.It Bq Er EAFNOSUPPORT
|
|
|
|
when an attempt is made to bind or connect a socket to a multicast
|
|
|
|
address.
|
2016-06-28 13:37:01 +00:00
|
|
|
.It Bq Er EINVAL
|
|
|
|
when trying to change TCP function blocks at an invalid point in the session;
|
|
|
|
.It Bq Er ENOENT
|
|
|
|
when trying to use a TCP function block that is not available;
|
1994-05-30 19:09:18 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr getsockopt 2 ,
|
|
|
|
.Xr socket 2 ,
|
2019-12-02 20:58:04 +00:00
|
|
|
.Xr stats 3 ,
|
1995-02-15 03:30:54 +00:00
|
|
|
.Xr sysctl 3 ,
|
2001-07-06 16:46:48 +00:00
|
|
|
.Xr blackhole 4 ,
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr inet 4 ,
|
1996-12-26 16:16:37 +00:00
|
|
|
.Xr intro 4 ,
|
1995-02-15 03:30:54 +00:00
|
|
|
.Xr ip 4 ,
|
2011-09-15 12:15:36 +00:00
|
|
|
.Xr mod_cc 4 ,
|
2012-03-20 12:24:36 +00:00
|
|
|
.Xr siftr 4 ,
|
2002-12-23 14:51:18 +00:00
|
|
|
.Xr syncache 4 ,
|
2016-08-16 15:11:46 +00:00
|
|
|
.Xr setkey 8 ,
|
|
|
|
.Xr tcp_functions 9
|
1995-02-15 03:30:54 +00:00
|
|
|
.Rs
|
2003-03-22 13:43:06 +00:00
|
|
|
.%A "V. Jacobson"
|
|
|
|
.%A "R. Braden"
|
|
|
|
.%A "D. Borman"
|
1995-02-15 03:30:54 +00:00
|
|
|
.%T "TCP Extensions for High Performance"
|
2003-03-22 13:43:06 +00:00
|
|
|
.%O "RFC 1323"
|
1995-02-15 03:30:54 +00:00
|
|
|
.Re
|
|
|
|
.Rs
|
Initial import of RFC 2385 (TCP-MD5) digest support.
This is the first of two commits; bringing in the kernel support first.
This can be enabled by compiling a kernel with options TCP_SIGNATURE
and FAST_IPSEC.
For the uninitiated, this is a TCP option which provides for a means of
authenticating TCP sessions which came into being before IPSEC. It is
still relevant today, however, as it is used by many commercial router
vendors, particularly with BGP, and as such has become a requirement for
interconnect at many major Internet points of presence.
Several parts of the TCP and IP headers, including the segment payload,
are digested with MD5, including a shared secret. The PF_KEY interface
is used to manage the secrets using security associations in the SADB.
There is a limitation here in that as there is no way to map a TCP flow
per-port back to an SPI without polluting tcpcb or using the SPD; the
code to do the latter is unstable at this time. Therefore this code only
supports per-host keying granularity.
Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6),
TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective
users of this feature, this will not pose any problem.
This implementation is output-only; that is, the option is honoured when
responding to a host initiating a TCP session, but no effort is made
[yet] to authenticate inbound traffic. This is, however, sufficient to
interwork with Cisco equipment.
Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with
local patches. Patches for tcpdump to validate TCP-MD5 sessions are also
available from me upon request.
Sponsored by: sentex.net
2004-02-11 04:26:04 +00:00
|
|
|
.%A "A. Heffernan"
|
|
|
|
.%T "Protection of BGP Sessions via the TCP MD5 Signature Option"
|
|
|
|
.%O "RFC 2385"
|
|
|
|
.Re
|
2008-08-16 21:12:25 +00:00
|
|
|
.Rs
|
|
|
|
.%A "K. Ramakrishnan"
|
|
|
|
.%A "S. Floyd"
|
|
|
|
.%A "D. Black"
|
|
|
|
.%T "The Addition of Explicit Congestion Notification (ECN) to IP"
|
|
|
|
.%O "RFC 3168"
|
|
|
|
.Re
|
1994-05-30 19:09:18 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
2003-03-22 13:43:06 +00:00
|
|
|
.Tn TCP
|
1995-02-15 03:30:54 +00:00
|
|
|
protocol appeared in
|
1994-05-30 19:09:18 +00:00
|
|
|
.Bx 4.2 .
|
1995-02-15 03:30:54 +00:00
|
|
|
The RFC 1323 extensions for window scaling and timestamps were added
|
|
|
|
in
|
|
|
|
.Bx 4.4 .
|
2007-01-22 14:16:47 +00:00
|
|
|
The
|
|
|
|
.Dv TCP_INFO
|
|
|
|
option was introduced in
|
|
|
|
.Tn Linux 2.6
|
|
|
|
and is
|
|
|
|
.Em subject to change .
|