xref: /openbsd/usr.sbin/tcpdrop/tcpdrop.8 (revision 3bef86f7)
1.\"	$OpenBSD: tcpdrop.8,v 1.14 2023/02/06 18:14:10 millert Exp $
2.\"
3.\" Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: February 6 2023 $
18.Dt TCPDROP 8
19.Os
20.Sh NAME
21.Nm tcpdrop
22.Nd drop a TCP connection
23.Sh SYNOPSIS
24.Nm tcpdrop
25.Ar local-addr
26.Ar local-port
27.Ar remote-addr
28.Ar remote-port
29.Sh DESCRIPTION
30The
31.Nm
32command drops the TCP connection specified by the local address
33.Ar local-addr ,
34port
35.Ar local-port
36and the foreign address
37.Ar remote-addr ,
38port
39.Ar remote-port .
40Addresses and ports can be specified by name or numeric value.
41.Pp
42To simplify dropping TCP connections using the output of
43.Xr fstat 1
44and
45.Xr netstat 1 ,
46.Nm
47also supports a two-argument form where the address and port are
48separated by a colon
49.Pq Sq \&:
50or dot
51.Pq Sq \&.
52character.
53.Sh EXAMPLES
54If a connection to
55.Xr httpd 8
56is causing congestion on a network link, one can drop the TCP session
57in charge:
58.Bd -literal -offset indent
59$ fstat | grep 'httpd.*internet.*<--'
60www      httpd      21307    3* internet stream tcp \e
61	0xd1007ca8 192.168.5.41:80 <-- 192.168.5.1:26747
62.Ed
63.Pp
64Either of the following commands will drop the connection:
65.Bd -literal -offset indent
66# tcpdrop 192.168.5.41 80 192.168.5.1 26747
67
68# tcpdrop 192.168.5.41:80 192.168.5.1:26747
69
70# tcpdrop 192.168.5.41.80 192.168.5.1.26747
71.Ed
72.Sh SEE ALSO
73.Xr fstat 1 ,
74.Xr netstat 1
75.Sh HISTORY
76The
77.Nm
78program first appeared in
79.Ox 3.6 .
80.Sh AUTHORS
81.An -nosplit
82The
83.Nm
84program was written by
85.An Markus Friedl Aq Mt markus@openbsd.org .
86