]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libpcap/pcap-filter.manmisc.in
xo: Disable -Wunused-but-set-variable.
[FreeBSD/FreeBSD.git] / contrib / libpcap / pcap-filter.manmisc.in
1 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that: (1) source code distributions
7 .\" retain the above copyright notice and this paragraph in its entirety, (2)
8 .\" distributions including binary code include the above copyright notice and
9 .\" this paragraph in its entirety in the documentation or other materials
10 .\" provided with the distribution, and (3) all advertising materials mentioning
11 .\" features or use of this software display the following acknowledgement:
12 .\" ``This product includes software developed by the University of California,
13 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 .\" the University nor the names of its contributors may be used to endorse
15 .\" or promote products derived from this software without specific prior
16 .\" written permission.
17 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 .\"
21 .TH PCAP-FILTER @MAN_MISC_INFO@ "19 November 2022"
22 .SH NAME
23 pcap-filter \- packet filter syntax
24 .br
25 .ad
26 .SH DESCRIPTION
27 .LP
28 .BR pcap_compile (3PCAP)
29 is used to compile a string into a filter program.
30 The resulting filter program can then be applied to
31 some stream of packets to determine which packets will be supplied to
32 .BR pcap_loop (3PCAP),
33 .BR pcap_dispatch (3PCAP),
34 .BR pcap_next (3PCAP),
35 or
36 .BR pcap_next_ex (3PCAP).
37 .LP
38 The \fIfilter expression\fP consists of one or more
39 .IR primitives .
40 Primitives usually consist of an
41 .I id
42 (name or number) preceded by one or more qualifiers.
43 There are three
44 different kinds of qualifier:
45 .IP \fItype\fP
46 .I type
47 qualifiers say what kind of thing the id name or number refers to.
48 Possible types are
49 .BR host ,
50 .BR net ,
51 .B port
52 and
53 .BR portrange .
54 E.g., `\fBhost\fP foo', `\fBnet\fP 128.3', `\fBport\fP 20', `\fBportrange\fP 6000-6008'.
55 If there is no type
56 qualifier,
57 .B host
58 is assumed.
59 .IP \fIdir\fP
60 .I dir
61 qualifiers specify a particular transfer direction to and/or from
62 .IR id .
63 Possible directions are
64 .BR src ,
65 .BR dst ,
66 .BR "src or dst" ,
67 .BR "src and dst" ,
68 .BR ra ,
69 .BR ta ,
70 .BR addr1 ,
71 .BR addr2 ,
72 .BR addr3 ,
73 and
74 .BR addr4 .
75 E.g., `\fBsrc\fP foo', `\fBdst net\fP 128.3', `\fBsrc or dst port\fP ftp-data'.
76 If
77 there is no dir qualifier, `\fBsrc or dst\fP' is assumed.
78 The
79 .BR ra ,
80 .BR ta ,
81 .BR addr1 ,
82 .BR addr2 ,
83 .BR addr3 ,
84 and
85 .B addr4
86 qualifiers are only valid for IEEE 802.11 Wireless LAN link layers.
87 .IP \fIproto\fP
88 .I proto
89 qualifiers restrict the match to a particular protocol.
90 Possible
91 protocols are:
92 .BR ether ,
93 .BR fddi ,
94 .BR tr ,
95 .BR wlan ,
96 .BR ip ,
97 .BR ip6 ,
98 .BR arp ,
99 .BR rarp ,
100 .BR decnet ,
101 .BR sctp ,
102 .B tcp
103 and
104 .BR udp .
105 E.g., `\fBether src\fP foo', `\fBarp net\fP 128.3', `\fBtcp port\fP 21',
106 `\fBudp portrange\fP 7000-7009', `\fBwlan addr2\fP 0:2:3:4:5:6'.
107 If there is no
108 .I proto
109 qualifier, all protocols consistent with the type are assumed.
110 E.g., `\fBsrc\fP foo' means `\fB(ip or arp or rarp) src\fP foo',
111 `\fBnet\fP bar' means `\fB(ip or arp or rarp) net\fP bar' and
112 `\fBport\fP 53' means `\fB(tcp or udp or sctp) port\fP 53'
113 (note that these examples use invalid syntax to illustrate the principle).
114 .LP
115 [\fBfddi\fP is actually an alias for \fBether\fP; the parser treats them
116 identically as meaning ``the data link level used on the specified
117 network interface''.  FDDI headers contain Ethernet-like source
118 and destination addresses, and often contain Ethernet-like packet
119 types, so you can filter on these FDDI fields just as with the
120 analogous Ethernet fields.
121 FDDI headers also contain other fields,
122 but you cannot name them explicitly in a filter expression.
123 .LP
124 Similarly, \fBtr\fP and \fBwlan\fP are aliases for \fBether\fP; the previous
125 paragraph's statements about FDDI headers also apply to Token Ring
126 and 802.11 wireless LAN headers.  For 802.11 headers, the destination
127 address is the DA field and the source address is the SA field; the
128 BSSID, RA, and TA fields aren't tested.]
129 .LP
130 In addition to the above, there are some special `primitive' keywords
131 that don't follow the pattern:
132 .BR gateway ,
133 .BR broadcast ,
134 .BR less ,
135 .B greater
136 and arithmetic expressions.
137 All of these are described below.
138 .LP
139 More complex filter expressions are built up by using the words
140 .BR and ,
141 .B or
142 and
143 .B not
144 (or equivalently: `\fB&&\fP', `\fB||\fP' and `\fB!\fP' respectively)
145 to combine primitives.
146 E.g., `\fBhost\fP foo \fBand not port\fP ftp \fBand not port\fP ftp-data'.
147 To save typing, identical qualifier lists can be omitted.
148 E.g.,
149 `\fBtcp dst port\fP ftp \fBor\fP ftp-data \fBor\fP domain' is exactly the same as
150 `\fBtcp dst port\fP ftp \fBor tcp dst port\fP ftp-data \fBor tcp dst port\fP domain'.
151 .LP
152 Allowable primitives are:
153 .IP "\fBdst host \fIhostnameaddr\fR"
154 True if the IPv4/v6 destination field of the packet is \fIhostnameaddr\fP,
155 which may be either an address or a name.
156 .IP "\fBsrc host \fIhostnameaddr\fR"
157 True if the IPv4/v6 source field of the packet is \fIhostnameaddr\fP.
158 .IP "\fBhost \fIhostnameaddr\fP"
159 True if either the IPv4/v6 source or destination of the packet is \fIhostnameaddr\fP.
160 .IP
161 Any of the above host expressions can be prepended with the keywords,
162 \fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
163 .in +.5i
164 .nf
165 \fBip host \fIhostnameaddr\fR
166 .fi
167 .in -.5i
168 which is equivalent to:
169 .in +.5i
170 .nf
171 \fBether proto \\\fRip \fBand host \fIhostnameaddr\fR
172 .fi
173 .in -.5i
174 If \fIhostnameaddr\fR is a name with multiple IPv4/v6 addresses, each address will
175 be checked for a match.
176 .IP "\fBether dst \fIethernameaddr\fP"
177 True if the Ethernet destination address is \fIethernameaddr\fP.
178 \fIethernameaddr\fP
179 may be either a name from /etc/ethers or a numerical MAC address of the
180 form "xx:xx:xx:xx:xx:xx", "xx.xx.xx.xx.xx.xx", "xx-xx-xx-xx-xx-xx",
181 "xxxx.xxxx.xxxx", "xxxxxxxxxxxx", or various mixes of ':', '.', and '-',
182 where each "x" is a hex digit (0-9, a-f, or A-F).
183 .IP "\fBether src \fIethernameaddr\fP"
184 True if the Ethernet source address is \fIethernameaddr\fP.
185 .IP "\fBether host \fIethernameaddr\fP"
186 True if either the Ethernet source or destination address is \fIethernameaddr\fP.
187 .IP "\fBgateway\fP \fIhost\fP"
188 True if the packet used \fIhost\fP as a gateway.
189 I.e., the Ethernet
190 source or destination address was \fIhost\fP but neither the IP source
191 nor the IP destination was \fIhost\fP.
192 \fIHost\fP must be a name and
193 must be found both by the machine's host-name-to-IP-address resolution
194 mechanisms (host name file, DNS, NIS, etc.) and by the machine's
195 host-name-to-Ethernet-address resolution mechanism (/etc/ethers, etc.).
196 (An equivalent expression is
197 .in +.5i
198 .nf
199 \fBether host \fIethernameaddr \fBand not host \fIhostnameaddr\fR
200 .fi
201 .in -.5i
202 which can be used with either names or numbers for \fIhostnameaddr / ethernameaddr\fP.)
203 This syntax does not work in IPv6-enabled configuration at this moment.
204 .IP "\fBdst net \fInetnameaddr\fR"
205 True if the IPv4/v6 destination address of the packet has a network
206 number of \fInetnameaddr\fP.
207 \fINet\fP may be either a name from the networks database
208 (/etc/networks, etc.) or a network number.
209 An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0),
210 dotted triple (e.g., 192.168.1), dotted pair (e.g, 172.16), or single
211 number (e.g., 10); the netmask is 255.255.255.255 for a dotted quad
212 (which means that it's really a host match), 255.255.255.0 for a dotted
213 triple, 255.255.0.0 for a dotted pair, or 255.0.0.0 for a single number.
214 An IPv6 network number must be written out fully; the netmask is
215 ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always
216 host matches, and a network match requires a netmask length.
217 .IP "\fBsrc net \fInetnameaddr\fR"
218 True if the IPv4/v6 source address of the packet has a network
219 number of \fInetnameaddr\fP.
220 .IP "\fBnet \fInetnameaddr\fR"
221 True if either the IPv4/v6 source or destination address of the packet has a network
222 number of \fInetnameaddr\fP.
223 .IP "\fBnet \fInetaddr\fR \fBmask \fInetmask\fR"
224 True if the IPv4 address matches \fInetaddr\fR with the specific \fInetmask\fR.
225 May be qualified with \fBsrc\fR or \fBdst\fR.
226 Note that this syntax is not valid for IPv6 \fInetaddr\fR.
227 .IP "\fBnet \fInetaddr\fR/\fIlen\fR"
228 True if the IPv4/v6 address matches \fInetaddr\fR with a netmask \fIlen\fR
229 bits wide.
230 May be qualified with \fBsrc\fR or \fBdst\fR.
231 .IP "\fBdst port \fIportnamenum\fR"
232 True if the packet is IPv4/v6 TCP, UDP or SCTP and has a
233 destination port value of \fIportnamenum\fP.
234 The \fIportnamenum\fP can be a number or a name used in /etc/services (see
235 .BR tcp (4P)
236 and
237 .BR udp (4P)).
238 If a name is used, both the port
239 number and protocol are checked.
240 If a number or ambiguous name is used,
241 only the port number is checked (e.g., `\fBdst port\fR 513' will print both
242 tcp/login traffic and udp/who traffic, and `\fBport\fR domain' will print
243 both tcp/domain and udp/domain traffic).
244 .IP "\fBsrc port \fIportnamenum\fR"
245 True if the packet has a source port value of \fIportnamenum\fP.
246 .IP "\fBport \fIportnamenum\fR"
247 True if either the source or destination port of the packet is \fIportnamenum\fP.
248 .IP "\fBdst portrange \fIportnamenum1-portnamenum2\fR"
249 True if the packet is IPv4/v6 TCP, UDP or SCTP and has a
250 destination port value between \fIportnamenum1\fP and \fIportnamenum2\fP (both inclusive).
251 .I portnamenum1
252 and
253 .I portnamenum2
254 are interpreted in the same fashion as the
255 .I portnamenum
256 parameter for
257 .BR port .
258 .IP "\fBsrc portrange \fIportnamenum1-portnamenum2\fR"
259 True if the packet has a source port value between \fIportnamenum1\fP and
260 \fIportnamenum2\fP (both inclusive).
261 .IP "\fBportrange \fIportnamenum1-portnamenum2\fR"
262 True if either the source or destination port of the packet is between
263 \fIportnamenum1\fP and \fIportnamenum2\fP (both inclusive).
264 .IP
265 Any of the above port or port range expressions can be prepended with
266 the keywords, \fBtcp\fP, \fBudp\fP or \fBsctp\fP, as in:
267 .in +.5i
268 .nf
269 \fBtcp src port \fIportnamenum\fR
270 .fi
271 .in -.5i
272 which matches only TCP packets whose source port is \fIportnamenum\fP.
273 .IP "\fBless \fIlength\fR"
274 True if the packet has a length less than or equal to \fIlength\fP.
275 This is equivalent to:
276 .in +.5i
277 .nf
278 \fBlen <= \fIlength\fP
279 .fi
280 .in -.5i
281 .IP "\fBgreater \fIlength\fR"
282 True if the packet has a length greater than or equal to \fIlength\fP.
283 This is equivalent to:
284 .in +.5i
285 .nf
286 \fBlen >= \fIlength\fP
287 .fi
288 .in -.5i
289 .IP "\fBip proto \fIprotocol\fR"
290 True if the packet is an IPv4 packet (see
291 .BR ip (4P))
292 of protocol type \fIprotocol\fP.
293 \fIProtocol\fP can be a number or one of the names recognized by
294 .BR getprotobyname (3)
295 (as in e.g. `\fBgetent\fR(1) protocols'), typically from an entry in
296 .IR \%/etc/protocols ,
297 for example:
298 .BR ah ,
299 .BR esp ,
300 .B eigrp
301 (only in Linux, FreeBSD, NetBSD, DragonFly BSD, and macOS),
302 .BR icmp ,
303 .BR igmp ,
304 .B igrp
305 (only in OpenBSD),
306 .BR pim ,
307 .BR sctp ,
308 .BR tcp ,
309 .B udp
310 or
311 .BR vrrp .
312 Note that most of these example identifiers
313 are also keywords and must be escaped via backslash (\\).
314 Note that this primitive does not chase the protocol header chain.
315 .IP "\fBicmp\fR"
316 Abbreviation for:
317 .in +.5i
318 .nf
319 \fBip proto\fR 1
320 .fi
321 .in -.5i
322 .IP "\fBip6 proto \fIprotocol\fR"
323 True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.
324 (See `\fBip proto\fP' above for the meaning of \fIprotocol\fR.)
325 Note that the IPv6 variant of ICMP uses a different protocol number, named
326 .B \%ipv6-icmp
327 in AIX, FreeBSD, illumos, Linux, macOS, NetBSD, OpenBSD, Solaris and Windows.
328 Note that this primitive does not chase the protocol header chain.
329 .IP "\fBicmp6\fR"
330 Abbreviation for:
331 .in +.5i
332 .nf
333 \fBip6 proto\fR 58
334 .fi
335 .in -.5i
336 .IP "\fBproto \fIprotocol\fR"
337 True if the packet is an IPv4 or IPv6 packet of protocol type
338 \fIprotocol\fP.  (See `\fBip proto\fP' above for the meaning of
339 \fIprotocol\fP.)  Note that this primitive does not chase the protocol
340 header chain.
341 .IP  "\fBah\fR, \fBesp\fR, \fBpim\fR, \fBsctp\fR, \fBtcp\fR, \fBudp\fR"
342 Abbreviations for:
343 .in +.5i
344 .nf
345 \fBproto \\\fIprotocol\fR
346 .fi
347 .in -.5i
348 where \fIprotocol\fR is one of the above protocols.
349 .IP "\fBip6 protochain \fIprotocol\fR"
350 True if the packet is IPv6 packet,
351 and contains protocol header with type \fIprotocol\fR
352 in its protocol header chain.
353 (See `\fBip proto\fP' above for the meaning of \fIprotocol\fP.)
354 For example,
355 .in +.5i
356 .nf
357 \fBip6 protochain\fR 6
358 .fi
359 .in -.5i
360 matches any IPv6 packet with TCP protocol header in the protocol header chain.
361 The packet may contain, for example,
362 authentication header, routing header, or hop-by-hop option header,
363 between IPv6 header and TCP header.
364 The BPF code emitted by this primitive is complex and
365 cannot be optimized by the BPF optimizer code, and is not supported by
366 filter engines in the kernel, so this can be somewhat slow, and may
367 cause more packets to be dropped.
368 .IP "\fBip protochain \fIprotocol\fR"
369 Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
370 (See `\fBip proto\fP' above for the meaning of \fIprotocol\fP.)
371 .IP "\fBprotochain \fIprotocol\fR"
372 True if the packet is an IPv4 or IPv6 packet of protocol type
373 \fIprotocol\fP.  (See `\fBip proto\fP' above for the meaning of
374 \fIprotocol\fP.)  Note that this primitive chases the protocol
375 header chain.
376 .IP "\fBether broadcast\fR"
377 True if the packet is an Ethernet broadcast packet.
378 The \fBether\fP
379 keyword is optional.
380 .IP "\fBip broadcast\fR"
381 True if the packet is an IPv4 broadcast packet.
382 It checks for both the all-zeroes and all-ones broadcast conventions,
383 and looks up the subnet mask on the interface on which the capture is
384 being done.
385 .IP
386 If the subnet mask of the interface on which the capture is being done
387 is not available, either because the interface on which capture is being
388 done has no netmask or because the capture is being done on the Linux
389 "any" interface, which can capture on more than one interface, this
390 check will not work correctly.
391 .IP "\fBether multicast\fR"
392 True if the packet is an Ethernet multicast packet.
393 The \fBether\fP
394 keyword is optional.
395 This is shorthand for `\fBether[\fP0\fB] & \fP1\fB != \fP0'.
396 .IP "\fBip multicast\fR"
397 True if the packet is an IPv4 multicast packet.
398 .IP "\fBip6 multicast\fR"
399 True if the packet is an IPv6 multicast packet.
400 .IP  "\fBether proto \fIprotocol\fR"
401 True if the packet is of ether type \fIprotocol\fR.
402 \fIProtocol\fP can be a number or one of the names
403 \fBaarp\fP, \fBarp\fP, \fBatalk\fP, \fBdecnet\fP, \fBip\fP, \fBip6\fP,
404 \fBipx\fP, \fBiso\fP, \fBlat\fP, \fBloopback\fP, \fBmopdl\fP, \fBmoprc\fP, \fBnetbeui\fP,
405 \fBrarp\fP, \fBsca\fP or \fBstp\fP.
406 Note these identifiers (except \fBloopback\fP) are also keywords
407 and must be escaped via backslash (\\).
408 .IP
409 [In the case of FDDI (e.g., `\fBfddi proto \\arp\fR'), Token Ring
410 (e.g., `\fBtr proto \\arp\fR'), and IEEE 802.11 wireless LANs (e.g.,
411 `\fBwlan proto \\arp\fR'), for most of those protocols, the
412 protocol identification comes from the 802.2 Logical Link Control (LLC)
413 header, which is usually layered on top of the FDDI, Token Ring, or
414 802.11 header.
415 .IP
416 When filtering for most protocol identifiers on FDDI, Token Ring, or
417 802.11, the filter checks only the protocol ID field of an LLC header
418 in so-called SNAP format with an Organizational Unit Identifier (OUI) of
419 0x000000, for encapsulated Ethernet; it doesn't check whether the packet
420 is in SNAP format with an OUI of 0x000000.
421 The exceptions are:
422 .RS
423 .TP
424 \fBiso\fP
425 the filter checks the DSAP (Destination Service Access Point) and
426 SSAP (Source Service Access Point) fields of the LLC header;
427 .TP
428 \fBstp\fP and \fBnetbeui\fP
429 the filter checks the DSAP of the LLC header;
430 .TP
431 \fBatalk\fP
432 the filter checks for a SNAP-format packet with an OUI of 0x080007
433 and the AppleTalk etype.
434 .RE
435 .IP
436 In the case of Ethernet, the filter checks the Ethernet type field
437 for most of those protocols.  The exceptions are:
438 .RS
439 .TP
440 \fBiso\fP, \fBstp\fP, and \fBnetbeui\fP
441 the filter checks for an 802.3 frame and then checks the LLC header as
442 it does for FDDI, Token Ring, and 802.11;
443 .TP
444 \fBatalk\fP
445 the filter checks both for the AppleTalk etype in an Ethernet frame and
446 for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11;
447 .TP
448 \fBaarp\fP
449 the filter checks for the AppleTalk ARP etype in either an Ethernet
450 frame or an 802.2 SNAP frame with an OUI of 0x000000;
451 .TP
452 \fBipx\fP
453 the filter checks for the IPX etype in an Ethernet frame, the IPX
454 DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of
455 IPX, and the IPX etype in a SNAP frame.
456 .RE
457 .IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fBnetbeui\fP"
458 Abbreviations for:
459 .in +.5i
460 .nf
461 \fBether proto \\\fIprotocol\fR
462 .fi
463 .in -.5i
464 where \fIprotocol\fR is one of the above protocols.
465 .IP "\fBlat\fR, \fBmoprc\fR, \fBmopdl\fR"
466 Abbreviations for:
467 .in +.5i
468 .nf
469 \fBether proto \\\fIprotocol\fR
470 .fi
471 .in -.5i
472 where \fIprotocol\fR is one of the above protocols.
473 Note that not all applications using
474 .BR pcap (3PCAP)
475 currently know how to parse these protocols.
476 .IP "\fBdecnet src \fIdecnetaddr\fR"
477 True if the DECnet source address is
478 .IR decnetaddr ,
479 which may be an address of the form ``10.123'', or a DECnet host
480 name.
481 [DECnet host name support is only available on ULTRIX systems
482 that are configured to run DECnet.]
483 .IP "\fBdecnet dst \fIdecnetaddr\fR"
484 True if the DECnet destination address is
485 .IR decnetaddr .
486 .IP "\fBdecnet host \fIdecnetaddr\fR"
487 True if either the DECnet source or destination address is
488 .IR decnetaddr .
489 .IP \fBllc\fP
490 True if the packet has an 802.2 LLC header.  This includes:
491 .IP
492 Ethernet packets with a length field rather than a type field that
493 aren't raw NetWare-over-802.3 packets;
494 .IP
495 IEEE 802.11 data packets;
496 .IP
497 Token Ring packets (no check is done for LLC frames);
498 .IP
499 FDDI packets (no check is done for LLC frames);
500 .IP
501 LLC-encapsulated ATM packets, for SunATM on Solaris.
502 .IP "\fBllc\fP \fItype\fR"
503 True if the packet has an 802.2 LLC header and has the specified
504 .IR type .
505 .I type
506 can be one of:
507 .RS
508 .TP
509 \fBi\fR
510 Information (I) PDUs
511 .TP
512 \fBs\fR
513 Supervisory (S) PDUs
514 .TP
515 \fBu\fR
516 Unnumbered (U) PDUs
517 .TP
518 \fBrr\fR
519 Receiver Ready (RR) S PDUs
520 .TP
521 \fBrnr\fR
522 Receiver Not Ready (RNR) S PDUs
523 .TP
524 \fBrej\fR
525 Reject (REJ) S PDUs
526 .TP
527 \fBui\fR
528 Unnumbered Information (UI) U PDUs
529 .TP
530 \fBua\fR
531 Unnumbered Acknowledgment (UA) U PDUs
532 .TP
533 \fBdisc\fR
534 Disconnect (DISC) U PDUs
535 .TP
536 \fBsabme\fR
537 Set Asynchronous Balanced Mode Extended (SABME) U PDUs
538 .TP
539 \fBtest\fR
540 Test (TEST) U PDUs
541 .TP
542 \fBxid\fR
543 Exchange Identification (XID) U PDUs
544 .TP
545 \fBfrmr\fR
546 Frame Reject (FRMR) U PDUs
547 .RE
548 .IP \fBinbound\fP
549 Packet was received by the host performing the capture rather than being
550 sent by that host.  This is only supported for certain link-layer types,
551 such as SLIP and the ``cooked'' Linux capture mode
552 used for the ``any'' device and for some other device types.
553 .IP \fBoutbound\fP
554 Packet was sent by the host performing the capture rather than being
555 received by that host.  This is only supported for certain link-layer types,
556 such as SLIP and the ``cooked'' Linux capture mode
557 used for the ``any'' device and for some other device types.
558 .IP "\fBifname \fIinterface\fR"
559 True if the packet was logged as coming from the specified interface (applies
560 only to packets logged by OpenBSD's or FreeBSD's
561 .BR pf (4)).
562 .IP "\fBon \fIinterface\fR"
563 Synonymous with the
564 .B ifname
565 modifier.
566 .IP "\fBrnr \fInum\fR"
567 True if the packet was logged as matching the specified PF rule number
568 (applies only to packets logged by OpenBSD's or FreeBSD's
569 .BR pf (4)).
570 .IP "\fBrulenum \fInum\fR"
571 Synonymous with the
572 .B rnr
573 modifier.
574 .IP "\fBreason \fIcode\fR"
575 True if the packet was logged with the specified PF reason code.  The known
576 codes are:
577 .BR \%match ,
578 .BR \%bad-offset ,
579 .BR \%fragment ,
580 .BR \%short ,
581 .BR \%normalize ,
582 and
583 .B memory
584 (applies only to packets logged by OpenBSD's or FreeBSD's
585 .BR pf (4)).
586 .IP "\fBrset \fIname\fR"
587 True if the packet was logged as matching the specified PF ruleset
588 name of an anchored ruleset (applies only to packets logged by OpenBSD's
589 or FreeBSD's
590 .BR pf (4)).
591 .IP "\fBruleset \fIname\fR"
592 Synonymous with the
593 .B rset
594 modifier.
595 .IP "\fBsrnr \fInum\fR"
596 True if the packet was logged as matching the specified PF rule number
597 of an anchored ruleset (applies only to packets logged by OpenBSD's or
598 FreeBSD's
599 .BR pf (4)).
600 .IP "\fBsubrulenum \fInum\fR"
601 Synonymous with the
602 .B srnr
603 modifier.
604 .IP "\fBaction \fIact\fR"
605 True if PF took the specified action when the packet was logged.  Known actions
606 are:
607 .B pass
608 and
609 .B block
610 and, with later versions of
611 .BR pf (4),
612 .BR nat ,
613 .BR rdr ,
614 .B binat
615 and
616 .B scrub
617 (applies only to packets logged by OpenBSD's or FreeBSD's
618 .BR pf (4)).
619 .IP "\fBwlan ra \fIehost\fR"
620 True if the IEEE 802.11 RA is
621 .IR ehost .
622 The RA field is used in all frames except for management frames.
623 .IP "\fBwlan ta \fIehost\fR"
624 True if the IEEE 802.11 TA is
625 .IR ehost .
626 The TA field is used in all frames except for management frames and
627 CTS (Clear To Send) and ACK (Acknowledgment) control frames.
628 .IP "\fBwlan addr1 \fIehost\fR"
629 True if the first IEEE 802.11 address is
630 .IR ehost .
631 .IP "\fBwlan addr2 \fIehost\fR"
632 True if the second IEEE 802.11 address, if present, is
633 .IR ehost .
634 The second address field is used in all frames except for CTS (Clear To
635 Send) and ACK (Acknowledgment) control frames.
636 .IP "\fBwlan addr3 \fIehost\fR"
637 True if the third IEEE 802.11 address, if present, is
638 .IR ehost .
639 The third address field is used in management and data frames, but not
640 in control frames.
641 .IP "\fBwlan addr4 \fIehost\fR"
642 True if the fourth IEEE 802.11 address, if present, is
643 .IR ehost .
644 The fourth address field is only used for
645 WDS (Wireless Distribution System) frames.
646 .IP "\fBtype \fIwlan_type\fR"
647 True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR.
648 Valid \fIwlan_type\fRs are:
649 \fBmgt\fP,
650 \fBctl\fP
651 and \fBdata\fP.
652 .IP "\fBtype \fIwlan_type \fBsubtype \fIwlan_subtype\fR"
653 True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR
654 and frame subtype matches the specified \fIwlan_subtype\fR.
655 .IP
656 If the specified \fIwlan_type\fR is \fBmgt\fP,
657 then valid \fIwlan_subtype\fRs are:
658 \fBassoc-req\fP,
659 \fBassoc-resp\fP,
660 \fBreassoc-req\fP,
661 \fBreassoc-resp\fP,
662 \fBprobe-req\fP,
663 \fBprobe-resp\fP,
664 \fBbeacon\fP,
665 \fBatim\fP,
666 \fBdisassoc\fP,
667 \fBauth\fP and
668 \fBdeauth\fP.
669 .IP
670 If the specified \fIwlan_type\fR is \fBctl\fP,
671 then valid \fIwlan_subtype\fRs are:
672 \fBps-poll\fP,
673 \fBrts\fP,
674 \fBcts\fP,
675 \fBack\fP,
676 \fBcf-end\fP and
677 \fBcf-end-ack\fP.
678 .IP
679 If the specified \fIwlan_type\fR is \fBdata\fP,
680 then valid \fIwlan_subtype\fRs are:
681 .BR \%data ,
682 .BR \%data-cf-ack ,
683 .BR \%data-cf-poll ,
684 .BR \%data-cf-ack-poll ,
685 .BR \%null ,
686 .BR \%cf-ack ,
687 .BR \%cf-poll ,
688 .BR \%cf-ack-poll ,
689 .BR \%qos-data ,
690 .BR \%qos-data-cf-ack ,
691 .BR \%qos-data-cf-poll ,
692 .BR \%qos-data-cf-ack-poll ,
693 .BR \%qos ,
694 .B \%qos-cf-poll
695 and
696 .BR \%qos-cf-ack-poll .
697 .IP "\fBsubtype \fIwlan_subtype\fR"
698 True if the IEEE 802.11 frame subtype matches the specified \fIwlan_subtype\fR
699 and frame has the type to which the specified \fIwlan_subtype\fR belongs.
700 .IP "\fBdir \fIdirection\fR"
701 True if the IEEE 802.11 frame direction matches the specified
702 .IR direction .
703 Valid directions are:
704 .BR nods ,
705 .BR tods ,
706 .BR fromds ,
707 .BR dstods ,
708 or a numeric value.
709 .IP "\fBvlan \fI[vlan_id]\fR"
710 True if the packet is an IEEE 802.1Q VLAN packet.
711 If the optional \fIvlan_id\fR is specified, only true if the packet has the specified
712 \fIvlan_id\fR.
713 Note that the first \fBvlan\fR keyword encountered in an expression
714 changes the decoding offsets for the remainder of the expression on
715 the assumption that the packet is a VLAN packet.  The `\fBvlan
716 \fI[vlan_id]\fR` keyword may be used more than once, to filter on VLAN
717 hierarchies.  Each use of that keyword increments the filter offsets
718 by 4.
719 .IP
720 For example:
721 .in +.5i
722 .nf
723 \fBvlan\fP 100 \fB&& vlan\fR 200
724 .fi
725 .in -.5i
726 filters on VLAN 200 encapsulated within VLAN 100, and
727 .in +.5i
728 .nf
729 \fBvlan && vlan \fP300 \fB&& ip\fR
730 .fi
731 .in -.5i
732 filters IPv4 protocol encapsulated in VLAN 300 encapsulated within any
733 higher order VLAN.
734 .IP "\fBmpls \fI[label_num]\fR"
735 True if the packet is an MPLS packet.
736 If the optional \fIlabel_num\fR is specified, only true if the packet has the specified
737 \fIlabel_num\fR.
738 Note that the first \fBmpls\fR keyword encountered in an expression
739 changes the decoding offsets for the remainder of the expression on
740 the assumption that the packet is a MPLS-encapsulated IP packet.  The
741 `\fBmpls \fI[label_num]\fR` keyword may be used more than once, to
742 filter on MPLS hierarchies.  Each use of that keyword increments the
743 filter offsets by 4.
744 .IP
745 For example:
746 .in +.5i
747 .nf
748 \fBmpls\fP 100000 \fB&& mpls\fR 1024
749 .fi
750 .in -.5i
751 filters packets with an outer label of 100000 and an inner label of
752 1024, and
753 .in +.5i
754 .nf
755 \fBmpls && mpls\fP 1024 \fB&& host\fR 192.9.200.1
756 .fi
757 .in -.5i
758 filters packets to or from 192.9.200.1 with an inner label of 1024 and
759 any outer label.
760 .IP \fBpppoed\fP
761 True if the packet is a PPP-over-Ethernet Discovery packet (Ethernet
762 type 0x8863).
763 .IP "\fBpppoes \fI[session_id]\fR"
764 True if the packet is a PPP-over-Ethernet Session packet (Ethernet
765 type 0x8864).
766 If the optional \fIsession_id\fR is specified, only true if the packet has the specified
767 \fIsession_id\fR.
768 Note that the first \fBpppoes\fR keyword encountered in an expression
769 changes the decoding offsets for the remainder of the expression on
770 the assumption that the packet is a PPPoE session packet.
771 .IP
772 For example:
773 .in +.5i
774 .nf
775 \fBpppoes\fP 0x27 \fB&& ip\fR
776 .fi
777 .in -.5i
778 filters IPv4 protocol encapsulated in PPPoE session id 0x27.
779 .IP "\fBgeneve \fI[vni]\fR"
780 True if the packet is a Geneve packet (UDP port 6081). If the optional \fIvni\fR
781 is specified, only true if the packet has the specified \fIvni\fR.
782 Note that when the \fBgeneve\fR keyword is encountered in
783 an expression, it changes the decoding offsets for the remainder of
784 the expression on the assumption that the packet is a Geneve packet.
785 .IP
786 For example:
787 .in +.5i
788 .nf
789 \fBgeneve\fP 0xb \fB&& ip\fR
790 .fi
791 .in -.5i
792 filters IPv4 protocol encapsulated in Geneve with VNI 0xb. This will
793 match both IPv4 directly encapsulated in Geneve as well as IPv4 contained
794 inside an Ethernet frame.
795 .IP "\fBiso proto \fIprotocol\fR"
796 True if the packet is an OSI packet of protocol type \fIprotocol\fP.
797 \fIProtocol\fP can be a number or one of the names
798 \fBclnp\fP, \fBesis\fP, or \fBisis\fP.
799 .IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"
800 Abbreviations for:
801 .in +.5i
802 .nf
803 \fBiso proto \\\fIprotocol\fR
804 .fi
805 .in -.5i
806 where \fIprotocol\fR is one of the above protocols.
807 .IP "\fBl1\fR, \fBl2\fR, \fBiih\fR, \fBlsp\fR, \fBsnp\fR, \fBcsnp\fR, \fBpsnp\fR"
808 Abbreviations for IS-IS PDU types.
809 .IP "\fBvpi\fP \fIn\fR"
810 True if the packet is an ATM packet, for SunATM on Solaris, with a
811 virtual path identifier of
812 .IR n .
813 .IP "\fBvci\fP \fIn\fR"
814 True if the packet is an ATM packet, for SunATM on Solaris, with a
815 virtual channel identifier of
816 .IR n .
817 .IP \fBlane\fP
818 True if the packet is an ATM packet, for SunATM on Solaris, and is
819 an ATM LANE packet.
820 Note that the first \fBlane\fR keyword encountered in an expression
821 changes the tests done in the remainder of the expression
822 on the assumption that the packet is either a LANE emulated Ethernet
823 packet or a LANE LE Control packet.  If \fBlane\fR isn't specified, the
824 tests are done under the assumption that the packet is an
825 LLC-encapsulated packet.
826 .IP \fBoamf4s\fP
827 True if the packet is an ATM packet, for SunATM on Solaris, and is
828 a segment OAM F4 flow cell (VPI=0 & VCI=3).
829 .IP \fBoamf4e\fP
830 True if the packet is an ATM packet, for SunATM on Solaris, and is
831 an end-to-end OAM F4 flow cell (VPI=0 & VCI=4).
832 .IP \fBoamf4\fP
833 True if the packet is an ATM packet, for SunATM on Solaris, and is
834 a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
835 .IP \fBoam\fP
836 True if the packet is an ATM packet, for SunATM on Solaris, and is
837 a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
838 .IP \fBmetac\fP
839 True if the packet is an ATM packet, for SunATM on Solaris, and is
840 on a meta signaling circuit (VPI=0 & VCI=1).
841 .IP \fBbcc\fP
842 True if the packet is an ATM packet, for SunATM on Solaris, and is
843 on a broadcast signaling circuit (VPI=0 & VCI=2).
844 .IP \fBsc\fP
845 True if the packet is an ATM packet, for SunATM on Solaris, and is
846 on a signaling circuit (VPI=0 & VCI=5).
847 .IP \fBilmic\fP
848 True if the packet is an ATM packet, for SunATM on Solaris, and is
849 on an ILMI circuit (VPI=0 & VCI=16).
850 .IP \fBconnectmsg\fP
851 True if the packet is an ATM packet, for SunATM on Solaris, and is
852 on a signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
853 Connect Ack, Release, or Release Done message.
854 .IP \fBmetaconnect\fP
855 True if the packet is an ATM packet, for SunATM on Solaris, and is
856 on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
857 Release, or Release Done message.
858 .IP  "\fIexpr1 relop expr2\fR"
859 True if the relation holds.  \fIRelop\fR is one of
860 .RB { > ,
861 .BR < ,
862 .BR >= ,
863 .BR <= ,
864 .BR = ,
865 .BR == ,
866 .BR != }
867 (where
868 .B =
869 means the same as
870 .BR == ).
871 Each of \fIexpr1\fR and \fIexpr2\fR is an arithmetic expression composed of
872 integer constants (expressed in standard C syntax), the normal binary operators
873 .RB { + ,
874 .BR - ,
875 .BR * ,
876 .BR / ,
877 .BR % ,
878 .BR & ,
879 .BR | ,
880 .BR ^ ,
881 .BR << ,
882 .BR >> },
883 a length operator, and special packet data
884 accessors.  Note that all comparisons are unsigned, so that, for example,
885 0x80000000 and 0xffffffff are > 0.
886 .IP
887 The
888 .B %
889 and
890 .B ^
891 operators are currently only supported for filtering in the kernel on
892 particular operating systems (for example: FreeBSD, Linux with 3.7 and later
893 kernels, NetBSD); on all other systems (for example: AIX, illumos, Solaris,
894 OpenBSD), if
895 those operators are used, filtering will be done in user mode, which
896 will increase the overhead of capturing packets and may cause more
897 packets to be dropped.
898 .IP
899 The length operator, indicated by the keyword \fBlen\fP, gives the
900 length of the packet.
901 .IP
902 To access data inside the packet, use the following syntax:
903 .in +.5i
904 .nf
905 \fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
906 .fi
907 .in -.5i
908 .I Proto
909 is one of
910 .BR arp ,
911 .BR atalk ,
912 .BR carp ,
913 .BR decnet ,
914 .BR ether ,
915 .BR fddi ,
916 .BR icmp ,
917 .BR icmp6 ,
918 .BR igmp ,
919 .BR igrp ,
920 .BR ip ,
921 .BR ip6 ,
922 .BR lat ,
923 .BR link ,
924 .BR mopdl ,
925 .BR moprc ,
926 .BR pim ,
927 .BR ppp ,
928 .BR radio ,
929 .BR rarp ,
930 .BR sca ,
931 .BR sctp ,
932 .BR slip ,
933 .BR tcp ,
934 .BR tr ,
935 .BR udp ,
936 .B vrrp
937 or
938 .BR wlan ,
939 and
940 indicates the protocol layer for the index operation.
941 .RB ( ether ,
942 .BR fddi ,
943 .BR link ,
944 .BR ppp ,
945 .BR slip ,
946 .B tr
947 and
948 .BR wlan
949 all refer to the
950 link layer. \fBradio\fR refers to the "radio header" added to some
951 802.11 captures.)
952 Note that \fBtcp\fR, \fBudp\fR and other upper-layer protocol types only
953 apply to IPv4, not IPv6 (this will be fixed in the future).
954 The byte offset, relative to the indicated protocol layer, is
955 given by \fIexpr\fR.
956 \fISize\fR is optional and indicates the number of bytes in the
957 field of interest; it can be either one, two, or four, and defaults to one.
958
959 For example, `\fBether[\fP0\fB] &\fP 1 \fB!=\fP 0' catches all multicast traffic.
960 The expression `\fBip[\fP0\fB] &\fP 0xf \fB!=\fP 5'
961 catches all IPv4 packets with options.
962 The expression
963 `\fBip[\fP6:2\fB] &\fP 0x1fff \fB=\fP 0'
964 catches only unfragmented IPv4 datagrams and frag zero of fragmented
965 IPv4 datagrams.
966 This check is implicitly applied to the \fBtcp\fP and \fBudp\fP
967 index operations.
968 For instance, \fBtcp[\fP0\fB]\fP always means the first
969 byte of the TCP \fIheader\fP, and never means the first byte of an
970 intervening fragment.
971 .IP
972 Some offsets and field values may be expressed as names rather than
973 as numeric values.
974 The following protocol header field offsets are
975 available: \fBicmptype\fP (ICMP type field), \fBicmp6type\fP (ICMPv6 type field),
976 \fBicmpcode\fP (ICMP code field), \fBicmp6code\fP (ICMPv6 code field) and
977 \fBtcpflags\fP (TCP flags field).
978 .IP
979 The following ICMP type field values are available:
980 .BR \%icmp-echoreply ,
981 .BR \%icmp-unreach ,
982 .BR \%icmp-sourcequench ,
983 .BR \%icmp-redirect ,
984 .BR \%icmp-echo ,
985 .BR \%icmp-routeradvert ,
986 .BR \%icmp-routersolicit ,
987 .BR \%icmp-timxceed ,
988 .BR \%icmp-paramprob ,
989 .BR \%icmp-tstamp ,
990 .BR \%icmp-tstampreply ,
991 .BR \%icmp-ireq ,
992 .BR \%icmp-ireqreply ,
993 .BR \%icmp-maskreq ,
994 .BR \%icmp-maskreply .
995 .IP
996 The following ICMPv6 type field values are available:
997 .BR \%icmp6-destinationunreach ,
998 .BR \%icmp6-packettoobig ,
999 .BR \%icmp6-timeexceeded ,
1000 .BR \%icmp6-parameterproblem ,
1001 .BR \%icmp6-echo ,
1002 .BR \%icmp6-echoreply ,
1003 .BR \%icmp6-multicastlistenerquery ,
1004 .BR \%icmp6-multicastlistenerreportv1 ,
1005 .BR \%icmp6-multicastlistenerdone ,
1006 .BR \%icmp6-routersolicit ,
1007 .BR \%icmp6-routeradvert ,
1008 .BR \%icmp6-neighborsolicit ,
1009 .BR \%icmp6-neighboradvert ,
1010 .BR \%icmp6-redirect ,
1011 .BR \%icmp6-routerrenum ,
1012 .BR \%icmp6-nodeinformationquery ,
1013 .BR \%icmp6-nodeinformationresponse ,
1014 .BR \%icmp6-ineighbordiscoverysolicit ,
1015 .BR \%icmp6-ineighbordiscoveryadvert ,
1016 .BR \%icmp6-multicastlistenerreportv2 ,
1017 .BR \%icmp6-homeagentdiscoveryrequest ,
1018 .BR \%icmp6-homeagentdiscoveryreply ,
1019 .BR \%icmp6-mobileprefixsolicit ,
1020 .BR \%icmp6-mobileprefixadvert ,
1021 .BR \%icmp6-certpathsolicit ,
1022 .BR \%icmp6-certpathadvert ,
1023 .BR \%icmp6-multicastrouteradvert ,
1024 .BR \%icmp6-multicastroutersolicit ,
1025 .BR \%icmp6-multicastrouterterm .
1026 .IP
1027 The following TCP flags field values are available: \fBtcp-fin\fP,
1028 \fBtcp-syn\fP, \fBtcp-rst\fP, \fBtcp-push\fP,
1029 \fBtcp-ack\fP, \fBtcp-urg\fP, \fBtcp-ece\fP,
1030 \fBtcp-cwr\fP.
1031 .LP
1032 Primitives may be combined using:
1033 .IP
1034 A parenthesized group of primitives and operators.
1035 .IP
1036 Negation (`\fB!\fP' or `\fBnot\fP').
1037 .IP
1038 Concatenation (`\fB&&\fP' or `\fBand\fP').
1039 .IP
1040 Alternation (`\fB||\fP' or `\fBor\fP').
1041 .LP
1042 Negation has the highest precedence.
1043 Alternation and concatenation have equal precedence and associate
1044 left to right.
1045 Note that explicit \fBand\fR tokens, not juxtaposition,
1046 are now required for concatenation.
1047 .LP
1048 If an identifier is given without a keyword, the most recent keyword
1049 is assumed.
1050 For example,
1051 .in +.5i
1052 .nf
1053 \fBnot host\fP vs \fBand\fR ace
1054 .fi
1055 .in -.5i
1056 is short for
1057 .in +.5i
1058 .nf
1059 \fBnot host\fP vs \fBand host\fR ace
1060 .fi
1061 .in -.5i
1062 which should not be confused with
1063 .in +.5i
1064 .nf
1065 \fBnot (host \fPvs\fB or \fPace\fB)\fR
1066 .fi
1067 .in -.5i
1068 .SH EXAMPLES
1069 .LP
1070 To select all packets arriving at or departing from `sundown':
1071 .RS
1072 .nf
1073 \fBhost\fP sundown
1074 .fi
1075 .RE
1076 .LP
1077 To select traffic between `helios' and either `hot' or `ace':
1078 .RS
1079 .nf
1080 \fBhost\fP helios \fBand (\fPhot \fBor\fP ace\fB)\fP
1081 .fi
1082 .RE
1083 .LP
1084 To select all IPv4 packets between `ace' and any host except `helios':
1085 .RS
1086 .nf
1087 \fBip host\fP ace \fBand not\fP helios
1088 .fi
1089 .RE
1090 .LP
1091 To select all traffic between local hosts and hosts at Berkeley:
1092 .RS
1093 .nf
1094 \fBnet\fP ucb-ether
1095 .fi
1096 .RE
1097 .LP
1098 To select all FTP traffic through Internet gateway `snup':
1099 .RS
1100 .nf
1101 \fBgateway\fP snup \fBand (port\fP ftp \fBor\fP ftp-data\fB)\fP
1102 .fi
1103 .RE
1104 .LP
1105 To select IPv4 traffic neither sourced from nor destined for local hosts
1106 (if you gateway to one other net, this stuff should never make it
1107 onto your local net).
1108 .RS
1109 .nf
1110 \fBip and not net \fPlocalnet
1111 .fi
1112 .RE
1113 .LP
1114 To select the start and end packets (the SYN and FIN packets) of each
1115 TCP conversation that involves a non-local host.
1116 .RS
1117 .nf
1118 \fBtcp[tcpflags] & (tcp-syn|tcp-fin) !=\fP 0 \fBand not src and dst net\fP localnet
1119 .fi
1120 .RE
1121 .LP
1122 To select the TCP packets with flags RST and ACK both set.
1123 (i.e. select only the RST and ACK flags in the flags field, and if the result
1124 is "RST and ACK both set", match)
1125 .RS
1126 .nf
1127 .B
1128 tcp[tcpflags] & (tcp-rst|tcp-ack) == (tcp-rst|tcp-ack)
1129 .fi
1130 .RE
1131 .LP
1132 To select all IPv4 HTTP packets to and from port 80, i.e. print only
1133 packets that contain data, not, for example, SYN and FIN packets and
1134 ACK-only packets.  (IPv6 is left as an exercise for the reader.)
1135 .RS
1136 .nf
1137 \fBtcp port\fP 80 \fBand (((ip[\fP2:2\fB] - ((ip[\fP0\fB]&\fP0xf\fB)<<\fP2\fB)) - ((tcp[\fP12\fB]&\fP0xf0\fB)>>\fP2\fB)) != \fP0\fB)
1138 .fi
1139 .RE
1140 .LP
1141 To select IPv4 packets longer than 576 bytes sent through gateway `snup':
1142 .RS
1143 .nf
1144 \fBgateway\fP snup \fBand ip[\fP2:2\fB] >\fP 576
1145 .fi
1146 .RE
1147 .LP
1148 To select IPv4 broadcast or multicast packets that were
1149 .I not
1150 sent via Ethernet broadcast or multicast:
1151 .RS
1152 .nf
1153 \fBether[\fP0\fB] &\fP 1 \fB=\fP 0 \fBand ip[\fP16\fB] >=\fP 224
1154 .fi
1155 .RE
1156 .LP
1157 To select all ICMP packets that are not echo requests/replies (i.e., not
1158 ping packets):
1159 .RS
1160 .nf
1161 .B
1162 icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply
1163 .B
1164 icmp6[icmp6type] != icmp6-echo and icmp6[icmp6type] != icmp6-echoreply
1165 .fi
1166 .RE
1167 .SH BACKWARD COMPATIBILITY
1168 The ICMPv6 type code names, as well as the
1169 .B tcp-ece
1170 and
1171 .B tcp-cwr
1172 TCP flag names became available in libpcap 1.9.0.
1173 .PP
1174 The
1175 .B geneve
1176 keyword became available in libpcap 1.8.0.
1177 .SH SEE ALSO
1178 .BR pcap (3PCAP)
1179 .SH BUGS
1180 To report a security issue please send an e-mail to \%security@tcpdump.org.
1181 .LP
1182 To report bugs and other problems, contribute patches, request a
1183 feature, provide generic feedback etc please see the file
1184 .I CONTRIBUTING.md
1185 in the libpcap source tree root.
1186 .LP
1187 Filter expressions on fields other than those in Token Ring headers will
1188 not correctly handle source-routed Token Ring packets.
1189 .LP
1190 Filter expressions on fields other than those in 802.11 headers will not
1191 correctly handle 802.11 data packets with both To DS and From DS set.
1192 .LP
1193 `\fBip6 proto\fP'
1194 should chase header chain, but at this moment it does not.
1195 `\fBip6 protochain\fP'
1196 is supplied for this behavior.  For example, to match IPv6 fragments:
1197 `\fBip6 protochain\fP 44'
1198 .LP
1199 Arithmetic expression against transport layer headers, like \fBtcp[0]\fP,
1200 does not work against IPv6 packets.
1201 It only looks at IPv4 packets.