1eb35bc03SNiclas Zeising.\" Copyright (c) 2006 Niclas Zeising <zeising@FreeBSD.org> 23105ed4eSJoel Dahl.\" 33105ed4eSJoel Dahl.\" Redistribution and use in source and binary forms, with or without 43105ed4eSJoel Dahl.\" modification, are permitted provided that the following conditions 53105ed4eSJoel Dahl.\" are met: 63105ed4eSJoel Dahl.\" 1. Redistributions of source code must retain the above copyright 73105ed4eSJoel Dahl.\" notice, this list of conditions and the following disclaimer. 83105ed4eSJoel Dahl.\" 2. Redistributions in binary form must reproduce the above copyright 93105ed4eSJoel Dahl.\" notice, this list of conditions and the following disclaimer in the 103105ed4eSJoel Dahl.\" documentation and/or other materials provided with the distribution. 113105ed4eSJoel Dahl.\" 123105ed4eSJoel Dahl.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 133105ed4eSJoel Dahl.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 143105ed4eSJoel Dahl.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 153105ed4eSJoel Dahl.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 163105ed4eSJoel Dahl.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 173105ed4eSJoel Dahl.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 183105ed4eSJoel Dahl.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 193105ed4eSJoel Dahl.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 203105ed4eSJoel Dahl.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 213105ed4eSJoel Dahl.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 223105ed4eSJoel Dahl.\" SUCH DAMAGE. 233105ed4eSJoel Dahl.\" 243105ed4eSJoel Dahl.Dd May 22, 2006 253105ed4eSJoel Dahl.Dt IPFWPCAP 8 263105ed4eSJoel Dahl.Os 273105ed4eSJoel Dahl.Sh NAME 283105ed4eSJoel Dahl.Nm ipfwpcap 293105ed4eSJoel Dahl.Nd "copy diverted packets to a file in tcpdump format" 303105ed4eSJoel Dahl.Sh SYNOPSIS 313105ed4eSJoel Dahl.Nm 323105ed4eSJoel Dahl.Op Fl dr 333105ed4eSJoel Dahl.Op Fl b Ar maxbytes 343105ed4eSJoel Dahl.Op Fl p Ar maxpkts 353105ed4eSJoel Dahl.Op Fl P Ar pidfile 363105ed4eSJoel Dahl.Ar portnum 373105ed4eSJoel Dahl.Ar dumpfile 383105ed4eSJoel Dahl.Sh DESCRIPTION 393105ed4eSJoel DahlThe 403105ed4eSJoel Dahl.Nm 413105ed4eSJoel Dahlutility is used to copy diverted packets to a file in 423105ed4eSJoel Dahl.Xr tcpdump 1 433105ed4eSJoel Dahlformat. 443105ed4eSJoel DahlThe interesting packets are diverted by 453105ed4eSJoel Dahl.Xr ipfw 8 463105ed4eSJoel Dahlto a port on which 473105ed4eSJoel Dahl.Nm 483105ed4eSJoel Dahllistens. 49c4d39d80SJoel DahlThe packets are then dropped unless 503105ed4eSJoel Dahl.Fl r 513105ed4eSJoel Dahlis used. 523105ed4eSJoel Dahl.Pp 533105ed4eSJoel DahlThe options are as follows: 5466f6e0e5SRuslan Ermilov.Bl -tag -width indent 553105ed4eSJoel Dahl.It Fl d 563105ed4eSJoel DahlTurns on extra debugging messages. 573105ed4eSJoel Dahl.It Fl r 5866f6e0e5SRuslan ErmilovWrites packets back to the 5966f6e0e5SRuslan Ermilov.Xr divert 4 6066f6e0e5SRuslan Ermilovsocket. 613105ed4eSJoel Dahl.It Fl rr 623105ed4eSJoel DahlIndicates that it is okay to quit if 633105ed4eSJoel Dahl.Ar maxbytes 643105ed4eSJoel Dahlor 653105ed4eSJoel Dahl.Ar maxpkts 663105ed4eSJoel Dahlare reached. 673105ed4eSJoel DahlDiverted packets will silently disappear if nothing is listening on the 6866f6e0e5SRuslan Ermilov.Xr divert 4 6966f6e0e5SRuslan Ermilovsocket. 703105ed4eSJoel Dahl.It Fl b Ar maxbytes 713105ed4eSJoel DahlStop dumping after 723105ed4eSJoel Dahl.Ar maxbytes 733105ed4eSJoel Dahlbytes. 743105ed4eSJoel Dahl.It Fl p Ar maxpkts 753105ed4eSJoel DahlStop dumping after 763105ed4eSJoel Dahl.Ar maxpkt 773105ed4eSJoel Dahlpackets. 783105ed4eSJoel Dahl.It Fl P Ar pidfile 793105ed4eSJoel DahlFile to store PID number in. 803105ed4eSJoel DahlDefault is 813105ed4eSJoel Dahl.Pa /var/run/ipwfpcap.portnr.pid . 823105ed4eSJoel Dahl.El 833105ed4eSJoel Dahl.Pp 843105ed4eSJoel DahlThe 853105ed4eSJoel Dahl.Ar portnum 863105ed4eSJoel Dahlargument specifies which 873105ed4eSJoel Dahl.Xr divert 4 883105ed4eSJoel Dahlsocket port to listen on. 893105ed4eSJoel DahlThe 903105ed4eSJoel Dahl.Ar dumpfile 91c4d39d80SJoel Dahlargument is the path to the file to write captured packets to. 923105ed4eSJoel DahlSpecify 9366f6e0e5SRuslan Ermilov.Sq Fl 943105ed4eSJoel Dahlto write to stdout. 953105ed4eSJoel Dahl.Sh EXIT STATUS 963105ed4eSJoel Dahl.Ex -std 973105ed4eSJoel Dahl.Sh EXAMPLES 9866f6e0e5SRuslan Ermilov.Dl "ipfwpcap -r 8091 divt.log &" 993105ed4eSJoel Dahl.Pp 1003105ed4eSJoel DahlStarts 1013105ed4eSJoel Dahl.Nm 1023105ed4eSJoel Dahlas a background job listening to port 8091 and reflecting the packets 1033105ed4eSJoel Dahlback to the socket. 1043105ed4eSJoel Dahl.Pp 10566f6e0e5SRuslan Ermilov.Dl "ipfw add 2864 divert 8091 ip from 192.0.2.101" 1063105ed4eSJoel Dahl.Pp 1073105ed4eSJoel DahlExample 1083105ed4eSJoel Dahl.Xr ipfw 8 10966f6e0e5SRuslan Ermilovrule to divert all packets from 192.0.2.101 to port 8091. 1103105ed4eSJoel DahlSee 1113105ed4eSJoel Dahl.Xr ipfw 8 1123105ed4eSJoel Dahlfor details. 1133105ed4eSJoel Dahl.Sh SEE ALSO 1143105ed4eSJoel Dahl.Xr tcpdump 1 , 1153105ed4eSJoel Dahl.Xr pcap 3 , 1163105ed4eSJoel Dahl.Xr divert 4 , 1173105ed4eSJoel Dahl.Xr ipfw 8 1183105ed4eSJoel Dahl.Sh HISTORY 1193105ed4eSJoel DahlThe 1203105ed4eSJoel Dahl.Nm 1213105ed4eSJoel Dahlutility first appeared in 1223105ed4eSJoel Dahl.Fx 7.0 . 1233105ed4eSJoel Dahl.Sh AUTHORS 1243105ed4eSJoel Dahl.An -nosplit 1253105ed4eSJoel Dahl.Nm 1263105ed4eSJoel Dahlwas written by 12701c2b8acSBaptiste Daroussin.An P. Kern Aq Mt pkern@cns.utoronto.ca . 1283105ed4eSJoel DahlThis manual page was written by 12901c2b8acSBaptiste Daroussin.An Niclas Zeising Aq Mt zeising@FreeBSD.org . 130