]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/ipfilter/man/ipftest.1
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / contrib / ipfilter / man / ipftest.1
1 .TH ipftest 1
2 .SH NAME
3 ipftest \- test packet filter rules with arbitrary input.
4 .SH SYNOPSIS
5 .B ipftest
6 [
7 .B \-vbdPSTEHX
8 ] [
9 .B \-I
10 interface
11 ]
12 .B \-r
13 <filename>
14 [
15 .B \-i
16 <filename>
17 ]
18 .SH DESCRIPTION
19 .PP
20 \fBipftest\fP is provided for the purpose of being able to test a set of
21 filter rules without having to put them in place, in operation and proceed
22 to test their effectiveness.  The hope is that this minimises disruptions
23 in providing a secure IP environment.
24 .PP
25 \fBipftest\fP will parse any standard ruleset for use with \fBipf\fP
26 and apply input, returning output as to the result.  However, \fBipftest\fP
27 will return one of three values for packets passed through the filter:
28 pass, block or nomatch.  This is intended to give the operator a better
29 idea of what is happening with packets passing through their filter
30 ruleset.
31 .PP
32 When used without either of \fB\-S\fP, \fB\-T\fP or \fB\-E\fP,
33 \fBipftest\fP uses its own text input format to generate "fake" IP packets.
34 The format used is as follows:
35 .nf
36                 "in"|"out" "on" if ["tcp"|"udp"|"icmp"]
37                         srchost[,srcport] dsthost[,destport] [FSRPAU]
38 .fi
39 .PP
40 This allows for a packet going "in" or "out" of an interface (if) to be
41 generated, being one of the three main protocols (optionally), and if
42 either TCP or UDP, a port parameter is also expected.  If TCP is selected,
43 it is possible to (optionally) supply TCP flags at the end.  Some examples
44 are:
45 .nf
46                 # a UDP packet coming in on le0
47                 in on le0 udp 10.1.1.1,2210 10.2.1.5,23
48                 # an IP packet coming in on le0 from localhost - hmm :)
49                 in on le0 localhost 10.4.12.1
50                 # a TCP packet going out of le0 with the SYN flag set.
51                 out on le0 tcp 10.4.12.1,2245 10.1.1.1,23 S
52 .fi
53 .SH OPTIONS
54 .TP
55 .B \-v
56 Verbose mode.  This provides more information about which parts of rule
57 matching the input packet passes and fails.
58 .TP
59 .B \-d
60 Turn on filter rule debugging.  Currently, this only shows you what caused
61 the rule to not match in the IP header checking (addresses/netmasks, etc).
62 .TP
63 .B \-b
64 Cause the output to be a brief summary (one-word) of the result of passing
65 the packet through the filter; either "pass", "block" or "nomatch".
66 This is used in the regression testing.
67 .TP
68 .BR \-I \0<interface>
69 Set the interface name (used in rule matching) to be the name supplied.
70 This is useful with the \fB\-P, \-S, \-T\fP and \fB\-E\fP options, where it is
71 not otherwise possible to associate a packet with an interface.  Normal
72 "text packets" can override this setting.
73 .TP
74 .B \-P
75 The input file specified by \fB\-i\fP is a binary file produced using libpcap
76 (i.e., tcpdump version 3).  Packets are read from this file as being input
77 (for rule purposes).  An interface maybe specified using \fB\-I\fP.
78 .TP
79 .B \-S
80 The input file is to be in "snoop" format (see RFC 1761).  Packets are read
81 from this file and used as input from any interface.  This is perhaps the
82 most useful input type, currently.
83 .TP
84 .B \-T
85 The input file is to be text output from tcpdump.  The text formats which
86 are currently supported are those which result from the following tcpdump
87 option combinations:
88 .PP
89 .nf
90                 tcpdump -n
91                 tcpdump -nq
92                 tcpdump -nqt
93                 tcpdump -nqtt
94                 tcpdump -nqte
95 .fi
96 .LP
97 .TP
98 .B \-H
99 The input file is to be hex digits, representing the binary makeup of the
100 packet.  No length correction is made, if an incorrect length is put in
101 the IP header.
102 .TP
103 .B \-X
104 The input file is composed of text descriptions of IP packets.
105 .TP
106 .B \-E
107 The input file is to be text output from etherfind.  The text formats which
108 are currently supported are those which result from the following etherfind
109 option combinations:
110 .PP
111 .nf
112                 etherfind -n
113                 etherfind -n -t
114 .fi
115 .LP
116 .TP
117 .BR \-i \0<filename>
118 Specify the filename from which to take input.  Default is stdin.
119 .TP
120 .BR \-r \0<filename>
121 Specify the filename from which to read filter rules.
122 .SH SEE ALSO
123 ipf(5), ipf(8), snoop(1m), tcpdump(8), etherfind(8c)
124 .SH BUGS
125 Not all of the input formats are sufficiently capable of introducing a
126 wide enough variety of packets for them to be all useful in testing.