xref: /openbsd/usr.sbin/tcpdrop/tcpdrop.8 (revision 8aa0c375)
1*8aa0c375Smillert.\"	$OpenBSD: tcpdrop.8,v 1.14 2023/02/06 18:14:10 millert Exp $
24b9445ffSmarkus.\"
34b9445ffSmarkus.\" Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
44b9445ffSmarkus.\"
54b9445ffSmarkus.\" Permission to use, copy, modify, and distribute this software for any
64b9445ffSmarkus.\" purpose with or without fee is hereby granted, provided that the above
74b9445ffSmarkus.\" copyright notice and this permission notice appear in all copies.
84b9445ffSmarkus.\"
94b9445ffSmarkus.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
104b9445ffSmarkus.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
114b9445ffSmarkus.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
124b9445ffSmarkus.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
134b9445ffSmarkus.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
144b9445ffSmarkus.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
154b9445ffSmarkus.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
164b9445ffSmarkus.\"
17*8aa0c375Smillert.Dd $Mdocdate: February 6 2023 $
184b9445ffSmarkus.Dt TCPDROP 8
194b9445ffSmarkus.Os
204b9445ffSmarkus.Sh NAME
214b9445ffSmarkus.Nm tcpdrop
224b9445ffSmarkus.Nd drop a TCP connection
234b9445ffSmarkus.Sh SYNOPSIS
244b9445ffSmarkus.Nm tcpdrop
254150247bSderaadt.Ar local-addr
264150247bSderaadt.Ar local-port
274150247bSderaadt.Ar remote-addr
284150247bSderaadt.Ar remote-port
294b9445ffSmarkus.Sh DESCRIPTION
304b9445ffSmarkusThe
314b9445ffSmarkus.Nm
324b9445ffSmarkuscommand drops the TCP connection specified by the local address
334150247bSderaadt.Ar local-addr ,
344b9445ffSmarkusport
354150247bSderaadt.Ar local-port
364b9445ffSmarkusand the foreign address
374150247bSderaadt.Ar remote-addr ,
384b9445ffSmarkusport
394150247bSderaadt.Ar remote-port .
400f340300SottoAddresses and ports can be specified by name or numeric value.
41*8aa0c375Smillert.Pp
42*8aa0c375SmillertTo simplify dropping TCP connections using the output of
43*8aa0c375Smillert.Xr fstat 1
44*8aa0c375Smillertand
45*8aa0c375Smillert.Xr netstat 1 ,
46*8aa0c375Smillert.Nm
47*8aa0c375Smillertalso supports a two-argument form where the address and port are
48*8aa0c375Smillertseparated by a colon
49*8aa0c375Smillert.Pq Sq \&:
50*8aa0c375Smillertor dot
51*8aa0c375Smillert.Pq Sq \&.
52*8aa0c375Smillertcharacter.
530945da04Sjmc.Sh EXAMPLES
540945da04SjmcIf a connection to
551b1da000Sjmc.Xr httpd 8
560945da04Sjmcis causing congestion on a network link, one can drop the TCP session
570f340300Sottoin charge:
580945da04Sjmc.Bd -literal -offset indent
591b1da000Sjmc$ fstat | grep 'httpd.*internet.*<--'
601b1da000Sjmcwww      httpd      21307    3* internet stream tcp \e
611b1da000Sjmc	0xd1007ca8 192.168.5.41:80 <-- 192.168.5.1:26747
6248132b45Spb.Ed
6348132b45Spb.Pp
6418231cbeSderaadtEither of the following commands will drop the connection:
650945da04Sjmc.Bd -literal -offset indent
6648132b45Spb# tcpdrop 192.168.5.41 80 192.168.5.1 26747
6718231cbeSderaadt
6818231cbeSderaadt# tcpdrop 192.168.5.41:80 192.168.5.1:26747
69*8aa0c375Smillert
70*8aa0c375Smillert# tcpdrop 192.168.5.41.80 192.168.5.1.26747
7148132b45Spb.Ed
724b9445ffSmarkus.Sh SEE ALSO
7348132b45Spb.Xr fstat 1 ,
744b9445ffSmarkus.Xr netstat 1
752280d6e5Sxsa.Sh HISTORY
762280d6e5SxsaThe
772280d6e5Sxsa.Nm
782280d6e5Sxsaprogram first appeared in
792280d6e5Sxsa.Ox 3.6 .
802280d6e5Sxsa.Sh AUTHORS
812280d6e5Sxsa.An -nosplit
822280d6e5SxsaThe
832280d6e5Sxsa.Nm
842280d6e5Sxsaprogram was written by
8544e68d47Sschwarze.An Markus Friedl Aq Mt markus@openbsd.org .
86