Blame pcap-filter.manmisc.in

Packit 209cc3
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
Packit 209cc3
.\"	The Regents of the University of California.  All rights reserved.
Packit 209cc3
.\" All rights reserved.
Packit 209cc3
.\"
Packit 209cc3
.\" Redistribution and use in source and binary forms, with or without
Packit 209cc3
.\" modification, are permitted provided that: (1) source code distributions
Packit 209cc3
.\" retain the above copyright notice and this paragraph in its entirety, (2)
Packit 209cc3
.\" distributions including binary code include the above copyright notice and
Packit 209cc3
.\" this paragraph in its entirety in the documentation or other materials
Packit 209cc3
.\" provided with the distribution, and (3) all advertising materials mentioning
Packit 209cc3
.\" features or use of this software display the following acknowledgement:
Packit 209cc3
.\" ``This product includes software developed by the University of California,
Packit 209cc3
.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
Packit 209cc3
.\" the University nor the names of its contributors may be used to endorse
Packit 209cc3
.\" or promote products derived from this software without specific prior
Packit 209cc3
.\" written permission.
Packit 209cc3
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
Packit 209cc3
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
Packit 209cc3
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Packit 209cc3
.\"
Packit 209cc3
.TH PCAP-FILTER @MAN_MISC_INFO@ "5 November 2017"
Packit 209cc3
.SH NAME
Packit 209cc3
pcap-filter \- packet filter syntax
Packit 209cc3
.br
Packit 209cc3
.ad
Packit 209cc3
.SH DESCRIPTION
Packit 209cc3
.LP
Packit 209cc3
.B pcap_compile()
Packit 209cc3
is used to compile a string into a filter program.
Packit 209cc3
The resulting filter program can then be applied to
Packit 209cc3
some stream of packets to determine which packets will be supplied to
Packit 209cc3
.BR pcap_loop(3PCAP) ,
Packit 209cc3
.BR pcap_dispatch(3PCAP) ,
Packit 209cc3
.BR pcap_next(3PCAP) ,
Packit 209cc3
or
Packit 209cc3
.BR pcap_next_ex(3PCAP) .
Packit 209cc3
.LP
Packit 209cc3
The \fIfilter expression\fP consists of one or more
Packit 209cc3
.IR primitives .
Packit 209cc3
Primitives usually consist of an
Packit 209cc3
.I id
Packit 209cc3
(name or number) preceded by one or more qualifiers.
Packit 209cc3
There are three
Packit 209cc3
different kinds of qualifier:
Packit 209cc3
.IP \fItype\fP
Packit 209cc3
.I type
Packit 209cc3
qualifiers say what kind of thing the id name or number refers to.
Packit 209cc3
Possible types are
Packit 209cc3
.BR host ,
Packit 209cc3
.B net ,
Packit 209cc3
.B port
Packit 209cc3
and
Packit 209cc3
.BR portrange .
Packit 209cc3
E.g., `host foo', `net 128.3', `port 20', `portrange 6000-6008'.
Packit 209cc3
If there is no type
Packit 209cc3
qualifier,
Packit 209cc3
.B host
Packit 209cc3
is assumed.
Packit 209cc3
.IP \fIdir\fP
Packit 209cc3
.I dir
Packit 209cc3
qualifiers specify a particular transfer direction to and/or from
Packit 209cc3
.IR id .
Packit 209cc3
Possible directions are
Packit 209cc3
.BR src ,
Packit 209cc3
.BR dst ,
Packit 209cc3
.BR "src or dst" ,
Packit 209cc3
.BR "src and dst" ,
Packit 209cc3
.BR ra ,
Packit 209cc3
.BR ta ,
Packit 209cc3
.BR addr1 ,
Packit 209cc3
.BR addr2 ,
Packit 209cc3
.BR addr3 ,
Packit 209cc3
and
Packit 209cc3
.BR addr4 .
Packit 209cc3
E.g., `src foo', `dst net 128.3', `src or dst port ftp-data'.
Packit 209cc3
If
Packit 209cc3
there is no dir qualifier,
Packit 209cc3
.B "src or dst"
Packit 209cc3
is assumed.
Packit 209cc3
The
Packit 209cc3
.BR ra ,
Packit 209cc3
.BR ta ,
Packit 209cc3
.BR addr1 ,
Packit 209cc3
.BR addr2 ,
Packit 209cc3
.BR addr3 ,
Packit 209cc3
and
Packit 209cc3
.B addr4
Packit 209cc3
qualifiers are only valid for IEEE 802.11 Wireless LAN link layers.
Packit 209cc3
.IP \fIproto\fP
Packit 209cc3
.I proto
Packit 209cc3
qualifiers restrict the match to a particular protocol.
Packit 209cc3
Possible
Packit 209cc3
protos are:
Packit 209cc3
.BR ether ,
Packit 209cc3
.BR fddi ,
Packit 209cc3
.BR tr ,
Packit 209cc3
.BR wlan ,
Packit 209cc3
.BR ip ,
Packit 209cc3
.BR ip6 ,
Packit 209cc3
.BR arp ,
Packit 209cc3
.BR rarp ,
Packit 209cc3
.BR decnet ,
Packit 209cc3
.B tcp
Packit 209cc3
and
Packit 209cc3
.BR udp .
Packit 209cc3
E.g., `ether src foo', `arp net 128.3', `tcp port 21', `udp portrange
Packit 209cc3
7000-7009', `wlan addr2 0:2:3:4:5:6'.
Packit 209cc3
If there is
Packit 209cc3
no proto qualifier, all protocols consistent with the type are
Packit 209cc3
assumed.
Packit 209cc3
E.g., `src foo' means `(ip or arp or rarp) src foo'
Packit 209cc3
(except the latter is not legal syntax), `net bar' means `(ip or
Packit 209cc3
arp or rarp) net bar' and `port 53' means `(tcp or udp) port 53'.
Packit 209cc3
.LP
Packit 209cc3
[`fddi' is actually an alias for `ether'; the parser treats them
Packit 209cc3
identically as meaning ``the data link level used on the specified
Packit 209cc3
network interface.''  FDDI headers contain Ethernet-like source
Packit 209cc3
and destination addresses, and often contain Ethernet-like packet
Packit 209cc3
types, so you can filter on these FDDI fields just as with the
Packit 209cc3
analogous Ethernet fields.
Packit 209cc3
FDDI headers also contain other fields,
Packit 209cc3
but you cannot name them explicitly in a filter expression.
Packit 209cc3
.LP
Packit 209cc3
Similarly, `tr' and `wlan' are aliases for `ether'; the previous
Packit 209cc3
paragraph's statements about FDDI headers also apply to Token Ring
Packit 209cc3
and 802.11 wireless LAN headers.  For 802.11 headers, the destination
Packit 209cc3
address is the DA field and the source address is the SA field; the
Packit 209cc3
BSSID, RA, and TA fields aren't tested.]
Packit 209cc3
.LP
Packit 209cc3
In addition to the above, there are some special `primitive' keywords
Packit 209cc3
that don't follow the pattern:
Packit 209cc3
.BR gateway ,
Packit 209cc3
.BR broadcast ,
Packit 209cc3
.BR less ,
Packit 209cc3
.B greater
Packit 209cc3
and arithmetic expressions.
Packit 209cc3
All of these are described below.
Packit 209cc3
.LP
Packit 209cc3
More complex filter expressions are built up by using the words
Packit 209cc3
.BR and ,
Packit 209cc3
.B or
Packit 209cc3
and
Packit 209cc3
.B not
Packit 209cc3
to combine primitives.
Packit 209cc3
E.g., `host foo and not port ftp and not port ftp-data'.
Packit 209cc3
To save typing, identical qualifier lists can be omitted.
Packit 209cc3
E.g.,
Packit 209cc3
`tcp dst port ftp or ftp-data or domain' is exactly the same as
Packit 209cc3
`tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain'.
Packit 209cc3
.LP
Packit 209cc3
Allowable primitives are:
Packit 209cc3
.IP "\fBdst host \fIhost\fR"
Packit 209cc3
True if the IPv4/v6 destination field of the packet is \fIhost\fP,
Packit 209cc3
which may be either an address or a name.
Packit 209cc3
.IP "\fBsrc host \fIhost\fR"
Packit 209cc3
True if the IPv4/v6 source field of the packet is \fIhost\fP.
Packit 209cc3
.IP "\fBhost \fIhost\fP"
Packit 209cc3
True if either the IPv4/v6 source or destination of the packet is \fIhost\fP.
Packit 209cc3
.IP
Packit 209cc3
Any of the above host expressions can be prepended with the keywords,
Packit 209cc3
\fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBip host \fIhost\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
which is equivalent to:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBether proto \fI\\ip\fB and host \fIhost\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
If \fIhost\fR is a name with multiple IP addresses, each address will
Packit 209cc3
be checked for a match.
Packit 209cc3
.IP "\fBether dst \fIehost\fP"
Packit 209cc3
True if the Ethernet destination address is \fIehost\fP.
Packit 209cc3
\fIEhost\fP
Packit 209cc3
may be either a name from /etc/ethers or a numerical MAC address of the
Packit 209cc3
form "xx:xx:xx:xx:xx:xx", "xx.xx.xx.xx.xx.xx", "xx-xx-xx-xx-xx-xx",
Packit 209cc3
"xxxx.xxxx.xxxx", "xxxxxxxxxxxx", or various mixes of ':', '.', and '-',
Packit 209cc3
where each "x" is a hex digit (0-9, a-f, or A-F).
Packit 209cc3
.IP "\fBether src \fIehost\fP"
Packit 209cc3
True if the Ethernet source address is \fIehost\fP.
Packit 209cc3
.IP "\fBether host \fIehost\fP"
Packit 209cc3
True if either the Ethernet source or destination address is \fIehost\fP.
Packit 209cc3
.IP "\fBgateway\fP \fIhost\fP"
Packit 209cc3
True if the packet used \fIhost\fP as a gateway.
Packit 209cc3
I.e., the Ethernet
Packit 209cc3
source or destination address was \fIhost\fP but neither the IP source
Packit 209cc3
nor the IP destination was \fIhost\fP.
Packit 209cc3
\fIHost\fP must be a name and
Packit 209cc3
must be found both by the machine's host-name-to-IP-address resolution
Packit 209cc3
mechanisms (host name file, DNS, NIS, etc.) and by the machine's
Packit 209cc3
host-name-to-Ethernet-address resolution mechanism (/etc/ethers, etc.).
Packit 209cc3
(An equivalent expression is
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBether host \fIehost \fBand not host \fIhost\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
which can be used with either names or numbers for \fIhost / ehost\fP.)
Packit 209cc3
This syntax does not work in IPv6-enabled configuration at this moment.
Packit 209cc3
.IP "\fBdst net \fInet\fR"
Packit 209cc3
True if the IPv4/v6 destination address of the packet has a network
Packit 209cc3
number of \fInet\fP.
Packit 209cc3
\fINet\fP may be either a name from the networks database
Packit 209cc3
(/etc/networks, etc.) or a network number.
Packit 209cc3
An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0),
Packit 209cc3
dotted triple (e.g., 192.168.1), dotted pair (e.g, 172.16), or single
Packit 209cc3
number (e.g., 10); the netmask is 255.255.255.255 for a dotted quad
Packit 209cc3
(which means that it's really a host match), 255.255.255.0 for a dotted
Packit 209cc3
triple, 255.255.0.0 for a dotted pair, or 255.0.0.0 for a single number.
Packit 209cc3
An IPv6 network number must be written out fully; the netmask is
Packit 209cc3
ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always
Packit 209cc3
host matches, and a network match requires a netmask length.
Packit 209cc3
.IP "\fBsrc net \fInet\fR"
Packit 209cc3
True if the IPv4/v6 source address of the packet has a network
Packit 209cc3
number of \fInet\fP.
Packit 209cc3
.IP "\fBnet \fInet\fR"
Packit 209cc3
True if either the IPv4/v6 source or destination address of the packet has a network
Packit 209cc3
number of \fInet\fP.
Packit 209cc3
.IP "\fBnet \fInet\fR \fBmask \fInetmask\fR"
Packit 209cc3
True if the IPv4 address matches \fInet\fR with the specific \fInetmask\fR.
Packit 209cc3
May be qualified with \fBsrc\fR or \fBdst\fR.
Packit 209cc3
Note that this syntax is not valid for IPv6 \fInet\fR.
Packit 209cc3
.IP "\fBnet \fInet\fR/\fIlen\fR"
Packit 209cc3
True if the IPv4/v6 address matches \fInet\fR with a netmask \fIlen\fR
Packit 209cc3
bits wide.
Packit 209cc3
May be qualified with \fBsrc\fR or \fBdst\fR.
Packit 209cc3
.IP "\fBdst port \fIport\fR"
Packit 209cc3
True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
Packit 209cc3
destination port value of \fIport\fP.
Packit 209cc3
The \fIport\fP can be a number or a name used in /etc/services (see
Packit 209cc3
.IR tcp (4P)
Packit 209cc3
and
Packit 209cc3
.IR udp (4P)).
Packit 209cc3
If a name is used, both the port
Packit 209cc3
number and protocol are checked.
Packit 209cc3
If a number or ambiguous name is used,
Packit 209cc3
only the port number is checked (e.g., \fBdst port 513\fR will print both
Packit 209cc3
tcp/login traffic and udp/who traffic, and \fBport domain\fR will print
Packit 209cc3
both tcp/domain and udp/domain traffic).
Packit 209cc3
.IP "\fBsrc port \fIport\fR"
Packit 209cc3
True if the packet has a source port value of \fIport\fP.
Packit 209cc3
.IP "\fBport \fIport\fR"
Packit 209cc3
True if either the source or destination port of the packet is \fIport\fP.
Packit 209cc3
.IP "\fBdst portrange \fIport1\fB-\fIport2\fR"
Packit 209cc3
True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
Packit 209cc3
destination port value between \fIport1\fP and \fIport2\fP.
Packit 209cc3
.I port1
Packit 209cc3
and
Packit 209cc3
.I port2
Packit 209cc3
are interpreted in the same fashion as the
Packit 209cc3
.I port
Packit 209cc3
parameter for
Packit 209cc3
.BR port .
Packit 209cc3
.IP "\fBsrc portrange \fIport1\fB-\fIport2\fR"
Packit 209cc3
True if the packet has a source port value between \fIport1\fP and
Packit 209cc3
\fIport2\fP.
Packit 209cc3
.IP "\fBportrange \fIport1\fB-\fIport2\fR"
Packit 209cc3
True if either the source or destination port of the packet is between
Packit 209cc3
\fIport1\fP and \fIport2\fP.
Packit 209cc3
.IP
Packit 209cc3
Any of the above port or port range expressions can be prepended with
Packit 209cc3
the keywords, \fBtcp\fP or \fBudp\fP, as in:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBtcp src port \fIport\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
which matches only tcp packets whose source port is \fIport\fP.
Packit 209cc3
.IP "\fBless \fIlength\fR"
Packit 209cc3
True if the packet has a length less than or equal to \fIlength\fP.
Packit 209cc3
This is equivalent to:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBlen <= \fIlength\fP.
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
.IP "\fBgreater \fIlength\fR"
Packit 209cc3
True if the packet has a length greater than or equal to \fIlength\fP.
Packit 209cc3
This is equivalent to:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBlen >= \fIlength\fP.
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
.IP "\fBip proto \fIprotocol\fR"
Packit 209cc3
True if the packet is an IPv4 packet (see
Packit 209cc3
.IR ip (4P))
Packit 209cc3
of protocol type \fIprotocol\fP.
Packit 209cc3
\fIProtocol\fP can be a number or one of the names
Packit 209cc3
\fBicmp\fP, \fBicmp6\fP, \fBigmp\fP, \fBigrp\fP, \fBpim\fP, \fBah\fP,
Packit 209cc3
\fBesp\fP, \fBvrrp\fP, \fBudp\fP, or \fBtcp\fP.
Packit 209cc3
Note that the identifiers \fBtcp\fP, \fBudp\fP, and \fBicmp\fP are also
Packit 209cc3
keywords and must be escaped via backslash (\\).
Packit 209cc3
Note that this primitive does not chase the protocol header chain.
Packit 209cc3
.IP "\fBip6 proto \fIprotocol\fR"
Packit 209cc3
True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.
Packit 209cc3
Note that this primitive does not chase the protocol header chain.
Packit 209cc3
.IP "\fBproto \fIprotocol\fR"
Packit 209cc3
True if the packet is an IPv4 or IPv6 packet of protocol type
Packit 209cc3
\fIprotocol\fP.  Note that this primitive does not chase the protocol
Packit 209cc3
header chain.
Packit 209cc3
.IP  "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"
Packit 209cc3
Abbreviations for:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBproto \fIp\fR\fB
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
where \fIp\fR is one of the above protocols.
Packit 209cc3
.IP "\fBip6 protochain \fIprotocol\fR"
Packit 209cc3
True if the packet is IPv6 packet,
Packit 209cc3
and contains protocol header with type \fIprotocol\fR
Packit 209cc3
in its protocol header chain.
Packit 209cc3
For example,
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBip6 protochain 6\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
matches any IPv6 packet with TCP protocol header in the protocol header chain.
Packit 209cc3
The packet may contain, for example,
Packit 209cc3
authentication header, routing header, or hop-by-hop option header,
Packit 209cc3
between IPv6 header and TCP header.
Packit 209cc3
The BPF code emitted by this primitive is complex and
Packit 209cc3
cannot be optimized by the BPF optimizer code, and is not supported by
Packit 209cc3
filter engines in the kernel, so this can be somewhat slow, and may
Packit 209cc3
cause more packets to be dropped.
Packit 209cc3
.IP "\fBip protochain \fIprotocol\fR"
Packit 209cc3
Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
Packit 209cc3
.IP "\fBprotochain \fIprotocol\fR"
Packit 209cc3
True if the packet is an IPv4 or IPv6 packet of protocol type
Packit 209cc3
\fIprotocol\fP.  Note that this primitive chases the protocol
Packit 209cc3
header chain.
Packit 209cc3
.IP "\fBether broadcast\fR"
Packit 209cc3
True if the packet is an Ethernet broadcast packet.
Packit 209cc3
The \fIether\fP
Packit 209cc3
keyword is optional.
Packit 209cc3
.IP "\fBip broadcast\fR"
Packit 209cc3
True if the packet is an IPv4 broadcast packet.
Packit 209cc3
It checks for both the all-zeroes and all-ones broadcast conventions,
Packit 209cc3
and looks up the subnet mask on the interface on which the capture is
Packit 209cc3
being done.
Packit 209cc3
.IP
Packit 209cc3
If the subnet mask of the interface on which the capture is being done
Packit 209cc3
is not available, either because the interface on which capture is being
Packit 209cc3
done has no netmask or because the capture is being done on the Linux
Packit 209cc3
"any" interface, which can capture on more than one interface, this
Packit 209cc3
check will not work correctly.
Packit 209cc3
.IP "\fBether multicast\fR"
Packit 209cc3
True if the packet is an Ethernet multicast packet.
Packit 209cc3
The \fBether\fP
Packit 209cc3
keyword is optional.
Packit 209cc3
This is shorthand for `\fBether[0] & 1 != 0\fP'.
Packit 209cc3
.IP "\fBip multicast\fR"
Packit 209cc3
True if the packet is an IPv4 multicast packet.
Packit 209cc3
.IP "\fBip6 multicast\fR"
Packit 209cc3
True if the packet is an IPv6 multicast packet.
Packit 209cc3
.IP  "\fBether proto \fIprotocol\fR"
Packit 209cc3
True if the packet is of ether type \fIprotocol\fR.
Packit 209cc3
\fIProtocol\fP can be a number or one of the names
Packit 209cc3
\fBip\fP, \fBip6\fP, \fBarp\fP, \fBrarp\fP, \fBatalk\fP, \fBaarp\fP,
Packit 209cc3
\fBdecnet\fP, \fBsca\fP, \fBlat\fP, \fBmopdl\fP, \fBmoprc\fP,
Packit 209cc3
\fBiso\fP, \fBstp\fP, \fBipx\fP, or \fBnetbeui\fP.
Packit 209cc3
Note these identifiers are also keywords
Packit 209cc3
and must be escaped via backslash (\\).
Packit 209cc3
.IP
Packit 209cc3
[In the case of FDDI (e.g., `\fBfddi proto arp\fR'), Token Ring
Packit 209cc3
(e.g., `\fBtr proto arp\fR'), and IEEE 802.11 wireless LANS (e.g.,
Packit 209cc3
`\fBwlan proto arp\fR'), for most of those protocols, the
Packit 209cc3
protocol identification comes from the 802.2 Logical Link Control (LLC)
Packit 209cc3
header, which is usually layered on top of the FDDI, Token Ring, or
Packit 209cc3
802.11 header.
Packit 209cc3
.IP
Packit 209cc3
When filtering for most protocol identifiers on FDDI, Token Ring, or
Packit 209cc3
802.11, the filter checks only the protocol ID field of an LLC header
Packit 209cc3
in so-called SNAP format with an Organizational Unit Identifier (OUI) of
Packit 209cc3
0x000000, for encapsulated Ethernet; it doesn't check whether the packet
Packit 209cc3
is in SNAP format with an OUI of 0x000000.
Packit 209cc3
The exceptions are:
Packit 209cc3
.RS
Packit 209cc3
.TP
Packit 209cc3
\fBiso\fP
Packit 209cc3
the filter checks the DSAP (Destination Service Access Point) and
Packit 209cc3
SSAP (Source Service Access Point) fields of the LLC header;
Packit 209cc3
.TP
Packit 209cc3
\fBstp\fP and \fBnetbeui\fP
Packit 209cc3
the filter checks the DSAP of the LLC header;
Packit 209cc3
.TP
Packit 209cc3
\fBatalk\fP
Packit 209cc3
the filter checks for a SNAP-format packet with an OUI of 0x080007
Packit 209cc3
and the AppleTalk etype.
Packit 209cc3
.RE
Packit 209cc3
.IP
Packit 209cc3
In the case of Ethernet, the filter checks the Ethernet type field
Packit 209cc3
for most of those protocols.  The exceptions are:
Packit 209cc3
.RS
Packit 209cc3
.TP
Packit 209cc3
\fBiso\fP, \fBstp\fP, and \fBnetbeui\fP
Packit 209cc3
the filter checks for an 802.3 frame and then checks the LLC header as
Packit 209cc3
it does for FDDI, Token Ring, and 802.11;
Packit 209cc3
.TP
Packit 209cc3
\fBatalk\fP
Packit 209cc3
the filter checks both for the AppleTalk etype in an Ethernet frame and
Packit 209cc3
for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11;
Packit 209cc3
.TP
Packit 209cc3
\fBaarp\fP
Packit 209cc3
the filter checks for the AppleTalk ARP etype in either an Ethernet
Packit 209cc3
frame or an 802.2 SNAP frame with an OUI of 0x000000;
Packit 209cc3
.TP
Packit 209cc3
\fBipx\fP
Packit 209cc3
the filter checks for the IPX etype in an Ethernet frame, the IPX
Packit 209cc3
DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of
Packit 209cc3
IPX, and the IPX etype in a SNAP frame.
Packit 209cc3
.RE
Packit 209cc3
.IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fBnetbeui\fP"
Packit 209cc3
Abbreviations for:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBether proto \fIp\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
where \fIp\fR is one of the above protocols.
Packit 209cc3
.IP "\fBlat\fR, \fBmoprc\fR, \fBmopdl\fR"
Packit 209cc3
Abbreviations for:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBether proto \fIp\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
where \fIp\fR is one of the above protocols.
Packit 209cc3
Note that not all applications using
Packit 209cc3
.BR pcap (3PCAP)
Packit 209cc3
currently know how to parse these protocols.
Packit 209cc3
.IP "\fBdecnet src \fIhost\fR"
Packit 209cc3
True if the DECNET source address is
Packit 209cc3
.IR host ,
Packit 209cc3
which may be an address of the form ``10.123'', or a DECNET host
Packit 209cc3
name.
Packit 209cc3
[DECNET host name support is only available on ULTRIX systems
Packit 209cc3
that are configured to run DECNET.]
Packit 209cc3
.IP "\fBdecnet dst \fIhost\fR"
Packit 209cc3
True if the DECNET destination address is
Packit 209cc3
.IR host .
Packit 209cc3
.IP "\fBdecnet host \fIhost\fR"
Packit 209cc3
True if either the DECNET source or destination address is
Packit 209cc3
.IR host .
Packit 209cc3
.IP \fBllc\fP
Packit 209cc3
True if the packet has an 802.2 LLC header.  This includes:
Packit 209cc3
.IP
Packit 209cc3
Ethernet packets with a length field rather than a type field that
Packit 209cc3
aren't raw NetWare-over-802.3 packets;
Packit 209cc3
.IP
Packit 209cc3
IEEE 802.11 data packets;
Packit 209cc3
.IP
Packit 209cc3
Token Ring packets (no check is done for LLC frames);
Packit 209cc3
.IP
Packit 209cc3
FDDI packets (no check is done for LLC frames);
Packit 209cc3
.IP
Packit 209cc3
LLC-encapsulated ATM packets, for SunATM on Solaris.
Packit 209cc3
.IP "\fBllc\fP \Fitype\fR"
Packit 209cc3
True if the packet has an 802.2 LLC header and has the specified
Packit 209cc3
.IR type .
Packit 209cc3
.I type
Packit 209cc3
can be one of:
Packit 209cc3
.RS
Packit 209cc3
.TP
Packit 209cc3
\fBi\fR
Packit 209cc3
Information (I) PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBs\fR
Packit 209cc3
Supervisory (S) PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBu\fR
Packit 209cc3
Unnumbered (U) PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBrr\fR
Packit 209cc3
Receiver Ready (RR) S PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBrnr\fR
Packit 209cc3
Receiver Not Ready (RNR) S PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBrej\fR
Packit 209cc3
Reject (REJ) S PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBui\fR
Packit 209cc3
Unnumbered Information (UI) U PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBua\fR
Packit 209cc3
Unnumbered Acknowledgment (UA) U PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBdisc\fR
Packit 209cc3
Disconnect (DISC) U PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBsabme\fR
Packit 209cc3
Set Asynchronous Balanced Mode Extended (SABME) U PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBtest\fR
Packit 209cc3
Test (TEST) U PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBxid\fR
Packit 209cc3
Exchange Identification (XID) U PDUs
Packit 209cc3
.TP
Packit 209cc3
\fBfrmr\fR
Packit 209cc3
Frame Reject (FRMR) U PDUs
Packit 209cc3
.RE
Packit 209cc3
.IP \fBinbound\fP
Packit 209cc3
Packet was received by the host performing the capture rather than being
Packit 209cc3
sent by that host.  This is only supported for certain link-layer types,
Packit 209cc3
such as SLIP and the ``cooked'' Linux capture mode
Packit 209cc3
used for the ``any'' device and for some other device types.
Packit 209cc3
.IP \fBoutbound\fP
Packit 209cc3
Packet was sent by the host performing the capture rather than being
Packit 209cc3
received by that host.  This is only supported for certain link-layer types,
Packit 209cc3
such as SLIP and the ``cooked'' Linux capture mode
Packit 209cc3
used for the ``any'' device and for some other device types.
Packit 209cc3
.IP "\fBifname \fIinterface\fR"
Packit 209cc3
True if the packet was logged as coming from the specified interface (applies
Packit 209cc3
only to packets logged by OpenBSD's or FreeBSD's
Packit 209cc3
.BR pf (4)).
Packit 209cc3
.IP "\fBon \fIinterface\fR"
Packit 209cc3
Synonymous with the
Packit 209cc3
.B ifname
Packit 209cc3
modifier.
Packit 209cc3
.IP "\fBrnr \fInum\fR"
Packit 209cc3
True if the packet was logged as matching the specified PF rule number
Packit 209cc3
(applies only to packets logged by OpenBSD's or FreeBSD's
Packit 209cc3
.BR pf (4)).
Packit 209cc3
.IP "\fBrulenum \fInum\fR"
Packit 209cc3
Synonymous with the
Packit 209cc3
.B rnr
Packit 209cc3
modifier.
Packit 209cc3
.IP "\fBreason \fIcode\fR"
Packit 209cc3
True if the packet was logged with the specified PF reason code.  The known
Packit 209cc3
codes are:
Packit 209cc3
.BR match ,
Packit 209cc3
.BR bad-offset ,
Packit 209cc3
.BR fragment ,
Packit 209cc3
.BR short ,
Packit 209cc3
.BR normalize ,
Packit 209cc3
and
Packit 209cc3
.B memory
Packit 209cc3
(applies only to packets logged by OpenBSD's or FreeBSD's
Packit 209cc3
.BR pf (4)).
Packit 209cc3
.IP "\fBrset \fIname\fR"
Packit 209cc3
True if the packet was logged as matching the specified PF ruleset
Packit 209cc3
name of an anchored ruleset (applies only to packets logged by OpenBSD's
Packit 209cc3
or FreeBSD's
Packit 209cc3
.BR pf (4)).
Packit 209cc3
.IP "\fBruleset \fIname\fR"
Packit 209cc3
Synonymous with the
Packit 209cc3
.B rset
Packit 209cc3
modifier.
Packit 209cc3
.IP "\fBsrnr \fInum\fR"
Packit 209cc3
True if the packet was logged as matching the specified PF rule number
Packit 209cc3
of an anchored ruleset (applies only to packets logged by OpenBSD's or
Packit 209cc3
FreeBSD's
Packit 209cc3
.BR pf (4)).
Packit 209cc3
.IP "\fBsubrulenum \fInum\fR"
Packit 209cc3
Synonymous with the
Packit 209cc3
.B srnr
Packit 209cc3
modifier.
Packit 209cc3
.IP "\fBaction \fIact\fR"
Packit 209cc3
True if PF took the specified action when the packet was logged.  Known actions
Packit 209cc3
are:
Packit 209cc3
.B pass
Packit 209cc3
and
Packit 209cc3
.B block
Packit 209cc3
and, with later versions of
Packit 209cc3
.BR pf (4),
Packit 209cc3
.BR nat ,
Packit 209cc3
.BR rdr ,
Packit 209cc3
.B binat
Packit 209cc3
and
Packit 209cc3
.B scrub
Packit 209cc3
(applies only to packets logged by OpenBSD's or FreeBSD's
Packit 209cc3
.BR pf (4)).
Packit 209cc3
.IP "\fBwlan ra \fIehost\fR"
Packit 209cc3
True if the IEEE 802.11 RA is
Packit 209cc3
.IR ehost .
Packit 209cc3
The RA field is used in all frames except for management frames.
Packit 209cc3
.IP "\fBwlan ta \fIehost\fR"
Packit 209cc3
True if the IEEE 802.11 TA is
Packit 209cc3
.IR ehost .
Packit 209cc3
The TA field is used in all frames except for management frames and
Packit 209cc3
CTS (Clear To Send) and ACK (Acknowledgment) control frames.
Packit 209cc3
.IP "\fBwlan addr1 \fIehost\fR"
Packit 209cc3
True if the first IEEE 802.11 address is
Packit 209cc3
.IR ehost .
Packit 209cc3
.IP "\fBwlan addr2 \fIehost\fR"
Packit 209cc3
True if the second IEEE 802.11 address, if present, is
Packit 209cc3
.IR ehost .
Packit 209cc3
The second address field is used in all frames except for CTS (Clear To
Packit 209cc3
Send) and ACK (Acknowledgment) control frames.
Packit 209cc3
.IP "\fBwlan addr3 \fIehost\fR"
Packit 209cc3
True if the third IEEE 802.11 address, if present, is
Packit 209cc3
.IR ehost .
Packit 209cc3
The third address field is used in management and data frames, but not
Packit 209cc3
in control frames.
Packit 209cc3
.IP "\fBwlan addr4 \fIehost\fR"
Packit 209cc3
True if the fourth IEEE 802.11 address, if present, is
Packit 209cc3
.IR ehost .
Packit 209cc3
The fourth address field is only used for
Packit 209cc3
WDS (Wireless Distribution System) frames.
Packit 209cc3
.IP "\fBtype \fIwlan_type\fR"
Packit 209cc3
True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR.
Packit 209cc3
Valid \fIwlan_type\fRs are:
Packit 209cc3
\fBmgt\fP,
Packit 209cc3
\fBctl\fP
Packit 209cc3
and \fBdata\fP.
Packit 209cc3
.IP "\fBtype \fIwlan_type \fBsubtype \fIwlan_subtype\fR"
Packit 209cc3
True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR
Packit 209cc3
and frame subtype matches the specified \fIwlan_subtype\fR.
Packit 209cc3
.IP
Packit 209cc3
If the specified \fIwlan_type\fR is \fBmgt\fP,
Packit 209cc3
then valid \fIwlan_subtype\fRs are:
Packit 209cc3
\fBassoc-req\fP,
Packit 209cc3
\fBassoc-resp\fP,
Packit 209cc3
\fBreassoc-req\fP,
Packit 209cc3
\fBreassoc-resp\fP,
Packit 209cc3
\fBprobe-req\fP,
Packit 209cc3
\fBprobe-resp\fP,
Packit 209cc3
\fBbeacon\fP,
Packit 209cc3
\fBatim\fP,
Packit 209cc3
\fBdisassoc\fP,
Packit 209cc3
\fBauth\fP and
Packit 209cc3
\fBdeauth\fP.
Packit 209cc3
.IP
Packit 209cc3
If the specified \fIwlan_type\fR is \fBctl\fP,
Packit 209cc3
then valid \fIwlan_subtype\fRs are:
Packit 209cc3
\fBps-poll\fP,
Packit 209cc3
\fBrts\fP,
Packit 209cc3
\fBcts\fP,
Packit 209cc3
\fBack\fP,
Packit 209cc3
\fBcf-end\fP and
Packit 209cc3
\fBcf-end-ack\fP.
Packit 209cc3
.IP
Packit 209cc3
If the specified \fIwlan_type\fR is \fBdata\fP,
Packit 209cc3
then valid \fIwlan_subtype\fRs are:
Packit 209cc3
\fBdata\fP,
Packit 209cc3
\fBdata-cf-ack\fP,
Packit 209cc3
\fBdata-cf-poll\fP,
Packit 209cc3
\fBdata-cf-ack-poll\fP,
Packit 209cc3
\fBnull\fP,
Packit 209cc3
\fBcf-ack\fP,
Packit 209cc3
\fBcf-poll\fP,
Packit 209cc3
\fBcf-ack-poll\fP,
Packit 209cc3
\fBqos-data\fP,
Packit 209cc3
\fBqos-data-cf-ack\fP,
Packit 209cc3
\fBqos-data-cf-poll\fP,
Packit 209cc3
\fBqos-data-cf-ack-poll\fP,
Packit 209cc3
\fBqos\fP,
Packit 209cc3
\fBqos-cf-poll\fP and
Packit 209cc3
\fBqos-cf-ack-poll\fP.
Packit 209cc3
.IP "\fBsubtype \fIwlan_subtype\fR"
Packit 209cc3
True if the IEEE 802.11 frame subtype matches the specified \fIwlan_subtype\fR
Packit 209cc3
and frame has the type to which the specified \fIwlan_subtype\fR belongs.
Packit 209cc3
.IP "\fBdir \fIdir\fR"
Packit 209cc3
True if the IEEE 802.11 frame direction matches the specified
Packit 209cc3
.IR dir .
Packit 209cc3
Valid directions are:
Packit 209cc3
.BR nods ,
Packit 209cc3
.BR tods ,
Packit 209cc3
.BR fromds ,
Packit 209cc3
.BR dstods ,
Packit 209cc3
or a numeric value.
Packit 209cc3
.IP "\fBvlan \fI[vlan_id]\fR"
Packit 209cc3
True if the packet is an IEEE 802.1Q VLAN packet.
Packit 209cc3
If \fI[vlan_id]\fR is specified, only true if the packet has the specified
Packit 209cc3
\fIvlan_id\fR.
Packit 209cc3
Note that the first \fBvlan\fR keyword encountered in \fIexpression\fR
Packit 209cc3
changes the decoding offsets for the remainder of \fIexpression\fR on
Packit 209cc3
the assumption that the packet is a VLAN packet.  The \fBvlan
Packit 209cc3
\fI[vlan_id]\fR expression may be used more than once, to filter on VLAN
Packit 209cc3
hierarchies.  Each use of that expression increments the filter offsets
Packit 209cc3
by 4.
Packit 209cc3
.IP
Packit 209cc3
For example:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBvlan 100 && vlan 200\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
filters on VLAN 200 encapsulated within VLAN 100, and
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBvlan && vlan 300 && ip\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
filters IPv4 protocols encapsulated in VLAN 300 encapsulated within any
Packit 209cc3
higher order VLAN.
Packit 209cc3
.IP "\fBmpls \fI[label_num]\fR"
Packit 209cc3
True if the packet is an MPLS packet.
Packit 209cc3
If \fI[label_num]\fR is specified, only true is the packet has the specified
Packit 209cc3
\fIlabel_num\fR.
Packit 209cc3
Note that the first \fBmpls\fR keyword encountered in \fIexpression\fR
Packit 209cc3
changes the decoding offsets for the remainder of \fIexpression\fR on
Packit 209cc3
the assumption that the packet is a MPLS-encapsulated IP packet.  The
Packit 209cc3
\fBmpls \fI[label_num]\fR expression may be used more than once, to
Packit 209cc3
filter on MPLS hierarchies.  Each use of that expression increments the
Packit 209cc3
filter offsets by 4.
Packit 209cc3
.IP
Packit 209cc3
For example:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBmpls 100000 && mpls 1024\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
filters packets with an outer label of 100000 and an inner label of
Packit 209cc3
1024, and
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBmpls && mpls 1024 && host 192.9.200.1\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
filters packets to or from 192.9.200.1 with an inner label of 1024 and
Packit 209cc3
any outer label.
Packit 209cc3
.IP \fBpppoed\fP
Packit 209cc3
True if the packet is a PPP-over-Ethernet Discovery packet (Ethernet
Packit 209cc3
type 0x8863).
Packit 209cc3
.IP "\fBpppoes \fI[session_id]\fR"
Packit 209cc3
True if the packet is a PPP-over-Ethernet Session packet (Ethernet
Packit 209cc3
type 0x8864).
Packit 209cc3
If \fI[session_id]\fR is specified, only true if the packet has the specified
Packit 209cc3
\fIsession_id\fR.
Packit 209cc3
Note that the first \fBpppoes\fR keyword encountered in \fIexpression\fR
Packit 209cc3
changes the decoding offsets for the remainder of \fIexpression\fR on
Packit 209cc3
the assumption that the packet is a PPPoE session packet.
Packit 209cc3
.IP
Packit 209cc3
For example:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBpppoes 0x27 && ip\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
filters IPv4 protocols encapsulated in PPPoE session id 0x27.
Packit 209cc3
.IP "\fBgeneve \fI[vni]\fR"
Packit 209cc3
True if the packet is a Geneve packet (UDP port 6081). If \fI[vni]\fR
Packit 209cc3
is specified, only true if the packet has the specified \fIvni\fR.
Packit 209cc3
Note that when the \fBgeneve\fR keyword is encountered in
Packit 209cc3
\fIexpression\fR, it changes the decoding offsets for the remainder of
Packit 209cc3
\fIexpression\fR on the assumption that the packet is a Geneve packet.
Packit 209cc3
.IP
Packit 209cc3
For example:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBgeneve 0xb && ip\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
filters IPv4 protocols encapsulated in Geneve with VNI 0xb. This will
Packit 209cc3
match both IP directly encapsulated in Geneve as well as IP contained
Packit 209cc3
inside an Ethernet frame.
Packit 209cc3
.IP "\fBiso proto \fIprotocol\fR"
Packit 209cc3
True if the packet is an OSI packet of protocol type \fIprotocol\fP.
Packit 209cc3
\fIProtocol\fP can be a number or one of the names
Packit 209cc3
\fBclnp\fP, \fBesis\fP, or \fBisis\fP.
Packit 209cc3
.IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"
Packit 209cc3
Abbreviations for:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBiso proto \fIp\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
where \fIp\fR is one of the above protocols.
Packit 209cc3
.IP "\fBl1\fR, \fBl2\fR, \fBiih\fR, \fBlsp\fR, \fBsnp\fR, \fBcsnp\fR, \fBpsnp\fR"
Packit 209cc3
Abbreviations for IS-IS PDU types.
Packit 209cc3
.IP "\fBvpi\fP \fIn\fR"
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, with a
Packit 209cc3
virtual path identifier of
Packit 209cc3
.IR n .
Packit 209cc3
.IP "\fBvci\fP \fIn\fR"
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, with a
Packit 209cc3
virtual channel identifier of
Packit 209cc3
.IR n .
Packit 209cc3
.IP \fBlane\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
an ATM LANE packet.
Packit 209cc3
Note that the first \fBlane\fR keyword encountered in \fIexpression\fR
Packit 209cc3
changes the tests done in the remainder of \fIexpression\fR
Packit 209cc3
on the assumption that the packet is either a LANE emulated Ethernet
Packit 209cc3
packet or a LANE LE Control packet.  If \fBlane\fR isn't specified, the
Packit 209cc3
tests are done under the assumption that the packet is an
Packit 209cc3
LLC-encapsulated packet.
Packit 209cc3
.IP \fBoamf4s\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
a segment OAM F4 flow cell (VPI=0 & VCI=3).
Packit 209cc3
.IP \fBoamf4e\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
an end-to-end OAM F4 flow cell (VPI=0 & VCI=4).
Packit 209cc3
.IP \fBoamf4\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
Packit 209cc3
.IP \fBoam\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
Packit 209cc3
.IP \fBmetac\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
on a meta signaling circuit (VPI=0 & VCI=1).
Packit 209cc3
.IP \fBbcc\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
on a broadcast signaling circuit (VPI=0 & VCI=2).
Packit 209cc3
.IP \fBsc\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
on a signaling circuit (VPI=0 & VCI=5).
Packit 209cc3
.IP \fBilmic\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
on an ILMI circuit (VPI=0 & VCI=16).
Packit 209cc3
.IP \fBconnectmsg\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
on a signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
Packit 209cc3
Connect Ack, Release, or Release Done message.
Packit 209cc3
.IP \fBmetaconnect\fP
Packit 209cc3
True if the packet is an ATM packet, for SunATM on Solaris, and is
Packit 209cc3
on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
Packit 209cc3
Release, or Release Done message.
Packit 209cc3
.IP  "\fIexpr relop expr\fR"
Packit 209cc3
True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
Packit 209cc3
!=, and \fIexpr\fR is an arithmetic expression composed of integer
Packit 209cc3
constants (expressed in standard C syntax), the normal binary operators
Packit 209cc3
[+, -, *, /, %, &, |, ^, <<, >>], a length operator, and special packet data
Packit 209cc3
accessors.  Note that all comparisons are unsigned, so that, for example,
Packit 209cc3
0x80000000 and 0xffffffff are > 0.
Packit 209cc3
.IP
Packit 209cc3
The % and ^ operators are currently only supported for filtering in the
Packit 209cc3
kernel on Linux with 3.7 and later kernels; on all other systems, if
Packit 209cc3
those operators are used, filtering will be done in user mode, which
Packit 209cc3
will increase the overhead of capturing packets and may cause more
Packit 209cc3
packets to be dropped.
Packit 209cc3
.IP
Packit 209cc3
To access data inside the packet, use the following syntax:
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
\fIProto\fR is one of \fBether, fddi, tr, wlan, ppp, slip, link,
Packit 209cc3
ip, arp, rarp, tcp, udp, icmp, ip6\fR or \fBradio\fR, and
Packit 209cc3
indicates the protocol layer for the index operation.
Packit 209cc3
(\fBether, fddi, wlan, tr, ppp, slip\fR and \fBlink\fR all refer to the
Packit 209cc3
link layer. \fBradio\fR refers to the "radio header" added to some
Packit 209cc3
802.11 captures.)
Packit 209cc3
Note that \fItcp, udp\fR and other upper-layer protocol types only
Packit 209cc3
apply to IPv4, not IPv6 (this will be fixed in the future).
Packit 209cc3
The byte offset, relative to the indicated protocol layer, is
Packit 209cc3
given by \fIexpr\fR.
Packit 209cc3
\fISize\fR is optional and indicates the number of bytes in the
Packit 209cc3
field of interest; it can be either one, two, or four, and defaults to one.
Packit 209cc3
The length operator, indicated by the keyword \fBlen\fP, gives the
Packit 209cc3
length of the packet.
Packit 209cc3
Packit 209cc3
For example, `\fBether[0] & 1 != 0\fP' catches all multicast traffic.
Packit 209cc3
The expression `\fBip[0] & 0xf != 5\fP'
Packit 209cc3
catches all IPv4 packets with options.
Packit 209cc3
The expression
Packit 209cc3
`\fBip[6:2] & 0x1fff = 0\fP'
Packit 209cc3
catches only unfragmented IPv4 datagrams and frag zero of fragmented
Packit 209cc3
IPv4 datagrams.
Packit 209cc3
This check is implicitly applied to the \fBtcp\fP and \fBudp\fP
Packit 209cc3
index operations.
Packit 209cc3
For instance, \fBtcp[0]\fP always means the first
Packit 209cc3
byte of the TCP \fIheader\fP, and never means the first byte of an
Packit 209cc3
intervening fragment.
Packit 209cc3
Packit 209cc3
Some offsets and field values may be expressed as names rather than
Packit 209cc3
as numeric values.
Packit 209cc3
The following protocol header field offsets are
Packit 209cc3
available: \fBicmptype\fP (ICMP type field), \fBicmp6type (ICMP v6 type field)
Packit 209cc3
\fBicmpcode\fP (ICMP code field), \fBicmp6code\fP (ICMP v6 code field), and
Packit 209cc3
\fBtcpflags\fP (TCP flags field).
Packit 209cc3
Packit 209cc3
The following ICMP type field values are available: \fBicmp-echoreply\fP,
Packit 209cc3
\fBicmp-unreach\fP, \fBicmp-sourcequench\fP, \fBicmp-redirect\fP,
Packit 209cc3
\fBicmp-echo\fP, \fBicmp-routeradvert\fP, \fBicmp-routersolicit\fP,
Packit 209cc3
\fBicmp-timxceed\fP, \fBicmp-paramprob\fP, \fBicmp-tstamp\fP,
Packit 209cc3
\fBicmp-tstampreply\fP, \fBicmp-ireq\fP, \fBicmp-ireqreply\fP,
Packit 209cc3
\fBicmp-maskreq\fP, \fBicmp-maskreply\fP.
Packit 209cc3
Packit 209cc3
The following ICMPv6 type fields are available: \fBicmp6-echo\fP,
Packit 209cc3
\fBicmp6-echoreply\fP, \fBicmp6-multicastlistenerquery\fP,
Packit 209cc3
\fBicmp6-multicastlistenerreportv1\fP, \fBicmp6-multicastlistenerdone\fP,
Packit 209cc3
\fBicmp6-routersolicit\fP, \fBicmp6-routeradvert\fP,
Packit 209cc3
\fBicmp6-neighborsolicit\fP, \fBicmp6-neighboradvert\fP, \fBicmp6-redirect\fP,
Packit 209cc3
\fBicmp6-routerrenum\fP, \fBicmp6-nodeinformationquery\fP,
Packit 209cc3
\fBicmp6-nodeinformationresponse\fP, \fBicmp6-ineighbordiscoverysolicit\fP,
Packit 209cc3
\fBicmp6-ineighbordiscoveryadvert\fP, \fBicmp6-multicastlistenerreportv2\fP,
Packit 209cc3
\fBicmp6-homeagentdiscoveryrequest\fP, \fBicmp6-homeagentdiscoveryreply\fP,
Packit 209cc3
\fBicmp6-mobileprefixsolicit\fP, \fBicmp6-mobileprefixadvert\fP,
Packit 209cc3
\fBicmp6-certpathsolicit\fP, \fBicmp6-certpathadvert\fP,
Packit 209cc3
\fBicmp6-multicastrouteradvert\fP, \fBicmp6-multicastroutersolicit\fP,
Packit 209cc3
\fBicmp6-multicastrouterterm\fP.
Packit 209cc3
Packit 209cc3
The following TCP flags field values are available: \fBtcp-fin\fP,
Packit 209cc3
\fBtcp-syn\fP, \fBtcp-rst\fP, \fBtcp-push\fP,
Packit 209cc3
\fBtcp-ack\fP, \fBtcp-urg\fP, \fBtcp-ece\fP,
Packit 209cc3
\fBtcp-cwr\fP.
Packit 209cc3
.LP
Packit 209cc3
Primitives may be combined using:
Packit 209cc3
.IP
Packit 209cc3
A parenthesized group of primitives and operators.
Packit 209cc3
.IP
Packit 209cc3
Negation (`\fB!\fP' or `\fBnot\fP').
Packit 209cc3
.IP
Packit 209cc3
Concatenation (`\fB&&\fP' or `\fBand\fP').
Packit 209cc3
.IP
Packit 209cc3
Alternation (`\fB||\fP' or `\fBor\fP').
Packit 209cc3
.LP
Packit 209cc3
Negation has highest precedence.
Packit 209cc3
Alternation and concatenation have equal precedence and associate
Packit 209cc3
left to right.
Packit 209cc3
Note that explicit \fBand\fR tokens, not juxtaposition,
Packit 209cc3
are now required for concatenation.
Packit 209cc3
.LP
Packit 209cc3
If an identifier is given without a keyword, the most recent keyword
Packit 209cc3
is assumed.
Packit 209cc3
For example,
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBnot host vs and ace\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
is short for
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBnot host vs and host ace\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
which should not be confused with
Packit 209cc3
.in +.5i
Packit 209cc3
.nf
Packit 209cc3
\fBnot ( host vs or ace )\fR
Packit 209cc3
.fi
Packit 209cc3
.in -.5i
Packit 209cc3
.SH EXAMPLES
Packit 209cc3
.LP
Packit 209cc3
To select all packets arriving at or departing from \fIsundown\fP:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
\fBhost sundown\fP
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
\fBhost helios and \\( hot or ace \\)\fP
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select all IP packets between \fIace\fR and any host except \fIhelios\fR:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
\fBip host ace and not helios\fP
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select all traffic between local hosts and hosts at Berkeley:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
net ucb-ether
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select all ftp traffic through internet gateway \fIsnup\fP:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
gateway snup and (port ftp or ftp-data)
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select traffic neither sourced from nor destined for local hosts
Packit 209cc3
(if you gateway to one other net, this stuff should never make it
Packit 209cc3
onto your local net).
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
ip and not net \fIlocalnet\fP
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select the start and end packets (the SYN and FIN packets) of each
Packit 209cc3
TCP conversation that involves a non-local host.
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocalnet\fP
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select all IPv4 HTTP packets to and from port 80, i.e. print only
Packit 209cc3
packets that contain data, not, for example, SYN and FIN packets and
Packit 209cc3
ACK-only packets.  (IPv6 is left as an exercise for the reader.)
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select IP packets longer than 576 bytes sent through gateway \fIsnup\fP:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
gateway snup and ip[2:2] > 576
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select IP broadcast or multicast packets that were
Packit 209cc3
.I not
Packit 209cc3
sent via Ethernet broadcast or multicast:
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
ether[0] & 1 = 0 and ip[16] >= 224
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.LP
Packit 209cc3
To select all ICMP packets that are not echo requests/replies (i.e., not
Packit 209cc3
ping packets):
Packit 209cc3
.RS
Packit 209cc3
.nf
Packit 209cc3
.B
Packit 209cc3
icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply
Packit 209cc3
.fi
Packit 209cc3
.RE
Packit 209cc3
.SH "SEE ALSO"
Packit 209cc3
pcap(3PCAP)
Packit 209cc3
.SH BUGS
Packit 209cc3
To report a security issue please send an e-mail to security@tcpdump.org.
Packit 209cc3
.LP
Packit 209cc3
To report bugs and other problems, contribute patches, request a
Packit 209cc3
feature, provide generic feedback etc please see the file
Packit 209cc3
.I CONTRIBUTING
Packit 209cc3
in the libpcap source tree root.
Packit 209cc3
.LP
Packit 209cc3
Filter expressions on fields other than those in Token Ring headers will
Packit 209cc3
not correctly handle source-routed Token Ring packets.
Packit 209cc3
.LP
Packit 209cc3
Filter expressions on fields other than those in 802.11 headers will not
Packit 209cc3
correctly handle 802.11 data packets with both To DS and From DS set.
Packit 209cc3
.LP
Packit 209cc3
.BR "ip6 proto"
Packit 209cc3
should chase header chain, but at this moment it does not.
Packit 209cc3
.BR "ip6 protochain"
Packit 209cc3
is supplied for this behavior.
Packit 209cc3
.LP
Packit 209cc3
Arithmetic expression against transport layer headers, like \fBtcp[0]\fP,
Packit 209cc3
does not work against IPv6 packets.
Packit 209cc3
It only looks at IPv4 packets.