Initial import from FreeBSD RELENG_4:
[games.git] / contrib / ipfilter / ipsend / ipsend.5
1 .TH IPSEND 5
2 .SH NAME
3 ipsend \- IP packet description language
4 .SH DESCRIPTION
5 The \fBipsend\fP program expects, with the \fB-L\fP option, input to be a
6 text file which fits the grammar described below.  The purpose of this
7 grammar is to allow IP packets to be described in an arbitary way which
8 also allows encapsulation to be so done to an arbitary level.
9 .SH GRAMMAR
10 .LP
11 .nf
12 line ::= iface | arp | send | defrouter | ipv4line .
13
14 iface ::= ifhdr "{" ifaceopts "}" ";" .
15 ifhdr ::= "interface" | "iface" .
16 ifaceopts ::= "ifname" name | "mtu" mtu | "v4addr" ipaddr |
17               "eaddr" eaddr .
18
19 send ::= "send" ";" | "send" "{" sendbodyopts "}" ";" .
20 sendbodyopts ::= sendbody [ sendbodyopts ] .
21 sendbody ::= "ifname" name | "via" ipaddr .
22
23 defrouter ::= "router" ipaddr .
24
25 arp ::= "arp" "{" arpbodyopts "}" ";" .
26 arpbodyopts ::= arpbody [ arpbodyopts ] .
27 arpbody ::= "v4addr" ipaddr | "eaddr" eaddr .
28
29 bodyline ::= ipv4line | tcpline | udpline | icmpline | dataline .
30
31 ipv4line ::= "ipv4" "{" ipv4bodyopts "}" ";" .
32 ipv4bodyopts ::= ipv4body [ ipv4bodyopts ] | bodyline .
33 ipv4body ::= "proto" protocol | "src" ipaddr | "dst" ipaddr |
34              "off" number | "v" number | "hl" number| "id" number |
35              "ttl" number | "tos" number | "sum" number | "len" number |
36              "opt" "{" ipv4optlist "}" ";" .
37 ipv4optlist ::= ipv4option [ ipv4optlist ] .
38 ipv4optlist = "nop" | "rr" | "zsu" | "mtup" | "mtur" | "encode" | "ts" |
39               "tr" | "sec" | "lsrr" | "e-sec" | "cipso" | "satid" |
40               "ssrr" | "addext" | "visa" | "imitd" | "eip" | "finn" |
41               "secclass" ipv4secclass.
42 ipv4secclass := "unclass" | "confid" | "reserv-1" | "reserv-2" |
43                 "reserv-3" | "reserv-4" | "secret" | "topsecret" .
44
45 tcpline ::= "tcp" "{" tcpbodyopts "}" ";" .
46 tcpbodyopts ::= tcpbody [ tcpbodyopts ] | bodyline .
47 tcpbody ::= "sport" port | "dport" port | "seq" number | "ack" number |
48             "off" number | "urp" number | "win" number | "sum" number |
49             "flags" tcpflags | data .
50
51 udpline ::= "udp" "{" udpbodyopts "}" ";" .
52 udpbodyopts ::= udpbody [ udpbodyopts ] | bodyline .
53 udpbody ::= "sport" port | "dport" port | "len" number | "sum" number |
54             data .
55
56 icmpline ::= "icmp" "{" icmpbodyopts "}" ";" .
57 icmpbodyopts ::= icmpbody [ icmpbodyopts ] | bodyline .
58 icmpbody ::= "type" icmptype [ "code" icmpcode ] .
59 icmptype ::= "echorep" | "echorep" "{" echoopts "}" ";" | "unreach" |
60              "unreach" "{" unreachtype "}" ";" | "squench" | "redir" |
61              "redir" "{" redirtype "}" ";" | "echo" "{" echoopts "}" ";" |
62              "echo" | "routerad" | "routersol" | "timex" |
63              "timex" "{" timextype "}" ";" | "paramprob" |
64              "paramprob" "{" parapptype "}" ";" | "timest" | "timestrep" |
65              "inforeq" | "inforep" | "maskreq" | "maskrep" .
66
67 echoopts ::= echoopts [ icmpechoopts ] .
68 unreachtype ::= "net-unr" | "host-unr" | "proto-unr" | "port-unr" |
69              "needfrag" | "srcfail" | "net-unk" | "host-unk" | "isolate" |
70              "net-prohib" | "host-prohib" | "net-tos" | "host-tos" |
71              "filter-prohib" | "host-preced" | "cutoff-preced" .
72 redirtype ::= "net-redir" | "host-redir" | "tos-net-redir" |
73               "tos-host-redir" .
74 timextype ::= "intrans" | "reass" .
75 paramptype ::= "optabsent" .
76
77 data    ::= "data" "{" databodyopts "}" ";" .
78 databodyopts ::= "len" number | "value" string | "file" filename .
79
80 icmpechoopts ::= "icmpseq" number | "icmpid" number .
81 .fi
82 .SH COMMANDS
83 .PP
84 Before sending any packets or defining any packets, it is necessary to
85 describe the interface(s) which will be used to send packets out.
86 .TP
87 .B interface
88 is used to describe a network interface.  The description included need
89 not match the actual configuration currently employed by the operating
90 system.
91 .TP
92 .B send
93 is used to actually send out a packet across the network.  If the
94 destination is not specified, it will attempt to send the packet
95 directly out on the network to the destination without routing it.
96 .TP
97 .B router
98 configures the default router for ipsend, as distinct from the default
99 route installed in the kernel.
100 .TP
101 .B ipv4
102 is used to describe an IP (version 4) packet.  IP header fields can be
103 specified, including options, followed by a data section which may contain
104 further protocol headers.
105 .SH IPV4
106 .TP
107 .B hl <number>
108 manually specifies the IP header length (automatically adjusts with the
109 presence of IP options and defaults to 5);
110 .TP
111 .B v <number>
112 set the IP version.  Default is 4.
113 .TP
114 .B tos <number>
115 set the type of service (TOS) field in the IP header.  Default is 0.
116 .TP
117 .B len <number>
118 manually specifies the length of the IP packet.  The length will automatically
119 be adjusted to accomodate data or further protocol headers.
120 .TP
121 .B off <number>
122 sets the fragment offset field of the IP packet.  Default is 0.
123 .TP
124 .B ttl <number>
125 sets the time to live (TTL) field of the IP header.  Default is 60. 
126 .TP
127 .B proto <protocol>
128 sets the protocol field of the IP header.  The protocol can either be a
129 number or a name found in \fB/etc/protocols\fP.
130 .TP
131 .B sum
132 manually specifies the checksum for the IP header.  If left unset (0), it
133 will be calculated prior to being sent.
134 .TP
135 .B src
136 manually specifies the source address of the IP header.  If left unset, it
137 will default to the host's IP address.
138 .TP
139 .B dst
140 sets the destination of the IP packet.  The default is 0.0.0.0.
141 .TP
142 .B opt
143 is used to include IP options in the IP header.
144 .TP
145 .B tcp
146 is used to indicate the a TCP protocol header is to follow.  See the \fBTCP\fP
147 section for TCP header options.
148 .TP
149 .B udp
150 is used to indicate the a UDP protocol header is to follow.  See the \fBUDP\fP
151 section for UDP header options.
152 .TP
153 .B icmp
154 is used to indicate the a ICMP protocol header is to follow.  See the
155 \fBICMP\fP section for ICMP header options.
156 .TP
157 .B data
158 is used to indicate that raw data is to be included in the IP packet.  See the
159 \fBDATA\fP section for details on options available.
160 .SH "IPv4 Options"
161 these keywords indicate that the releveant IP option should be added to the
162 IP header (the header length field will be adjusted appropriately).
163 .TP
164 .B nop
165 No Operation [RFC 791] (space filler).
166 .TP
167 .B rr <number>
168 Record Router [RFC 791].  The number given specifies the number of
169 \fBbytes\fP to be used for storage.  This should be a multiple of 4 for
170 proper operation.
171 .TP
172 .B zsu
173 Experimental Measurement.
174 .TP
175 .B mtup [RFC 1191].
176 MTU Probe.
177 .TP
178 .B mtur [RFC 1191].
179 MTU Ready.
180 .TP
181 .B encode
182 .TP
183 .B ts
184 Timestamp [RFC 791].
185 .TP
186 .B tr
187 Traceroute [RFC 1393].
188 .TP
189 .B "sec-class <security-level>, sec"
190 Security [RFC 1108].  This option specifies the security label for the packet.
191 Using \fBsec\fP sets up the framework of the security option but unless
192 \fBsec-class\fP is given, the level may not be set.
193 .TP
194 .B "lsrr <ip-address>"
195 Loose Source Route [RFC 791].
196 .TP
197 .B e-sec
198 Extended Security [RFC 1108].
199 .TP
200 .B cipso
201 Commercial Security.
202 .TP
203 .B satid
204 Stream ID [RFC 791].
205 .TP
206 .B "ssrr <ip-address>"
207 Strict Source Route [RFC 791].
208 .TP
209 .B addext
210 Address Extension
211 .TP
212 .B visa
213 Expermental Access Control.
214 .TP
215 .B imitd
216 IMI Traffic Descriptor.
217 .TP
218 .B eip
219 [RFC 1358].
220 .TP
221 .B finn
222 Experimental Flow Control.
223 .SH TCP
224 .TP
225 .B sport <port>
226 sets the source port to the number/name given.  Default is 0.
227 .TP
228 .B dport <port>
229 sets the destination port to the number/name given.  Default is 0.
230 .TP
231 .B seq <number>
232 sets the sequence number to the number specified.  Default is 0.
233 .TP
234 .B ack <number>
235 sets the acknowledge number to the number specified.  Default is 0.
236 .TP
237 .B off <number>
238 sets the offset value for the start of data to the number specified.  This
239 implies the size of the TCP header.  It is automatically adjusted if TCP
240 options are included and defaults to 5.
241 .TP
242 .B urp <number>
243 sets the value of the urgent data pointer to the number specified.  Default
244 is 0.
245 .TP
246 .B win <number>
247 sets the size of the TCP window to the number specified.  Default is 4096.
248 .TP
249 .B sum <number>
250 manually specifies the checksum for the TCP pseudo-header and data.  If left
251 unset, it defaults to 0 and is automatically calculated.
252 .TP
253 .B flags <tcp-flags>
254 sets the TCP flags field to match the flags specified.  Valid flags are
255 "S" (SYN), "A" (ACK), "R" (RST), "F" (FIN), "U" (URG), "P" (PUSH).
256 .TP
257 .B opt
258 indicates that TCP header options follow.  As TCP options are added to the
259 TCP header, the \fBoff\fP field is updated to match.
260 .TP
261 .B data
262 indicates that a data section is to follow and is to be included as raw
263 data, being appended to the header.
264 .SH "TCP options"
265 With a TCP header, it is possible to append a number of header options.
266 The TCP header offset will be updated automatically to reflect the change
267 in size.  The valid options are: \fBnop\fP No Operation,
268 \fBeol\fP End Of (option) List, \fBmss [ size ]\fP Maximum Segment Size - this
269 sets the maximum receivable size of a packet containing data,
270 \fBwscale\fP Window Scale, \fBts\fP Timestamp.
271 .SH UDP
272 .TP
273 .B sport <port>
274 sets the source port to the number/name given.  Default is 0.
275 .TP
276 .B dport <port>
277 sets the destination port to the number/name given.  Default is 0.
278 .TP
279 .B len <number>
280 manually specifies the length of the UDP header and data.  If left unset,
281 it is automatically adjusted to match the header presence and any data if
282 present.
283 .TP
284 .B sum <number>
285 manually specifies the checksum for the UDP pseudo-header and data.  If left
286 unset, it defaults to 0 and is automatically calculated.
287 .TP
288 .B data
289 indicates that a data section is to follow and is to be included as raw
290 data, being appended to the header.
291 .SH ICMP
292 .TP
293 .B type <icmptype>
294 sets the ICMP type according the to the icmptype tag.  This may either be
295 a number or one of the recognised tags (see the \fBICMP TYPES\fP section for a
296 list of names recognised).
297 .TP
298 .B code <icmpcode>
299 sets the ICMP code.
300 .TP
301 .B data
302 indicates that a data section is to follow and is to be included as raw
303 data, being appended to the header.
304 .SH DATA
305 Each of the following extend the packet in a different way.  \fBLen\fP just
306 increases the length (without adding any content), \fBvalue\fP uses a string
307 and \fBfile\fP a file.
308 .TP
309 .B len <number>
310 extend the length of the packet by \fBnumber\fP bytes (without filling those
311 bytes with any particular data).
312 .TP
313 .B value <string>
314 indicates that the string provided should be added to the current packet as
315 data.  A string may be a consecutive list of characters and numbers (with
316 no white spaces) or bounded by "'s (may not contain them, even if \\'d).
317 The \\ charcater is recognised with the appropriate C escaped values, including
318 octal numbers.
319 .TP
320 .B file <filename>
321 reads data in from the specified file and appends it to the current packet.
322 If the new total length would exceed 64k, an error will be reported.
323 .SH "ICMP TYPES"
324 .TP
325 .B echorep
326 Echo Reply.
327 .TP
328 .B "unreach [ unreachable-code ]"
329 Generic Unreachable error.  This is used to indicate that an error has
330 occurred whilst trying to send the packet across the network and that the
331 destination cannot be reached.  The unreachable code names are:
332 \fBnet-unr\fP network unreachable, \fBhost-unr\fP host unreachable,
333 \fBproto-unr\fP protocol unreachable, \fBport-unr\fP port unreachable,
334 \fBneedfrag\fP, \fBsrcfail\fP source route failed,
335 \fBnet-unk\fP network unknown, \fBhost-unk\fP host unknown,
336 \fBisolate\fP, \fBnet-prohib\fP administratively prohibited contact with
337 network,
338 \fBhost-prohib\fP administratively prohibited contact with host,
339 \fBnet-tos\fP network unreachable with given TOS,
340 \fBhost-tos\fP host unreachable with given TOS,
341 \fBfilter-prohib\fP packet prohibited by packet filter,
342 \fBhost-preced\fP,
343 \fBcutoff-preced\fP.
344 .TP
345 .B squench
346 Source Quence.
347 .TP
348 .B "redir [ redirect-code ]"
349 Redirect (routing).  This is used to indicate that the route being chosen
350 for forwarding the packet is suboptimal and that the sender of the packet
351 should be routing packets via another route.  The redirect code names are:
352 \fBnet-redir\fP redirect packets for a network,
353 \fBhost-redir\fP redirect packets for a host,
354 \fBtos-net-redir\fP redirect packets for a network with a given TOS,
355 \fBtos-host-redir\fP redirect packets for a host with a given TOS.
356 .TP
357 .B echo
358 Echo.
359 .TP
360 .B routerad
361 Router Advertisment.
362 .TP
363 .B routersol
364 Router solicitation.
365 .TP
366 .B "timex [ timexceed-code ]"
367 Time Exceeded.  This is used to indicate that the packet failed to reach the
368 destination because it was in transit too long (i.e. ttl reached 0).  The
369 valid code names are: \fBintrans\fP,
370 \fBreass\fP could not reassemble packet from fragments within a given time.
371 .TP
372 .B "paramprob [ paramprob-code ]"
373 Parameter problem.  There is only one available parameter problem code name:
374 \fBoptabsent\fP.
375 .TP
376 .B timest
377 Time stamp request.
378 .TP
379 .B "timestrep [ { timestamp-code } ]"
380 Time stamp reply.  In a timestamp reply, it is possible to supply the
381 following values: \fBrtime\fP, \fBotime\fP, \fBttime\fP.
382 .TP
383 .B inforeq
384 Information request.
385 .TP
386 .B inforep
387 Information reply.
388 .TP
389 .B maskreq
390 Address mask request.
391 .TP
392 .B maskrep
393 Address mask reply.
394 .SH FILES
395 /etc/hosts
396 .br
397 /etc/protocols
398 .br
399 /etc/services
400 .SH SEE ALSO
401 ipsend(1), iptest(1), hosts(5), protocols(5), services(5)