---
name: "tcpsso"
section: "8"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/tcpsso"
---

# tcpsso(8)

set a socket option on a TCP endpoint

## NAME

**tcpsso** – set a socket option on a TCP endpoint

## SYNOPSIS

**tcpsso** **-i** *id* \[*level*\] *optname* *optval*

**tcpsso** **-a** \[*level*\] *optname* *optval*

**tcpsso** **-C** *cc-algo* \[**-S** *stack*\] \[**-s** *state*\] \[*level*\] *optname* *optval*

**tcpsso** \[**-C** *cc-algo*\] **-S** *stack* \[**-s** *state*\] \[*level*\] *optname* *optval*

**tcpsso** \[**-C** *cc-algo*\] \[**-S** *stack*\] **-s** *state* \[*level*\] *optname* *optval*

## DESCRIPTION

The **tcpsso** command applies a *level* level socket option with name *optname* and value *optval* on a TCP endpoint from the command line.

TCP endpoints in the SYN\_RCVD state can only be handled by **tcpsso** if their prior state was SYN\_SENT.

\[*level*\] can be specified as a non-negative number or a symbolic name like SOL\_SOCKET, IPPROTO\_IP, IPPROTO\_IPV6, or IPPROTO\_TCP. If not specified, **tcpsso** deduces the level from *optname*, if provided as a symbolic name. If that is not the case, IPPROTO\_TCP is used.

*optname* can be specified as a non-negative number or a symbolic name like SO\_DEBUG, IP\_TOS, IPV6\_TCLASS, TCP\_LOG, TCP\_CONGESTION, or TCP\_FUNCTION\_BLK.

*optval* can be an integer value, which will be converted to a binary value and passed as an int value. If it cannot be parsed as an integer value, it will be processed as a string. If the *optname* is TCP\_FUNCTION\_BLK then *optval* is converted to a *struct tcp\_function\_set*.

If **-i** *id* is specified then **tcpsso** will apply the socket option to the TCP endpoint with the inp\_gencnt provided as *id*. The inp\_gencnt for existing TCP endpoints can be determined by using [sockstat(1)](/sockstat/1.md).

If **-a** is specified then **tcpsso** will apply the socket option to all TCP endpoints subject to the above state restrictions.

If **-C** *cc-algo* is specified then **tcpsso** will apply the socket option to all TCP endpoints using the TCP congestion control algorithm *cc-algo* and subject to the above state restrictions.

If **-S** *stack* is specified then **tcpsso** will apply the socket option to all TCP endpoints using the TCP stack *stack* and subject to the above state restrictions.

If **-s** *state* is specified then **tcpsso** will apply the socket option to all TCP endpoints being in the state *state*. *state* is one of CLOSED, LISTEN, SYN\_SENT, SYN\_RCVD, ESTABLISHED, CLOSE\_WAIT, FIN\_WAIT\_1, CLOSING, LAST\_ACK, FIN\_WAIT\_2, or TIME\_WAIT. Using SYN\_RCVD only applies to TCP endpoints in the state SYN\_RCVD if their prior state was SYN\_SENT.

If multiple of **-C** *cc-algo*, **-S** *stack*, and **-s** *state* are specified, **tcpsso** will apply the socket option to all TCP endpoints using the congestion control algorithm *cc-algo*, being in the state *state*, and using the TCP stack *stack*, if specified.

If none of the **-a**, **-C**, **-S**, or **-s** options are specified then the option **-i** must be specified.

## EXIT STATUS

The **tcpsso** utility exits 0 on success, and \>0 if an error occurs.

## EXAMPLES

To diagnose a problem with a particular TCP connection to [sshd(8)](/sshd/8.md), first determine its inp\_gencnt using [sockstat(1)](/sockstat/1.md):

```
# sockstat -4 -c -i -p 22 -P tcp -q
root     sshd       827   4  tcp4 \
	192.168.1.1:22        192.168.1.2:53736     435
```

Then, use the following command to enable Black Box Logging on it:

```
# tcpsso -i 435 TCP_LOG 4
```

To switch all TCP endpoints from using the freebsd stack to the RACK stack use:

```
# tcpsso -S freebsd TCP_FUNCTION_BLK rack
```

Switch all TCP endpoints in the LISTEN state to the RACK stack by using:

```
# tcpsso -s LISTEN TCP_FUNCTION_BLK rack
```

The following command will set the congestion control module of all TCP endpoints currently using cubic as its congestion control algorithm to the congestion control algorithm newreno:

```
# tcpsso -C cubic TCP_CONGESTION newreno
```

## SEE ALSO

[sockstat(1)](/sockstat/1.md), [setsockopt(2)](/setsockopt/2.md), [tcp(4)](/tcp/4.md), [tcp\_functions(9)](/tcp_functions/9.md)

## HISTORY

The **tcpsso** command first appeared in FreeBSD 14.

## AUTHORS

Michael Tuexen ⟨*tuexen@FreeBSD.org*⟩
