]> The Tcpdump Group git mirrors - tcpdump/blob - tcpdump.1
Don't declare variables in the middle of a block of code; in C89, that's
[tcpdump] / tcpdump.1
1 .\" @(#) $Header: /tcpdump/master/tcpdump/Attic/tcpdump.1,v 1.184 2007-06-15 20:14:49 guy Exp $ (LBL)
2 .\"
3 .\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $
4 .\"
5 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
6 .\" The Regents of the University of California. All rights reserved.
7 .\" All rights reserved.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that: (1) source code distributions
11 .\" retain the above copyright notice and this paragraph in its entirety, (2)
12 .\" distributions including binary code include the above copyright notice and
13 .\" this paragraph in its entirety in the documentation or other materials
14 .\" provided with the distribution, and (3) all advertising materials mentioning
15 .\" features or use of this software display the following acknowledgement:
16 .\" ``This product includes software developed by the University of California,
17 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
18 .\" the University nor the names of its contributors may be used to endorse
19 .\" or promote products derived from this software without specific prior
20 .\" written permission.
21 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
22 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
23 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24 .\"
25 .TH TCPDUMP 1 "18 April 2005"
26 .SH NAME
27 tcpdump \- dump traffic on a network
28 .SH SYNOPSIS
29 .na
30 .B tcpdump
31 [
32 .B \-AdDefKlLnNOpqRStuUvxX
33 ] [
34 .B \-c
35 .I count
36 ]
37 .br
38 .ti +8
39 [
40 .B \-C
41 .I file_size
42 ] [
43 .B \-G
44 .I rotate_seconds
45 ] [
46 .B \-F
47 .I file
48 ]
49 .br
50 .ti +8
51 [
52 .B \-i
53 .I interface
54 ]
55 [
56 .B \-m
57 .I module
58 ]
59 [
60 .B \-M
61 .I secret
62 ]
63 .br
64 .ti +8
65 [
66 .B \-r
67 .I file
68 ]
69 [
70 .B \-s
71 .I snaplen
72 ]
73 [
74 .B \-T
75 .I type
76 ]
77 [
78 .B \-w
79 .I file
80 ]
81 .br
82 .ti +8
83 [
84 .B \-W
85 .I filecount
86 ]
87 .br
88 .ti +8
89 [
90 .B \-E
91 .I spi@ipaddr algo:secret,...
92 ]
93 .br
94 .ti +8
95 [
96 .B \-y
97 .I datalinktype
98 ]
99 [
100 .B \-z
101 .I postrotate-command
102 ]
103 [
104 .B \-Z
105 .I user
106 ]
107 .ti +8
108 [
109 .I expression
110 ]
111 .br
112 .ad
113 .SH DESCRIPTION
114 .LP
115 \fITcpdump\fP prints out a description of the contents of packets on a
116 network interface that match the boolean \fIexpression\fP. It can also
117 be run with the
118 .B \-w
119 flag, which causes it to save the packet data to a file for later
120 analysis, and/or with the
121 .B \-r
122 flag, which causes it to read from a saved packet file rather than to
123 read packets from a network interface. In all cases, only packets that
124 match
125 .I expression
126 will be processed by
127 .IR tcpdump .
128 .LP
129 .I Tcpdump
130 will, if not run with the
131 .B \-c
132 flag, continue capturing packets until it is interrupted by a SIGINT
133 signal (generated, for example, by typing your interrupt character,
134 typically control-C) or a SIGTERM signal (typically generated with the
135 .BR kill (1)
136 command); if run with the
137 .B \-c
138 flag, it will capture packets until it is interrupted by a SIGINT or
139 SIGTERM signal or the specified number of packets have been processed.
140 .LP
141 When
142 .I tcpdump
143 finishes capturing packets, it will report counts of:
144 .IP
145 packets ``captured'' (this is the number of packets that
146 .I tcpdump
147 has received and processed);
148 .IP
149 packets ``received by filter'' (the meaning of this depends on the OS on
150 which you're running
151 .IR tcpdump ,
152 and possibly on the way the OS was configured - if a filter was
153 specified on the command line, on some OSes it counts packets regardless
154 of whether they were matched by the filter expression and, even if they
155 were matched by the filter expression, regardless of whether
156 .I tcpdump
157 has read and processed them yet, on other OSes it counts only packets that were
158 matched by the filter expression regardless of whether
159 .I tcpdump
160 has read and processed them yet, and on other OSes it counts only
161 packets that were matched by the filter expression and were processed by
162 .IR tcpdump );
163 .IP
164 packets ``dropped by kernel'' (this is the number of packets that were
165 dropped, due to a lack of buffer space, by the packet capture mechanism
166 in the OS on which
167 .I tcpdump
168 is running, if the OS reports that information to applications; if not,
169 it will be reported as 0).
170 .LP
171 On platforms that support the SIGINFO signal, such as most BSDs
172 (including Mac OS X) and Digital/Tru64 UNIX, it will report those counts
173 when it receives a SIGINFO signal (generated, for example, by typing
174 your ``status'' character, typically control-T, although on some
175 platforms, such as Mac OS X, the ``status'' character is not set by
176 default, so you must set it with
177 .BR stty (1)
178 in order to use it) and will continue capturing packets.
179 .LP
180 Reading packets from a network interface may require that you have
181 special privileges:
182 .TP
183 .B Under SunOS 3.x or 4.x with NIT or BPF:
184 You must have read access to
185 .I /dev/nit
186 or
187 .IR /dev/bpf* .
188 .TP
189 .B Under Solaris with DLPI:
190 You must have read/write access to the network pseudo device, e.g.
191 .IR /dev/le .
192 On at least some versions of Solaris, however, this is not sufficient to
193 allow
194 .I tcpdump
195 to capture in promiscuous mode; on those versions of Solaris, you must
196 be root, or
197 .I tcpdump
198 must be installed setuid to root, in order to capture in promiscuous
199 mode. Note that, on many (perhaps all) interfaces, if you don't capture
200 in promiscuous mode, you will not see any outgoing packets, so a capture
201 not done in promiscuous mode may not be very useful.
202 .TP
203 .B Under HP-UX with DLPI:
204 You must be root or
205 .I tcpdump
206 must be installed setuid to root.
207 .TP
208 .B Under IRIX with snoop:
209 You must be root or
210 .I tcpdump
211 must be installed setuid to root.
212 .TP
213 .B Under Linux:
214 You must be root or
215 .I tcpdump
216 must be installed setuid to root (unless your distribution has a kernel
217 that supports capability bits such as CAP_NET_RAW and code to allow
218 those capability bits to be given to particular accounts and to cause
219 those bits to be set on a user's initial processes when they log in, in
220 which case you must have CAP_NET_RAW in order to capture and
221 CAP_NET_ADMIN to enumerate network devices with, for example, the
222 .B \-D
223 flag).
224 .TP
225 .B Under ULTRIX and Digital UNIX/Tru64 UNIX:
226 Any user may capture network traffic with
227 .IR tcpdump .
228 However, no user (not even the super-user) can capture in promiscuous
229 mode on an interface unless the super-user has enabled promiscuous-mode
230 operation on that interface using
231 .IR pfconfig (8),
232 and no user (not even the super-user) can capture unicast traffic
233 received by or sent by the machine on an interface unless the super-user
234 has enabled copy-all-mode operation on that interface using
235 .IR pfconfig ,
236 so
237 .I useful
238 packet capture on an interface probably requires that either
239 promiscuous-mode or copy-all-mode operation, or both modes of
240 operation, be enabled on that interface.
241 .TP
242 .B Under BSD (this includes Mac OS X):
243 You must have read access to
244 .I /dev/bpf*
245 on systems that don't have a cloning BPF device, or to
246 .I /dev/bpf
247 on systems that do.
248 On BSDs with a devfs (this includes Mac OS X), this might involve more
249 than just having somebody with super-user access setting the ownership
250 or permissions on the BPF devices - it might involve configuring devfs
251 to set the ownership or permissions every time the system is booted,
252 if the system even supports that; if it doesn't support that, you might
253 have to find some other way to make that happen at boot time.
254 .LP
255 Reading a saved packet file doesn't require special privileges.
256 .SH OPTIONS
257 .TP
258 .B \-A
259 Print each packet (minus its link level header) in ASCII. Handy for
260 capturing web pages.
261 .TP
262 .B \-c
263 Exit after receiving \fIcount\fP packets.
264 .TP
265 .B \-C
266 Before writing a raw packet to a savefile, check whether the file is
267 currently larger than \fIfile_size\fP and, if so, close the current
268 savefile and open a new one. Savefiles after the first savefile will
269 have the name specified with the
270 .B \-w
271 flag, with a number after it, starting at 1 and continuing upward.
272 The units of \fIfile_size\fP are millions of bytes (1,000,000 bytes,
273 not 1,048,576 bytes).
274 .TP
275 .B \-d
276 Dump the compiled packet-matching code in a human readable form to
277 standard output and stop.
278 .TP
279 .B \-dd
280 Dump packet-matching code as a
281 .B C
282 program fragment.
283 .TP
284 .B \-ddd
285 Dump packet-matching code as decimal numbers (preceded with a count).
286 .TP
287 .B \-D
288 Print the list of the network interfaces available on the system and on
289 which
290 .I tcpdump
291 can capture packets. For each network interface, a number and an
292 interface name, possibly followed by a text description of the
293 interface, is printed. The interface name or the number can be supplied
294 to the
295 .B \-i
296 flag to specify an interface on which to capture.
297 .IP
298 This can be useful on systems that don't have a command to list them
299 (e.g., Windows systems, or UNIX systems lacking
300 .BR "ifconfig \-a" );
301 the number can be useful on Windows 2000 and later systems, where the
302 interface name is a somewhat complex string.
303 .IP
304 The
305 .B \-D
306 flag will not be supported if
307 .I tcpdump
308 was built with an older version of
309 .I libpcap
310 that lacks the
311 .B pcap_findalldevs()
312 function.
313 .TP
314 .B \-e
315 Print the link-level header on each dump line.
316 .TP
317 .B \-E
318 Use \fIspi@ipaddr algo:secret\fP for decrypting IPsec ESP packets that
319 are addressed to \fIaddr\fP and contain Security Parameter Index value
320 \fIspi\fP. This combination may be repeated with comma or newline seperation.
321 .IP
322 Note that setting the secret for IPv4 ESP packets is supported at this time.
323 .IP
324 Algorithms may be
325 \fBdes-cbc\fP,
326 \fB3des-cbc\fP,
327 \fBblowfish-cbc\fP,
328 \fBrc3-cbc\fP,
329 \fBcast128-cbc\fP, or
330 \fBnone\fP.
331 The default is \fBdes-cbc\fP.
332 The ability to decrypt packets is only present if \fItcpdump\fP was compiled
333 with cryptography enabled.
334 .IP
335 \fIsecret\fP is the ASCII text for ESP secret key.
336 If preceeded by 0x, then a hex value will be read.
337 .IP
338 The option assumes RFC2406 ESP, not RFC1827 ESP.
339 The option is only for debugging purposes, and
340 the use of this option with a true `secret' key is discouraged.
341 By presenting IPsec secret key onto command line
342 you make it visible to others, via
343 .IR ps (1)
344 and other occasions.
345 .IP
346 In addition to the above syntax, the syntax \fIfile name\fP may be used
347 to have tcpdump read the provided file in. The file is opened upon
348 receiving the first ESP packet, so any special permissions that tcpdump
349 may have been given should already have been given up.
350 .TP
351 .B \-f
352 Print `foreign' IPv4 addresses numerically rather than symbolically
353 (this option is intended to get around serious brain damage in
354 Sun's NIS server \(em usually it hangs forever translating non-local
355 internet numbers).
356 .IP
357 The test for `foreign' IPv4 addresses is done using the IPv4 address and
358 netmask of the interface on which capture is being done. If that
359 address or netmask are not available, available, either because the
360 interface on which capture is being done has no address or netmask or
361 because the capture is being done on the Linux "any" interface, which
362 can capture on more than one interface, this option will not work
363 correctly.
364 .TP
365 .B \-F
366 Use \fIfile\fP as input for the filter expression.
367 An additional expression given on the command line is ignored.
368 .TP
369 .B \-G
370 If specified, rotates the dump file specified with the
371 .B \-w
372 option every \fIrotate_seconds\fP seconds.
373 Savefiles will have the name specified by
374 .B \-w
375 which should include a time format as defined by
376 .BR strftime (3).
377 If no time format is specified, each new file will overwrite the previous.
378 .IP
379 If used in conjunction with the
380 .B \-C
381 option, filenames will take the form of `\fIfile\fP<count>'.
382 .TP
383 .B \-i
384 Listen on \fIinterface\fP.
385 If unspecified, \fItcpdump\fP searches the system interface list for the
386 lowest numbered, configured up interface (excluding loopback).
387 Ties are broken by choosing the earliest match.
388 .IP
389 On Linux systems with 2.2 or later kernels, an
390 .I interface
391 argument of ``any'' can be used to capture packets from all interfaces.
392 Note that captures on the ``any'' device will not be done in promiscuous
393 mode.
394 .IP
395 If the
396 .B \-D
397 flag is supported, an interface number as printed by that flag can be
398 used as the
399 .I interface
400 argument.
401 .TP
402 .B \-K
403 Don't attempt to verify TCP checksums. This is useful for interfaces
404 that perform the TCP checksum calculation in hardware; otherwise,
405 all outgoing TCP checksums will be flagged as bad.
406 .TP
407 .B \-l
408 Make stdout line buffered.
409 Useful if you want to see the data
410 while capturing it.
411 E.g.,
412 .br
413 ``tcpdump\ \ \-l\ \ |\ \ tee dat'' or
414 ``tcpdump\ \ \-l \ \ > dat\ \ &\ \ tail\ \ \-f\ \ dat''.
415 .TP
416 .B \-L
417 List the known data link types for the interface and exit.
418 .TP
419 .B \-m
420 Load SMI MIB module definitions from file \fImodule\fR.
421 This option
422 can be used several times to load several MIB modules into \fItcpdump\fP.
423 .TP
424 .B \-M
425 Use \fIsecret\fP as a shared secret for validating the digests found in
426 TCP segments with the TCP-MD5 option (RFC 2385), if present.
427 .TP
428 .B \-n
429 Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.
430 .TP
431 .B \-N
432 Don't print domain name qualification of host names.
433 E.g.,
434 if you give this flag then \fItcpdump\fP will print ``nic''
435 instead of ``nic.ddn.mil''.
436 .TP
437 .B \-O
438 Do not run the packet-matching code optimizer.
439 This is useful only
440 if you suspect a bug in the optimizer.
441 .TP
442 .B \-p
443 \fIDon't\fP put the interface
444 into promiscuous mode.
445 Note that the interface might be in promiscuous
446 mode for some other reason; hence, `-p' cannot be used as an abbreviation for
447 `ether host {local-hw-addr} or ether broadcast'.
448 .TP
449 .B \-q
450 Quick (quiet?) output.
451 Print less protocol information so output
452 lines are shorter.
453 .TP
454 .B \-R
455 Assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829).
456 If specified, \fItcpdump\fP will not print replay prevention field.
457 Since there is no protocol version field in ESP/AH specification,
458 \fItcpdump\fP cannot deduce the version of ESP/AH protocol.
459 .TP
460 .B \-r
461 Read packets from \fIfile\fR (which was created with the
462 .B \-w
463 option).
464 Standard input is used if \fIfile\fR is ``-''.
465 .TP
466 .B \-S
467 Print absolute, rather than relative, TCP sequence numbers.
468 .TP
469 .B \-s
470 Snarf \fIsnaplen\fP bytes of data from each packet rather than the
471 default of 68 (with SunOS's NIT, the minimum is actually 96).
472 68 bytes is adequate for IP, ICMP, TCP
473 and UDP but may truncate protocol information from name server and NFS
474 packets (see below).
475 Packets truncated because of a limited snapshot
476 are indicated in the output with ``[|\fIproto\fP]'', where \fIproto\fP
477 is the name of the protocol level at which the truncation has occurred.
478 Note that taking larger snapshots both increases
479 the amount of time it takes to process packets and, effectively,
480 decreases the amount of packet buffering.
481 This may cause packets to be
482 lost.
483 You should limit \fIsnaplen\fP to the smallest number that will
484 capture the protocol information you're interested in.
485 Setting
486 \fIsnaplen\fP to 0 means use the required length to catch whole packets.
487 .TP
488 .B \-T
489 Force packets selected by "\fIexpression\fP" to be interpreted the
490 specified \fItype\fR.
491 Currently known types are
492 \fBaodv\fR (Ad-hoc On-demand Distance Vector protocol),
493 \fBcnfp\fR (Cisco NetFlow protocol),
494 \fBrpc\fR (Remote Procedure Call),
495 \fBrtp\fR (Real-Time Applications protocol),
496 \fBrtcp\fR (Real-Time Applications control protocol),
497 \fBsnmp\fR (Simple Network Management Protocol),
498 \fBtftp\fR (Trivial File Transfer Protocol),
499 \fBvat\fR (Visual Audio Tool),
500 and
501 \fBwb\fR (distributed White Board).
502 .TP
503 .B \-t
504 \fIDon't\fP print a timestamp on each dump line.
505 .TP
506 .B \-tt
507 Print an unformatted timestamp on each dump line.
508 .TP
509 .B \-ttt
510 Print a delta (micro-second resolution) between current and previous line
511 on each dump line.
512 .TP
513 .B \-tttt
514 Print a timestamp in default format proceeded by date on each dump line.
515 .TP
516 .B \-ttttt
517 Print a delta (micro-second resolution) between current and first line
518 on each dump line.
519 .TP
520 .B \-u
521 Print undecoded NFS handles.
522 .TP
523 .B \-U
524 Make output saved via the
525 .B \-w
526 option ``packet-buffered''; i.e., as each packet is saved, it will be
527 written to the output file, rather than being written only when the
528 output buffer fills.
529 .IP
530 The
531 .B \-U
532 flag will not be supported if
533 .I tcpdump
534 was built with an older version of
535 .I libpcap
536 that lacks the
537 .B pcap_dump_flush()
538 function.
539 .TP
540 .B \-v
541 When parsing and printing, produce (slightly more) verbose output.
542 For example, the time to live,
543 identification, total length and options in an IP packet are printed.
544 Also enables additional packet integrity checks such as verifying the
545 IP and ICMP header checksum.
546 .IP
547 When writing to a file with the
548 .B \-w
549 option, report, every 10 seconds, the number of packets captured.
550 .TP
551 .B \-vv
552 Even more verbose output.
553 For example, additional fields are
554 printed from NFS reply packets, and SMB packets are fully decoded.
555 .TP
556 .B \-vvv
557 Even more verbose output.
558 For example,
559 telnet \fBSB\fP ... \fBSE\fP options
560 are printed in full.
561 With
562 .B \-X
563 Telnet options are printed in hex as well.
564 .TP
565 .B \-w
566 Write the raw packets to \fIfile\fR rather than parsing and printing
567 them out.
568 They can later be printed with the \-r option.
569 Standard output is used if \fIfile\fR is ``-''.
570 .TP
571 .B \-W
572 Used in conjunction with the
573 .B \-C
574 option, this will limit the number
575 of files created to the specified number, and begin overwriting files
576 from the beginning, thus creating a 'rotating' buffer.
577 In addition, it will name
578 the files with enough leading 0s to support the maximum number of
579 files, allowing them to sort correctly.
580 .IP
581 Used in conjunction with the
582 .B \-G
583 option, this will limit the number of rotated dump files that get
584 created, exiting with status 0 when reaching the limit. If used with
585 .B \-C
586 as well, the behavior will result in cyclical files per timeslice.
587 .TP
588 .B \-x
589 When parsing and printing,
590 in addition to printing the headers of each packet, print the data of
591 each packet (minus its link level header) in hex.
592 The smaller of the entire packet or
593 .I snaplen
594 bytes will be printed. Note that this is the entire link-layer
595 packet, so for link layers that pad (e.g. Ethernet), the padding bytes
596 will also be printed when the higher layer packet is shorter than the
597 required padding.
598 .TP
599 .B \-xx
600 When parsing and printing,
601 in addition to printing the headers of each packet, print the data of
602 each packet,
603 .I including
604 its link level header, in hex.
605 .TP
606 .B \-X
607 When parsing and printing,
608 in addition to printing the headers of each packet, print the data of
609 each packet (minus its link level header) in hex and ASCII.
610 This is very handy for analysing new protocols.
611 .TP
612 .B \-XX
613 When parsing and printing,
614 in addition to printing the headers of each packet, print the data of
615 each packet,
616 .I including
617 its link level header, in hex and ASCII.
618 .TP
619 .B \-y
620 Set the data link type to use while capturing packets to \fIdatalinktype\fP.
621 .TP
622 .B \-z
623 Used in conjunction with the
624 .B -C
625 or
626 .B -G
627 options, this will make
628 .I tcpdump
629 run "
630 .I command file
631 " where
632 .I file
633 is the savefile being closed after each rotation. For example, specifying
634 .B \-z gzip
635 or
636 .B \-z bzip2
637 will compress each savefile using gzip or bzip2.
638 .IP
639 Note that tcpdump will run the command in parallel to the capture, using
640 the lowest priority so that this doesn't disturb the capture process.
641 .IP
642 And in case you would like to use a command that itself takes flags or
643 different arguments, you can always write a shell script that will take the
644 savefile name as the only argument, make the flags & arguments arrangements
645 and execute the command that you want.
646 .TP
647 .B \-Z
648 Drops privileges (if root) and changes user ID to
649 .I user
650 and the group ID to the primary group of
651 .IR user .
652 .IP
653 This behavior can also be enabled by default at compile time.
654 .IP "\fI expression\fP"
655 .RS
656 selects which packets will be dumped.
657 If no \fIexpression\fP
658 is given, all packets on the net will be dumped.
659 Otherwise,
660 only packets for which \fIexpression\fP is `true' will be dumped.
661 .LP
662 The \fIexpression\fP consists of one or more
663 .I primitives.
664 Primitives usually consist of an
665 .I id
666 (name or number) preceded by one or more qualifiers.
667 There are three
668 different kinds of qualifier:
669 .IP \fItype\fP
670 qualifiers say what kind of thing the id name or number refers to.
671 Possible types are
672 .BR host ,
673 .B net ,
674 .B port
675 and
676 .BR portrange .
677 E.g., `host foo', `net 128.3', `port 20', `portrange 6000-6008'.
678 If there is no type
679 qualifier,
680 .B host
681 is assumed.
682 .IP \fIdir\fP
683 qualifiers specify a particular transfer direction to and/or from
684 .IR id .
685 Possible directions are
686 .BR src ,
687 .BR dst ,
688 .B "src or dst"
689 and
690 .B "src and"
691 .BR dst .
692 E.g., `src foo', `dst net 128.3', `src or dst port ftp-data'.
693 If
694 there is no dir qualifier,
695 .B "src or dst"
696 is assumed.
697 For some link layers, such as SLIP and the ``cooked'' Linux capture mode
698 used for the ``any'' device and for some other device types, the
699 .B inbound
700 and
701 .B outbound
702 qualifiers can be used to specify a desired direction.
703 .IP \fIproto\fP
704 qualifiers restrict the match to a particular protocol.
705 Possible
706 protos are:
707 .BR ether ,
708 .BR fddi ,
709 .BR tr ,
710 .BR wlan ,
711 .BR ip ,
712 .BR ip6 ,
713 .BR arp ,
714 .BR rarp ,
715 .BR decnet ,
716 .B tcp
717 and
718 .BR udp .
719 E.g., `ether src foo', `arp net 128.3', `tcp port 21', `udp portrange
720 7000-7009'.
721 If there is
722 no proto qualifier, all protocols consistent with the type are
723 assumed.
724 E.g., `src foo' means `(ip or arp or rarp) src foo'
725 (except the latter is not legal syntax), `net bar' means `(ip or
726 arp or rarp) net bar' and `port 53' means `(tcp or udp) port 53'.
727 .LP
728 [`fddi' is actually an alias for `ether'; the parser treats them
729 identically as meaning ``the data link level used on the specified
730 network interface.'' FDDI headers contain Ethernet-like source
731 and destination addresses, and often contain Ethernet-like packet
732 types, so you can filter on these FDDI fields just as with the
733 analogous Ethernet fields.
734 FDDI headers also contain other fields,
735 but you cannot name them explicitly in a filter expression.
736 .LP
737 Similarly, `tr' and `wlan' are aliases for `ether'; the previous
738 paragraph's statements about FDDI headers also apply to Token Ring
739 and 802.11 wireless LAN headers. For 802.11 headers, the destination
740 address is the DA field and the source address is the SA field; the
741 BSSID, RA, and TA fields aren't tested.]
742 .LP
743 In addition to the above, there are some special `primitive' keywords
744 that don't follow the pattern:
745 .BR gateway ,
746 .BR broadcast ,
747 .BR less ,
748 .B greater
749 and arithmetic expressions.
750 All of these are described below.
751 .LP
752 More complex filter expressions are built up by using the words
753 .BR and ,
754 .B or
755 and
756 .B not
757 to combine primitives.
758 E.g., `host foo and not port ftp and not port ftp-data'.
759 To save typing, identical qualifier lists can be omitted.
760 E.g.,
761 `tcp dst port ftp or ftp-data or domain' is exactly the same as
762 `tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain'.
763 .LP
764 Allowable primitives are:
765 .IP "\fBdst host \fIhost\fR"
766 True if the IPv4/v6 destination field of the packet is \fIhost\fP,
767 which may be either an address or a name.
768 .IP "\fBsrc host \fIhost\fR"
769 True if the IPv4/v6 source field of the packet is \fIhost\fP.
770 .IP "\fBhost \fIhost\fP
771 True if either the IPv4/v6 source or destination of the packet is \fIhost\fP.
772 .IP
773 Any of the above host expressions can be prepended with the keywords,
774 \fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
775 .in +.5i
776 .nf
777 \fBip host \fIhost\fR
778 .fi
779 .in -.5i
780 which is equivalent to:
781 .in +.5i
782 .nf
783 \fBether proto \fI\\ip\fB and host \fIhost\fR
784 .fi
785 .in -.5i
786 If \fIhost\fR is a name with multiple IP addresses, each address will
787 be checked for a match.
788 .IP "\fBether dst \fIehost\fP
789 True if the Ethernet destination address is \fIehost\fP.
790 \fIEhost\fP
791 may be either a name from /etc/ethers or a number (see
792 .IR ethers (3N)
793 for numeric format).
794 .IP "\fBether src \fIehost\fP
795 True if the Ethernet source address is \fIehost\fP.
796 .IP "\fBether host \fIehost\fP
797 True if either the Ethernet source or destination address is \fIehost\fP.
798 .IP "\fBgateway\fP \fIhost\fP
799 True if the packet used \fIhost\fP as a gateway.
800 I.e., the Ethernet
801 source or destination address was \fIhost\fP but neither the IP source
802 nor the IP destination was \fIhost\fP.
803 \fIHost\fP must be a name and
804 must be found both by the machine's host-name-to-IP-address resolution
805 mechanisms (host name file, DNS, NIS, etc.) and by the machine's
806 host-name-to-Ethernet-address resolution mechanism (/etc/ethers, etc.).
807 (An equivalent expression is
808 .in +.5i
809 .nf
810 \fBether host \fIehost \fBand not host \fIhost\fR
811 .fi
812 .in -.5i
813 which can be used with either names or numbers for \fIhost / ehost\fP.)
814 This syntax does not work in IPv6-enabled configuration at this moment.
815 .IP "\fBdst net \fInet\fR"
816 True if the IPv4/v6 destination address of the packet has a network
817 number of \fInet\fP.
818 \fINet\fP may be either a name from the networks database
819 (/etc/networks, etc.) or a network number.
820 An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0),
821 dotted triple (e.g., 192.168.1), dotted pair (e.g, 172.16), or single
822 number (e.g., 10); the netmask is 255.255.255.255 for a dotted quad
823 (which means that it's really a host match), 255.255.255.0 for a dotted
824 triple, 255.255.0.0 for a dotted pair, or 255.0.0.0 for a single number.
825 An IPv6 network number must be written out fully; the netmask is
826 ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always
827 host matches, and a network match requires a netmask length.
828 .IP "\fBsrc net \fInet\fR"
829 True if the IPv4/v6 source address of the packet has a network
830 number of \fInet\fP.
831 .IP "\fBnet \fInet\fR"
832 True if either the IPv4/v6 source or destination address of the packet has a network
833 number of \fInet\fP.
834 .IP "\fBnet \fInet\fR \fBmask \fInetmask\fR"
835 True if the IPv4 address matches \fInet\fR with the specific \fInetmask\fR.
836 May be qualified with \fBsrc\fR or \fBdst\fR.
837 Note that this syntax is not valid for IPv6 \fInet\fR.
838 .IP "\fBnet \fInet\fR/\fIlen\fR"
839 True if the IPv4/v6 address matches \fInet\fR with a netmask \fIlen\fR
840 bits wide.
841 May be qualified with \fBsrc\fR or \fBdst\fR.
842 .IP "\fBdst port \fIport\fR"
843 True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
844 destination port value of \fIport\fP.
845 The \fIport\fP can be a number or a name used in /etc/services (see
846 .IR tcp (4P)
847 and
848 .IR udp (4P)).
849 If a name is used, both the port
850 number and protocol are checked.
851 If a number or ambiguous name is used,
852 only the port number is checked (e.g., \fBdst port 513\fR will print both
853 tcp/login traffic and udp/who traffic, and \fBport domain\fR will print
854 both tcp/domain and udp/domain traffic).
855 .IP "\fBsrc port \fIport\fR"
856 True if the packet has a source port value of \fIport\fP.
857 .IP "\fBport \fIport\fR"
858 True if either the source or destination port of the packet is \fIport\fP.
859 .IP "\fBdst portrange \fIport1\fB-\fIport2\fR"
860 True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
861 destination port value between \fIport1\fP and \fIport2\fP.
862 .I port1
863 and
864 .I port2
865 are interpreted in the same fashion as the
866 .I port
867 parameter for
868 .BR port .
869 .IP "\fBsrc portrange \fIport1\fB-\fIport2\fR"
870 True if the packet has a source port value between \fIport1\fP and
871 \fIport2\fP.
872 .IP "\fBportrange \fIport1\fB-\fIport2\fR"
873 True if either the source or destination port of the packet is between
874 \fIport1\fP and \fIport2\fP.
875 .IP
876 Any of the above port or port range expressions can be prepended with
877 the keywords, \fBtcp\fP or \fBudp\fP, as in:
878 .in +.5i
879 .nf
880 \fBtcp src port \fIport\fR
881 .fi
882 .in -.5i
883 which matches only tcp packets whose source port is \fIport\fP.
884 .IP "\fBless \fIlength\fR"
885 True if the packet has a length less than or equal to \fIlength\fP.
886 This is equivalent to:
887 .in +.5i
888 .nf
889 \fBlen <= \fIlength\fP.
890 .fi
891 .in -.5i
892 .IP "\fBgreater \fIlength\fR"
893 True if the packet has a length greater than or equal to \fIlength\fP.
894 This is equivalent to:
895 .in +.5i
896 .nf
897 \fBlen >= \fIlength\fP.
898 .fi
899 .in -.5i
900 .IP "\fBip proto \fIprotocol\fR"
901 True if the packet is an IPv4 packet (see
902 .IR ip (4P))
903 of protocol type \fIprotocol\fP.
904 \fIProtocol\fP can be a number or one of the names
905 \fBicmp\fP, \fBicmp6\fP, \fBigmp\fP, \fBigrp\fP, \fBpim\fP, \fBah\fP,
906 \fBesp\fP, \fBvrrp\fP, \fBudp\fP, or \fBtcp\fP.
907 Note that the identifiers \fBtcp\fP, \fBudp\fP, and \fBicmp\fP are also
908 keywords and must be escaped via backslash (\\), which is \\\\ in the C-shell.
909 Note that this primitive does not chase the protocol header chain.
910 .IP "\fBip6 proto \fIprotocol\fR"
911 True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.
912 Note that this primitive does not chase the protocol header chain.
913 .IP "\fBip6 protochain \fIprotocol\fR"
914 True if the packet is IPv6 packet,
915 and contains protocol header with type \fIprotocol\fR
916 in its protocol header chain.
917 For example,
918 .in +.5i
919 .nf
920 \fBip6 protochain 6\fR
921 .fi
922 .in -.5i
923 matches any IPv6 packet with TCP protocol header in the protocol header chain.
924 The packet may contain, for example,
925 authentication header, routing header, or hop-by-hop option header,
926 between IPv6 header and TCP header.
927 The BPF code emitted by this primitive is complex and
928 cannot be optimized by BPF optimizer code in \fItcpdump\fP,
929 so this can be somewhat slow.
930 .IP "\fBip protochain \fIprotocol\fR"
931 Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
932 .IP "\fBether broadcast\fR"
933 True if the packet is an Ethernet broadcast packet.
934 The \fIether\fP
935 keyword is optional.
936 .IP "\fBip broadcast\fR"
937 True if the packet is an IPv4 broadcast packet.
938 It checks for both the all-zeroes and all-ones broadcast conventions,
939 and looks up the subnet mask on the interface on which the capture is
940 being done.
941 .IP
942 If the subnet mask of the interface on which the capture is being done
943 is not available, either because the interface on which capture is being
944 done has no netmask or because the capture is being done on the Linux
945 "any" interface, which can capture on more than one interface, this
946 check will not work correctly.
947 .IP "\fBether multicast\fR"
948 True if the packet is an Ethernet multicast packet.
949 The \fBether\fP
950 keyword is optional.
951 This is shorthand for `\fBether[0] & 1 != 0\fP'.
952 .IP "\fBip multicast\fR"
953 True if the packet is an IPv4 multicast packet.
954 .IP "\fBip6 multicast\fR"
955 True if the packet is an IPv6 multicast packet.
956 .IP "\fBether proto \fIprotocol\fR"
957 True if the packet is of ether type \fIprotocol\fR.
958 \fIProtocol\fP can be a number or one of the names
959 \fBip\fP, \fBip6\fP, \fBarp\fP, \fBrarp\fP, \fBatalk\fP, \fBaarp\fP,
960 \fBdecnet\fP, \fBsca\fP, \fBlat\fP, \fBmopdl\fP, \fBmoprc\fP,
961 \fBiso\fP, \fBstp\fP, \fBipx\fP, or \fBnetbeui\fP.
962 Note these identifiers are also keywords
963 and must be escaped via backslash (\\).
964 .IP
965 [In the case of FDDI (e.g., `\fBfddi protocol arp\fR'), Token Ring
966 (e.g., `\fBtr protocol arp\fR'), and IEEE 802.11 wireless LANS (e.g.,
967 `\fBwlan protocol arp\fR'), for most of those protocols, the
968 protocol identification comes from the 802.2 Logical Link Control (LLC)
969 header, which is usually layered on top of the FDDI, Token Ring, or
970 802.11 header.
971 .IP
972 When filtering for most protocol identifiers on FDDI, Token Ring, or
973 802.11, \fItcpdump\fR checks only the protocol ID field of an LLC header
974 in so-called SNAP format with an Organizational Unit Identifier (OUI) of
975 0x000000, for encapsulated Ethernet; it doesn't check whether the packet
976 is in SNAP format with an OUI of 0x000000.
977 The exceptions are:
978 .RS
979 .TP
980 \fBiso\fP
981 \fItcpdump\fR checks the DSAP (Destination Service Access Point) and
982 SSAP (Source Service Access Point) fields of the LLC header;
983 .TP
984 \fBstp\fP and \fBnetbeui\fP
985 \fItcpdump\fR checks the DSAP of the LLC header;
986 .TP
987 \fBatalk\fP
988 \fItcpdump\fR checks for a SNAP-format packet with an OUI of 0x080007
989 and the AppleTalk etype.
990 .RE
991 .IP
992 In the case of Ethernet, \fItcpdump\fR checks the Ethernet type field
993 for most of those protocols. The exceptions are:
994 .RS
995 .TP
996 \fBiso\fP, \fBstp\fP, and \fBnetbeui\fP
997 \fItcpdump\fR checks for an 802.3 frame and then checks the LLC header as
998 it does for FDDI, Token Ring, and 802.11;
999 .TP
1000 \fBatalk\fP
1001 \fItcpdump\fR checks both for the AppleTalk etype in an Ethernet frame and
1002 for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11;
1003 .TP
1004 \fBaarp\fP
1005 \fItcpdump\fR checks for the AppleTalk ARP etype in either an Ethernet
1006 frame or an 802.2 SNAP frame with an OUI of 0x000000;
1007 .TP
1008 \fBipx\fP
1009 \fItcpdump\fR checks for the IPX etype in an Ethernet frame, the IPX
1010 DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of
1011 IPX, and the IPX etype in a SNAP frame.
1012 .RE
1013 .IP "\fBdecnet src \fIhost\fR"
1014 True if the DECNET source address is
1015 .IR host ,
1016 which may be an address of the form ``10.123'', or a DECNET host
1017 name.
1018 [DECNET host name support is only available on ULTRIX systems
1019 that are configured to run DECNET.]
1020 .IP "\fBdecnet dst \fIhost\fR"
1021 True if the DECNET destination address is
1022 .IR host .
1023 .IP "\fBdecnet host \fIhost\fR"
1024 True if either the DECNET source or destination address is
1025 .IR host .
1026 .IP "\fBifname \fIinterface\fR"
1027 True if the packet was logged as coming from the specified interface (applies
1028 only to packets logged by OpenBSD's
1029 .BR pf (4)).
1030 .IP "\fBon \fIinterface\fR"
1031 Synonymous with the
1032 .B ifname
1033 modifier.
1034 .IP "\fBrnr \fInum\fR"
1035 True if the packet was logged as matching the specified PF rule number
1036 (applies only to packets logged by OpenBSD's
1037 .BR pf (4)).
1038 .IP "\fBrulenum \fInum\fR"
1039 Synonomous with the
1040 .B rnr
1041 modifier.
1042 .IP "\fBreason \fIcode\fR"
1043 True if the packet was logged with the specified PF reason code. The known
1044 codes are:
1045 .BR match ,
1046 .BR bad-offset ,
1047 .BR fragment ,
1048 .BR short ,
1049 .BR normalize ,
1050 and
1051 .B memory
1052 (applies only to packets logged by OpenBSD's
1053 .BR pf (4)).
1054 .IP "\fBrset \fIname\fR"
1055 True if the packet was logged as matching the specified PF ruleset
1056 name of an anchored ruleset (applies only to packets logged by
1057 .BR pf (4)).
1058 .IP "\fBruleset \fIname\fR"
1059 Synonomous with the
1060 .B rset
1061 modifier.
1062 .IP "\fBsrnr \fInum\fR"
1063 True if the packet was logged as matching the specified PF rule number
1064 of an anchored ruleset (applies only to packets logged by
1065 .BR pf (4)).
1066 .IP "\fBsubrulenum \fInum\fR"
1067 Synonomous with the
1068 .B srnr
1069 modifier.
1070 .IP "\fBaction \fIact\fR"
1071 True if PF took the specified action when the packet was logged. Known actions
1072 are:
1073 .B pass
1074 and
1075 .B block
1076 (applies only to packets logged by OpenBSD's
1077 .BR pf (4)).
1078 .IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fInetbeui\fP"
1079 Abbreviations for:
1080 .in +.5i
1081 .nf
1082 \fBether proto \fIp\fR
1083 .fi
1084 .in -.5i
1085 where \fIp\fR is one of the above protocols.
1086 .IP "\fBlat\fR, \fBmoprc\fR, \fBmopdl\fR"
1087 Abbreviations for:
1088 .in +.5i
1089 .nf
1090 \fBether proto \fIp\fR
1091 .fi
1092 .in -.5i
1093 where \fIp\fR is one of the above protocols.
1094 Note that
1095 \fItcpdump\fP does not currently know how to parse these protocols.
1096 .IP "\fBtype \fIwlan_type\fR"
1097 True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR.
1098 Valid \fIwlan_type\fRs are:
1099 \fBmgt\fP,
1100 \fBctl\fP
1101 and \fBdata\fP.
1102 .IP "\fBtype \fIwlan_type \fBsubtype \fIwlan_subtype\fR"
1103 True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR
1104 and frame subtype matches the specified \fIwlan_subtype\fR.
1105 .IP
1106 If the specified \fIwlan_type\fR is \fBmgt\fP,
1107 then valid \fIwlan_subtype\fRs are:
1108 \fBassoc-req\fP,
1109 \fBassoc-resp\fP,
1110 \fBreassoc-req\fP,
1111 \fBreassoc-resp\fP,
1112 \fBprobe-req\fP,
1113 \fBprobe-resp\fP,
1114 \fBbeacon\fP,
1115 \fBatim\fP,
1116 \fBdisassoc\fP,
1117 \fBauth\fP and
1118 \fBdeauth\fP.
1119 .IP
1120 If the specified \fIwlan_type\fR is \fBctl\fP,
1121 then valid \fIwlan_subtype\fRs are:
1122 \fBps-poll\fP,
1123 \fBrts\fP,
1124 \fBcts\fP,
1125 \fBack\fP,
1126 \fBcf-end\fP and
1127 \fBcf-end-ack\fP.
1128 .IP
1129 If the specified \fIwlan_type\fR is \fBdata\fP,
1130 then valid \fIwlan_subtype\fRs are:
1131 \fBdata\fP,
1132 \fBdata-cf-ack\fP,
1133 \fBdata-cf-poll\fP,
1134 \fBdata-cf-ack-poll\fP,
1135 \fBnull\fP,
1136 \fBcf-ack\fP,
1137 \fBcf-poll\fP,
1138 \fBcf-ack-poll\fP,
1139 \fBqos-data\fP,
1140 \fBqos-data-cf-ack\fP,
1141 \fBqos-data-cf-poll\fP,
1142 \fBqos-data-cf-ack-poll\fP,
1143 \fBqos\fP,
1144 \fBqos-cf-poll\fP and
1145 \fBqos-cf-ack-poll\fP.
1146 .IP "\fBsubtype \fIwlan_subtype\fR"
1147 True if the IEEE 802.11 frame subtype matches the specified \fIwlan_subtype\fR
1148 and frame has the type to which the specified \fIwlan_subtype\fR belongs.
1149 .IP "\fBvlan \fI[vlan_id]\fR"
1150 True if the packet is an IEEE 802.1Q VLAN packet.
1151 If \fI[vlan_id]\fR is specified, only true if the packet has the specified
1152 \fIvlan_id\fR.
1153 Note that the first \fBvlan\fR keyword encountered in \fIexpression\fR
1154 changes the decoding offsets for the remainder of \fIexpression\fR on
1155 the assumption that the packet is a VLAN packet. The \fBvlan
1156 \fI[vlan_id]\fR expression may be used more than once, to filter on VLAN
1157 hierarchies. Each use of that expression increments the filter offsets
1158 by 4.
1159 .IP
1160 For example:
1161 .in +.5i
1162 .nf
1163 \fBvlan 100 && vlan 200\fR
1164 .fi
1165 .in -.5i
1166 filters on VLAN 200 encapsulated within VLAN 100, and
1167 .in +.5i
1168 .nf
1169 \fBvlan && vlan 300 && ip\fR
1170 .fi
1171 .in -.5i
1172 filters IPv4 protocols encapsulated in VLAN 300 encapsulated within any
1173 higher order VLAN.
1174 .IP "\fBmpls \fI[label_num]\fR"
1175 True if the packet is an MPLS packet.
1176 If \fI[label_num]\fR is specified, only true is the packet has the specified
1177 \fIlabel_num\fR.
1178 Note that the first \fBmpls\fR keyword encountered in \fIexpression\fR
1179 changes the decoding offsets for the remainder of \fIexpression\fR on
1180 the assumption that the packet is a MPLS-encapsulated IP packet. The
1181 \fBmpls \fI[label_num]\fR expression may be used more than once, to
1182 filter on MPLS hierarchies. Each use of that expression increments the
1183 filter offsets by 4.
1184 .IP
1185 For example:
1186 .in +.5i
1187 .nf
1188 \fBmpls 100000 && mpls 1024\fR
1189 .fi
1190 .in -.5i
1191 filters packets with an outer label of 100000 and an inner label of
1192 1024, and
1193 .in +.5i
1194 .nf
1195 \fBmpls && mpls 1024 && host 192.9.200.1\fR
1196 .fi
1197 .in -.5i
1198 filters packets to or from 192.9.200.1 with an inner label of 1024 and
1199 any outer label.
1200 .IP \fBpppoed\fP
1201 True if the packet is a PPP-over-Ethernet Discovery packet (Ethernet
1202 type 0x8863).
1203 .IP \fBpppoes\fP
1204 True if the packet is a PPP-over-Ethernet Session packet (Ethernet
1205 type 0x8864).
1206 Note that the first \fBpppoes\fR keyword encountered in \fIexpression\fR
1207 changes the decoding offsets for the remainder of \fIexpression\fR on
1208 the assumption that the packet is a PPPoE session packet.
1209 .IP
1210 For example:
1211 .in +.5i
1212 .nf
1213 \fBpppoes && ip\fR
1214 .fi
1215 .in -.5i
1216 filters IPv4 protocols encapsulated in PPPoE.
1217 .IP "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"
1218 Abbreviations for:
1219 .in +.5i
1220 .nf
1221 \fBip proto \fIp\fR\fB or ip6 proto \fIp\fR
1222 .fi
1223 .in -.5i
1224 where \fIp\fR is one of the above protocols.
1225 .IP "\fBiso proto \fIprotocol\fR"
1226 True if the packet is an OSI packet of protocol type \fIprotocol\fP.
1227 \fIProtocol\fP can be a number or one of the names
1228 \fBclnp\fP, \fBesis\fP, or \fBisis\fP.
1229 .IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"
1230 Abbreviations for:
1231 .in +.5i
1232 .nf
1233 \fBiso proto \fIp\fR
1234 .fi
1235 .in -.5i
1236 where \fIp\fR is one of the above protocols.
1237 .IP "\fBl1\fR, \fBl2\fR, \fBiih\fR, \fBlsp\fR, \fBsnp\fR, \fBcsnp\fR, \fBpsnp\fR"
1238 Abbreviations for IS-IS PDU types.
1239 .IP "\fBvpi\fP \fIn\fR
1240 True if the packet is an ATM packet, for SunATM on Solaris, with a
1241 virtual path identifier of
1242 .IR n .
1243 .IP "\fBvci\fP \fIn\fR
1244 True if the packet is an ATM packet, for SunATM on Solaris, with a
1245 virtual channel identifier of
1246 .IR n .
1247 .IP \fBlane\fP
1248 True if the packet is an ATM packet, for SunATM on Solaris, and is
1249 an ATM LANE packet.
1250 Note that the first \fBlane\fR keyword encountered in \fIexpression\fR
1251 changes the tests done in the remainder of \fIexpression\fR
1252 on the assumption that the packet is either a LANE emulated Ethernet
1253 packet or a LANE LE Control packet. If \fBlane\fR isn't specified, the
1254 tests are done under the assumption that the packet is an
1255 LLC-encapsulated packet.
1256 .IP \fBllc\fP
1257 True if the packet is an ATM packet, for SunATM on Solaris, and is
1258 an LLC-encapsulated packet.
1259 .IP \fBoamf4s\fP
1260 True if the packet is an ATM packet, for SunATM on Solaris, and is
1261 a segment OAM F4 flow cell (VPI=0 & VCI=3).
1262 .IP \fBoamf4e\fP
1263 True if the packet is an ATM packet, for SunATM on Solaris, and is
1264 an end-to-end OAM F4 flow cell (VPI=0 & VCI=4).
1265 .IP \fBoamf4\fP
1266 True if the packet is an ATM packet, for SunATM on Solaris, and is
1267 a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
1268 .IP \fBoam\fP
1269 True if the packet is an ATM packet, for SunATM on Solaris, and is
1270 a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
1271 .IP \fBmetac\fP
1272 True if the packet is an ATM packet, for SunATM on Solaris, and is
1273 on a meta signaling circuit (VPI=0 & VCI=1).
1274 .IP \fBbcc\fP
1275 True if the packet is an ATM packet, for SunATM on Solaris, and is
1276 on a broadcast signaling circuit (VPI=0 & VCI=2).
1277 .IP \fBsc\fP
1278 True if the packet is an ATM packet, for SunATM on Solaris, and is
1279 on a signaling circuit (VPI=0 & VCI=5).
1280 .IP \fBilmic\fP
1281 True if the packet is an ATM packet, for SunATM on Solaris, and is
1282 on an ILMI circuit (VPI=0 & VCI=16).
1283 .IP \fBconnectmsg\fP
1284 True if the packet is an ATM packet, for SunATM on Solaris, and is
1285 on a signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
1286 Connect Ack, Release, or Release Done message.
1287 .IP \fBmetaconnect\fP
1288 True if the packet is an ATM packet, for SunATM on Solaris, and is
1289 on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
1290 Release, or Release Done message.
1291 .IP "\fIexpr relop expr\fR"
1292 True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
1293 !=, and \fIexpr\fR is an arithmetic expression composed of integer
1294 constants (expressed in standard C syntax), the normal binary operators
1295 [+, -, *, /, &, |, <<, >>], a length operator, and special packet data
1296 accessors. Note that all comparisons are unsigned, so that, for example,
1297 0x80000000 and 0xffffffff are > 0.
1298 To access
1299 data inside the packet, use the following syntax:
1300 .in +.5i
1301 .nf
1302 \fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
1303 .fi
1304 .in -.5i
1305 \fIProto\fR is one of \fBether, fddi, tr, wlan, ppp, slip, link,
1306 ip, arp, rarp, tcp, udp, icmp, ip6\fR or \fBradio\fR, and
1307 indicates the protocol layer for the index operation.
1308 (\fBether, fddi, wlan, tr, ppp, slip\fR and \fBlink\fR all refer to the
1309 link layer. \fBradio\fR refers to the "radio header" added to some
1310 802.11 captures.)
1311 Note that \fItcp, udp\fR and other upper-layer protocol types only
1312 apply to IPv4, not IPv6 (this will be fixed in the future).
1313 The byte offset, relative to the indicated protocol layer, is
1314 given by \fIexpr\fR.
1315 \fISize\fR is optional and indicates the number of bytes in the
1316 field of interest; it can be either one, two, or four, and defaults to one.
1317 The length operator, indicated by the keyword \fBlen\fP, gives the
1318 length of the packet.
1319
1320 For example, `\fBether[0] & 1 != 0\fP' catches all multicast traffic.
1321 The expression `\fBip[0] & 0xf != 5\fP'
1322 catches all IPv4 packets with options.
1323 The expression
1324 `\fBip[6:2] & 0x1fff = 0\fP'
1325 catches only unfragmented IPv4 datagrams and frag zero of fragmented
1326 IPv4 datagrams.
1327 This check is implicitly applied to the \fBtcp\fP and \fBudp\fP
1328 index operations.
1329 For instance, \fBtcp[0]\fP always means the first
1330 byte of the TCP \fIheader\fP, and never means the first byte of an
1331 intervening fragment.
1332
1333 Some offsets and field values may be expressed as names rather than
1334 as numeric values.
1335 The following protocol header field offsets are
1336 available: \fBicmptype\fP (ICMP type field), \fBicmpcode\fP (ICMP
1337 code field), and \fBtcpflags\fP (TCP flags field).
1338
1339 The following ICMP type field values are available: \fBicmp-echoreply\fP,
1340 \fBicmp-unreach\fP, \fBicmp-sourcequench\fP, \fBicmp-redirect\fP,
1341 \fBicmp-echo\fP, \fBicmp-routeradvert\fP, \fBicmp-routersolicit\fP,
1342 \fBicmp-timxceed\fP, \fBicmp-paramprob\fP, \fBicmp-tstamp\fP,
1343 \fBicmp-tstampreply\fP, \fBicmp-ireq\fP, \fBicmp-ireqreply\fP,
1344 \fBicmp-maskreq\fP, \fBicmp-maskreply\fP.
1345
1346 The following TCP flags field values are available: \fBtcp-fin\fP,
1347 \fBtcp-syn\fP, \fBtcp-rst\fP, \fBtcp-push\fP,
1348 \fBtcp-ack\fP, \fBtcp-urg\fP.
1349 .LP
1350 Primitives may be combined using:
1351 .IP
1352 A parenthesized group of primitives and operators
1353 (parentheses are special to the Shell and must be escaped).
1354 .IP
1355 Negation (`\fB!\fP' or `\fBnot\fP').
1356 .IP
1357 Concatenation (`\fB&&\fP' or `\fBand\fP').
1358 .IP
1359 Alternation (`\fB||\fP' or `\fBor\fP').
1360 .LP
1361 Negation has highest precedence.
1362 Alternation and concatenation have equal precedence and associate
1363 left to right.
1364 Note that explicit \fBand\fR tokens, not juxtaposition,
1365 are now required for concatenation.
1366 .LP
1367 If an identifier is given without a keyword, the most recent keyword
1368 is assumed.
1369 For example,
1370 .in +.5i
1371 .nf
1372 \fBnot host vs and ace\fR
1373 .fi
1374 .in -.5i
1375 is short for
1376 .in +.5i
1377 .nf
1378 \fBnot host vs and host ace\fR
1379 .fi
1380 .in -.5i
1381 which should not be confused with
1382 .in +.5i
1383 .nf
1384 \fBnot ( host vs or ace )\fR
1385 .fi
1386 .in -.5i
1387 .LP
1388 Expression arguments can be passed to \fItcpdump\fP as either a single
1389 argument or as multiple arguments, whichever is more convenient.
1390 Generally, if the expression contains Shell metacharacters, it is
1391 easier to pass it as a single, quoted argument.
1392 Multiple arguments are concatenated with spaces before being parsed.
1393 .SH EXAMPLES
1394 .LP
1395 To print all packets arriving at or departing from \fIsundown\fP:
1396 .RS
1397 .nf
1398 \fBtcpdump host sundown\fP
1399 .fi
1400 .RE
1401 .LP
1402 To print traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR:
1403 .RS
1404 .nf
1405 \fBtcpdump host helios and \\( hot or ace \\)\fP
1406 .fi
1407 .RE
1408 .LP
1409 To print all IP packets between \fIace\fR and any host except \fIhelios\fR:
1410 .RS
1411 .nf
1412 \fBtcpdump ip host ace and not helios\fP
1413 .fi
1414 .RE
1415 .LP
1416 To print all traffic between local hosts and hosts at Berkeley:
1417 .RS
1418 .nf
1419 .B
1420 tcpdump net ucb-ether
1421 .fi
1422 .RE
1423 .LP
1424 To print all ftp traffic through internet gateway \fIsnup\fP:
1425 (note that the expression is quoted to prevent the shell from
1426 (mis-)interpreting the parentheses):
1427 .RS
1428 .nf
1429 .B
1430 tcpdump 'gateway snup and (port ftp or ftp-data)'
1431 .fi
1432 .RE
1433 .LP
1434 To print traffic neither sourced from nor destined for local hosts
1435 (if you gateway to one other net, this stuff should never make it
1436 onto your local net).
1437 .RS
1438 .nf
1439 .B
1440 tcpdump ip and not net \fIlocalnet\fP
1441 .fi
1442 .RE
1443 .LP
1444 To print the start and end packets (the SYN and FIN packets) of each
1445 TCP conversation that involves a non-local host.
1446 .RS
1447 .nf
1448 .B
1449 tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocalnet\fP'
1450 .fi
1451 .RE
1452 .LP
1453 To print all IPv4 HTTP packets to and from port 80, i.e. print only
1454 packets that contain data, not, for example, SYN and FIN packets and
1455 ACK-only packets. (IPv6 is left as an exercise for the reader.)
1456 .RS
1457 .nf
1458 .B
1459 tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
1460 .fi
1461 .RE
1462 .LP
1463 To print IP packets longer than 576 bytes sent through gateway \fIsnup\fP:
1464 .RS
1465 .nf
1466 .B
1467 tcpdump 'gateway snup and ip[2:2] > 576'
1468 .fi
1469 .RE
1470 .LP
1471 To print IP broadcast or multicast packets that were
1472 .I not
1473 sent via Ethernet broadcast or multicast:
1474 .RS
1475 .nf
1476 .B
1477 tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'
1478 .fi
1479 .RE
1480 .LP
1481 To print all ICMP packets that are not echo requests/replies (i.e., not
1482 ping packets):
1483 .RS
1484 .nf
1485 .B
1486 tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'
1487 .fi
1488 .RE
1489 .SH OUTPUT FORMAT
1490 .LP
1491 The output of \fItcpdump\fP is protocol dependent.
1492 The following
1493 gives a brief description and examples of most of the formats.
1494 .de HD
1495 .sp 1.5
1496 .B
1497 ..
1498 .HD
1499 Link Level Headers
1500 .LP
1501 If the '-e' option is given, the link level header is printed out.
1502 On Ethernets, the source and destination addresses, protocol,
1503 and packet length are printed.
1504 .LP
1505 On FDDI networks, the '-e' option causes \fItcpdump\fP to print
1506 the `frame control' field, the source and destination addresses,
1507 and the packet length.
1508 (The `frame control' field governs the
1509 interpretation of the rest of the packet.
1510 Normal packets (such
1511 as those containing IP datagrams) are `async' packets, with a priority
1512 value between 0 and 7; for example, `\fBasync4\fR'.
1513 Such packets
1514 are assumed to contain an 802.2 Logical Link Control (LLC) packet;
1515 the LLC header is printed if it is \fInot\fR an ISO datagram or a
1516 so-called SNAP packet.
1517 .LP
1518 On Token Ring networks, the '-e' option causes \fItcpdump\fP to print
1519 the `access control' and `frame control' fields, the source and
1520 destination addresses, and the packet length.
1521 As on FDDI networks,
1522 packets are assumed to contain an LLC packet.
1523 Regardless of whether
1524 the '-e' option is specified or not, the source routing information is
1525 printed for source-routed packets.
1526 .LP
1527 On 802.11 networks, the '-e' option causes \fItcpdump\fP to print
1528 the `frame control' fields, all of the addresses in the 802.11 header,
1529 and the packet length.
1530 As on FDDI networks,
1531 packets are assumed to contain an LLC packet.
1532 .LP
1533 \fI(N.B.: The following description assumes familiarity with
1534 the SLIP compression algorithm described in RFC-1144.)\fP
1535 .LP
1536 On SLIP links, a direction indicator (``I'' for inbound, ``O'' for outbound),
1537 packet type, and compression information are printed out.
1538 The packet type is printed first.
1539 The three types are \fIip\fP, \fIutcp\fP, and \fIctcp\fP.
1540 No further link information is printed for \fIip\fR packets.
1541 For TCP packets, the connection identifier is printed following the type.
1542 If the packet is compressed, its encoded header is printed out.
1543 The special cases are printed out as
1544 \fB*S+\fIn\fR and \fB*SA+\fIn\fR, where \fIn\fR is the amount by which
1545 the sequence number (or sequence number and ack) has changed.
1546 If it is not a special case,
1547 zero or more changes are printed.
1548 A change is indicated by U (urgent pointer), W (window), A (ack),
1549 S (sequence number), and I (packet ID), followed by a delta (+n or -n),
1550 or a new value (=n).
1551 Finally, the amount of data in the packet and compressed header length
1552 are printed.
1553 .LP
1554 For example, the following line shows an outbound compressed TCP packet,
1555 with an implicit connection identifier; the ack has changed by 6,
1556 the sequence number by 49, and the packet ID by 6; there are 3 bytes of
1557 data and 6 bytes of compressed header:
1558 .RS
1559 .nf
1560 \fBO ctcp * A+6 S+49 I+6 3 (6)\fP
1561 .fi
1562 .RE
1563 .HD
1564 ARP/RARP Packets
1565 .LP
1566 Arp/rarp output shows the type of request and its arguments.
1567 The
1568 format is intended to be self explanatory.
1569 Here is a short sample taken from the start of an `rlogin' from
1570 host \fIrtsg\fP to host \fIcsam\fP:
1571 .RS
1572 .nf
1573 .sp .5
1574 \f(CWarp who-has csam tell rtsg
1575 arp reply csam is-at CSAM\fR
1576 .sp .5
1577 .fi
1578 .RE
1579 The first line says that rtsg sent an arp packet asking
1580 for the Ethernet address of internet host csam.
1581 Csam
1582 replies with its Ethernet address (in this example, Ethernet addresses
1583 are in caps and internet addresses in lower case).
1584 .LP
1585 This would look less redundant if we had done \fItcpdump \-n\fP:
1586 .RS
1587 .nf
1588 .sp .5
1589 \f(CWarp who-has 128.3.254.6 tell 128.3.254.68
1590 arp reply 128.3.254.6 is-at 02:07:01:00:01:c4\fP
1591 .fi
1592 .RE
1593 .LP
1594 If we had done \fItcpdump \-e\fP, the fact that the first packet is
1595 broadcast and the second is point-to-point would be visible:
1596 .RS
1597 .nf
1598 .sp .5
1599 \f(CWRTSG Broadcast 0806 64: arp who-has csam tell rtsg
1600 CSAM RTSG 0806 64: arp reply csam is-at CSAM\fR
1601 .sp .5
1602 .fi
1603 .RE
1604 For the first packet this says the Ethernet source address is RTSG, the
1605 destination is the Ethernet broadcast address, the type field
1606 contained hex 0806 (type ETHER_ARP) and the total length was 64 bytes.
1607 .HD
1608 TCP Packets
1609 .LP
1610 \fI(N.B.:The following description assumes familiarity with
1611 the TCP protocol described in RFC-793.
1612 If you are not familiar
1613 with the protocol, neither this description nor \fItcpdump\fP will
1614 be of much use to you.)\fP
1615 .LP
1616 The general format of a tcp protocol line is:
1617 .RS
1618 .nf
1619 .sp .5
1620 \fIsrc > dst: flags data-seqno ack window urgent options\fP
1621 .sp .5
1622 .fi
1623 .RE
1624 \fISrc\fP and \fIdst\fP are the source and destination IP
1625 addresses and ports.
1626 \fIFlags\fP are some combination of S (SYN),
1627 F (FIN), P (PUSH), R (RST), W (ECN CWR) or E (ECN-Echo), or a single
1628 `.' (no flags).
1629 \fIData-seqno\fP describes the portion of sequence space covered
1630 by the data in this packet (see example below).
1631 \fIAck\fP is sequence number of the next data expected the other
1632 direction on this connection.
1633 \fIWindow\fP is the number of bytes of receive buffer space available
1634 the other direction on this connection.
1635 \fIUrg\fP indicates there is `urgent' data in the packet.
1636 \fIOptions\fP are tcp options enclosed in angle brackets (e.g., <mss 1024>).
1637 .LP
1638 \fISrc, dst\fP and \fIflags\fP are always present.
1639 The other fields
1640 depend on the contents of the packet's tcp protocol header and
1641 are output only if appropriate.
1642 .LP
1643 Here is the opening portion of an rlogin from host \fIrtsg\fP to
1644 host \fIcsam\fP.
1645 .RS
1646 .nf
1647 .sp .5
1648 \s-2\f(CWrtsg.1023 > csam.login: S 768512:768512(0) win 4096 <mss 1024>
1649 csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 <mss 1024>
1650 rtsg.1023 > csam.login: . ack 1 win 4096
1651 rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096
1652 csam.login > rtsg.1023: . ack 2 win 4096
1653 rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096
1654 csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077
1655 csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1
1656 csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1\fR\s+2
1657 .sp .5
1658 .fi
1659 .RE
1660 The first line says that tcp port 1023 on rtsg sent a packet
1661 to port \fIlogin\fP
1662 on csam.
1663 The \fBS\fP indicates that the \fISYN\fP flag was set.
1664 The packet sequence number was 768512 and it contained no data.
1665 (The notation is `first:last(nbytes)' which means `sequence
1666 numbers \fIfirst\fP
1667 up to but not including \fIlast\fP which is \fInbytes\fP bytes of user data'.)
1668 There was no piggy-backed ack, the available receive window was 4096
1669 bytes and there was a max-segment-size option requesting an mss of
1670 1024 bytes.
1671 .LP
1672 Csam replies with a similar packet except it includes a piggy-backed
1673 ack for rtsg's SYN.
1674 Rtsg then acks csam's SYN.
1675 The `.' means no
1676 flags were set.
1677 The packet contained no data so there is no data sequence number.
1678 Note that the ack sequence
1679 number is a small integer (1).
1680 The first time \fItcpdump\fP sees a
1681 tcp `conversation', it prints the sequence number from the packet.
1682 On subsequent packets of the conversation, the difference between
1683 the current packet's sequence number and this initial sequence number
1684 is printed.
1685 This means that sequence numbers after the
1686 first can be interpreted
1687 as relative byte positions in the conversation's data stream (with the
1688 first data byte each direction being `1').
1689 `-S' will override this
1690 feature, causing the original sequence numbers to be output.
1691 .LP
1692 On the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20
1693 in the rtsg \(-> csam side of the conversation).
1694 The PUSH flag is set in the packet.
1695 On the 7th line, csam says it's received data sent by rtsg up to
1696 but not including byte 21.
1697 Most of this data is apparently sitting in the
1698 socket buffer since csam's receive window has gotten 19 bytes smaller.
1699 Csam also sends one byte of data to rtsg in this packet.
1700 On the 8th and 9th lines,
1701 csam sends two bytes of urgent, pushed data to rtsg.
1702 .LP
1703 If the snapshot was small enough that \fItcpdump\fP didn't capture
1704 the full TCP header, it interprets as much of the header as it can
1705 and then reports ``[|\fItcp\fP]'' to indicate the remainder could not
1706 be interpreted.
1707 If the header contains a bogus option (one with a length
1708 that's either too small or beyond the end of the header), \fItcpdump\fP
1709 reports it as ``[\fIbad opt\fP]'' and does not interpret any further
1710 options (since it's impossible to tell where they start).
1711 If the header
1712 length indicates options are present but the IP datagram length is not
1713 long enough for the options to actually be there, \fItcpdump\fP reports
1714 it as ``[\fIbad hdr length\fP]''.
1715 .HD
1716 .B Capturing TCP packets with particular flag combinations (SYN-ACK, URG-ACK, etc.)
1717 .PP
1718 There are 8 bits in the control bits section of the TCP header:
1719 .IP
1720 .I CWR | ECE | URG | ACK | PSH | RST | SYN | FIN
1721 .PP
1722 Let's assume that we want to watch packets used in establishing
1723 a TCP connection.
1724 Recall that TCP uses a 3-way handshake protocol
1725 when it initializes a new connection; the connection sequence with
1726 regard to the TCP control bits is
1727 .PP
1728 .RS
1729 1) Caller sends SYN
1730 .RE
1731 .RS
1732 2) Recipient responds with SYN, ACK
1733 .RE
1734 .RS
1735 3) Caller sends ACK
1736 .RE
1737 .PP
1738 Now we're interested in capturing packets that have only the
1739 SYN bit set (Step 1).
1740 Note that we don't want packets from step 2
1741 (SYN-ACK), just a plain initial SYN.
1742 What we need is a correct filter
1743 expression for \fItcpdump\fP.
1744 .PP
1745 Recall the structure of a TCP header without options:
1746 .PP
1747 .nf
1748 0 15 31
1749 -----------------------------------------------------------------
1750 | source port | destination port |
1751 -----------------------------------------------------------------
1752 | sequence number |
1753 -----------------------------------------------------------------
1754 | acknowledgment number |
1755 -----------------------------------------------------------------
1756 | HL | rsvd |C|E|U|A|P|R|S|F| window size |
1757 -----------------------------------------------------------------
1758 | TCP checksum | urgent pointer |
1759 -----------------------------------------------------------------
1760 .fi
1761 .PP
1762 A TCP header usually holds 20 octets of data, unless options are
1763 present.
1764 The first line of the graph contains octets 0 - 3, the
1765 second line shows octets 4 - 7 etc.
1766 .PP
1767 Starting to count with 0, the relevant TCP control bits are contained
1768 in octet 13:
1769 .PP
1770 .nf
1771 0 7| 15| 23| 31
1772 ----------------|---------------|---------------|----------------
1773 | HL | rsvd |C|E|U|A|P|R|S|F| window size |
1774 ----------------|---------------|---------------|----------------
1775 | | 13th octet | | |
1776 .fi
1777 .PP
1778 Let's have a closer look at octet no. 13:
1779 .PP
1780 .nf
1781 | |
1782 |---------------|
1783 |C|E|U|A|P|R|S|F|
1784 |---------------|
1785 |7 5 3 0|
1786 .fi
1787 .PP
1788 These are the TCP control bits we are interested
1789 in.
1790 We have numbered the bits in this octet from 0 to 7, right to
1791 left, so the PSH bit is bit number 3, while the URG bit is number 5.
1792 .PP
1793 Recall that we want to capture packets with only SYN set.
1794 Let's see what happens to octet 13 if a TCP datagram arrives
1795 with the SYN bit set in its header:
1796 .PP
1797 .nf
1798 |C|E|U|A|P|R|S|F|
1799 |---------------|
1800 |0 0 0 0 0 0 1 0|
1801 |---------------|
1802 |7 6 5 4 3 2 1 0|
1803 .fi
1804 .PP
1805 Looking at the
1806 control bits section we see that only bit number 1 (SYN) is set.
1807 .PP
1808 Assuming that octet number 13 is an 8-bit unsigned integer in
1809 network byte order, the binary value of this octet is
1810 .IP
1811 00000010
1812 .PP
1813 and its decimal representation is
1814 .PP
1815 .nf
1816 7 6 5 4 3 2 1 0
1817 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 1*2 + 0*2 = 2
1818 .fi
1819 .PP
1820 We're almost done, because now we know that if only SYN is set,
1821 the value of the 13th octet in the TCP header, when interpreted
1822 as a 8-bit unsigned integer in network byte order, must be exactly 2.
1823 .PP
1824 This relationship can be expressed as
1825 .RS
1826 .B
1827 tcp[13] == 2
1828 .RE
1829 .PP
1830 We can use this expression as the filter for \fItcpdump\fP in order
1831 to watch packets which have only SYN set:
1832 .RS
1833 .B
1834 tcpdump -i xl0 tcp[13] == 2
1835 .RE
1836 .PP
1837 The expression says "let the 13th octet of a TCP datagram have
1838 the decimal value 2", which is exactly what we want.
1839 .PP
1840 Now, let's assume that we need to capture SYN packets, but we
1841 don't care if ACK or any other TCP control bit is set at the
1842 same time.
1843 Let's see what happens to octet 13 when a TCP datagram
1844 with SYN-ACK set arrives:
1845 .PP
1846 .nf
1847 |C|E|U|A|P|R|S|F|
1848 |---------------|
1849 |0 0 0 1 0 0 1 0|
1850 |---------------|
1851 |7 6 5 4 3 2 1 0|
1852 .fi
1853 .PP
1854 Now bits 1 and 4 are set in the 13th octet.
1855 The binary value of
1856 octet 13 is
1857 .IP
1858 00010010
1859 .PP
1860 which translates to decimal
1861 .PP
1862 .nf
1863 7 6 5 4 3 2 1 0
1864 0*2 + 0*2 + 0*2 + 1*2 + 0*2 + 0*2 + 1*2 + 0*2 = 18
1865 .fi
1866 .PP
1867 Now we can't just use 'tcp[13] == 18' in the \fItcpdump\fP filter
1868 expression, because that would select only those packets that have
1869 SYN-ACK set, but not those with only SYN set.
1870 Remember that we don't care
1871 if ACK or any other control bit is set as long as SYN is set.
1872 .PP
1873 In order to achieve our goal, we need to logically AND the
1874 binary value of octet 13 with some other value to preserve
1875 the SYN bit.
1876 We know that we want SYN to be set in any case,
1877 so we'll logically AND the value in the 13th octet with
1878 the binary value of a SYN:
1879 .PP
1880 .nf
1881
1882 00010010 SYN-ACK 00000010 SYN
1883 AND 00000010 (we want SYN) AND 00000010 (we want SYN)
1884 -------- --------
1885 = 00000010 = 00000010
1886 .fi
1887 .PP
1888 We see that this AND operation delivers the same result
1889 regardless whether ACK or another TCP control bit is set.
1890 The decimal representation of the AND value as well as
1891 the result of this operation is 2 (binary 00000010),
1892 so we know that for packets with SYN set the following
1893 relation must hold true:
1894 .IP
1895 ( ( value of octet 13 ) AND ( 2 ) ) == ( 2 )
1896 .PP
1897 This points us to the \fItcpdump\fP filter expression
1898 .RS
1899 .B
1900 tcpdump -i xl0 'tcp[13] & 2 == 2'
1901 .RE
1902 .PP
1903 Note that you should use single quotes or a backslash
1904 in the expression to hide the AND ('&') special character
1905 from the shell.
1906 .HD
1907 .B
1908 UDP Packets
1909 .LP
1910 UDP format is illustrated by this rwho packet:
1911 .RS
1912 .nf
1913 .sp .5
1914 \f(CWactinide.who > broadcast.who: udp 84\fP
1915 .sp .5
1916 .fi
1917 .RE
1918 This says that port \fIwho\fP on host \fIactinide\fP sent a udp
1919 datagram to port \fIwho\fP on host \fIbroadcast\fP, the Internet
1920 broadcast address.
1921 The packet contained 84 bytes of user data.
1922 .LP
1923 Some UDP services are recognized (from the source or destination
1924 port number) and the higher level protocol information printed.
1925 In particular, Domain Name service requests (RFC-1034/1035) and Sun
1926 RPC calls (RFC-1050) to NFS.
1927 .HD
1928 UDP Name Server Requests
1929 .LP
1930 \fI(N.B.:The following description assumes familiarity with
1931 the Domain Service protocol described in RFC-1035.
1932 If you are not familiar
1933 with the protocol, the following description will appear to be written
1934 in greek.)\fP
1935 .LP
1936 Name server requests are formatted as
1937 .RS
1938 .nf
1939 .sp .5
1940 \fIsrc > dst: id op? flags qtype qclass name (len)\fP
1941 .sp .5
1942 \f(CWh2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)\fR
1943 .sp .5
1944 .fi
1945 .RE
1946 Host \fIh2opolo\fP asked the domain server on \fIhelios\fP for an
1947 address record (qtype=A) associated with the name \fIucbvax.berkeley.edu.\fP
1948 The query id was `3'.
1949 The `+' indicates the \fIrecursion desired\fP flag
1950 was set.
1951 The query length was 37 bytes, not including the UDP and
1952 IP protocol headers.
1953 The query operation was the normal one, \fIQuery\fP,
1954 so the op field was omitted.
1955 If the op had been anything else, it would
1956 have been printed between the `3' and the `+'.
1957 Similarly, the qclass was the normal one,
1958 \fIC_IN\fP, and omitted.
1959 Any other qclass would have been printed
1960 immediately after the `A'.
1961 .LP
1962 A few anomalies are checked and may result in extra fields enclosed in
1963 square brackets: If a query contains an answer, authority records or
1964 additional records section,
1965 .IR ancount ,
1966 .IR nscount ,
1967 or
1968 .I arcount
1969 are printed as `[\fIn\fPa]', `[\fIn\fPn]' or `[\fIn\fPau]' where \fIn\fP
1970 is the appropriate count.
1971 If any of the response bits are set (AA, RA or rcode) or any of the
1972 `must be zero' bits are set in bytes two and three, `[b2&3=\fIx\fP]'
1973 is printed, where \fIx\fP is the hex value of header bytes two and three.
1974 .HD
1975 UDP Name Server Responses
1976 .LP
1977 Name server responses are formatted as
1978 .RS
1979 .nf
1980 .sp .5
1981 \fIsrc > dst: id op rcode flags a/n/au type class data (len)\fP
1982 .sp .5
1983 \f(CWhelios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)
1984 helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)\fR
1985 .sp .5
1986 .fi
1987 .RE
1988 In the first example, \fIhelios\fP responds to query id 3 from \fIh2opolo\fP
1989 with 3 answer records, 3 name server records and 7 additional records.
1990 The first answer record is type A (address) and its data is internet
1991 address 128.32.137.3.
1992 The total size of the response was 273 bytes,
1993 excluding UDP and IP headers.
1994 The op (Query) and response code
1995 (NoError) were omitted, as was the class (C_IN) of the A record.
1996 .LP
1997 In the second example, \fIhelios\fP responds to query 2 with a
1998 response code of non-existent domain (NXDomain) with no answers,
1999 one name server and no authority records.
2000 The `*' indicates that
2001 the \fIauthoritative answer\fP bit was set.
2002 Since there were no
2003 answers, no type, class or data were printed.
2004 .LP
2005 Other flag characters that might appear are `\-' (recursion available,
2006 RA, \fInot\fP set) and `|' (truncated message, TC, set).
2007 If the
2008 `question' section doesn't contain exactly one entry, `[\fIn\fPq]'
2009 is printed.
2010 .LP
2011 Note that name server requests and responses tend to be large and the
2012 default \fIsnaplen\fP of 68 bytes may not capture enough of the packet
2013 to print.
2014 Use the \fB\-s\fP flag to increase the snaplen if you
2015 need to seriously investigate name server traffic.
2016 `\fB\-s 128\fP'
2017 has worked well for me.
2018
2019 .HD
2020 SMB/CIFS decoding
2021 .LP
2022 \fItcpdump\fP now includes fairly extensive SMB/CIFS/NBT decoding for data
2023 on UDP/137, UDP/138 and TCP/139.
2024 Some primitive decoding of IPX and
2025 NetBEUI SMB data is also done.
2026
2027 By default a fairly minimal decode is done, with a much more detailed
2028 decode done if -v is used.
2029 Be warned that with -v a single SMB packet
2030 may take up a page or more, so only use -v if you really want all the
2031 gory details.
2032
2033 For information on SMB packet formats and what all te fields mean see
2034 www.cifs.org or the pub/samba/specs/ directory on your favorite
2035 samba.org mirror site.
2036 The SMB patches were written by Andrew Tridgell
2037 (tridge@samba.org).
2038
2039 .HD
2040 NFS Requests and Replies
2041 .LP
2042 Sun NFS (Network File System) requests and replies are printed as:
2043 .RS
2044 .nf
2045 .sp .5
2046 \fIsrc.xid > dst.nfs: len op args\fP
2047 \fIsrc.nfs > dst.xid: reply stat len op results\fP
2048 .sp .5
2049 \f(CW
2050 sushi.6709 > wrl.nfs: 112 readlink fh 21,24/10.73165
2051 wrl.nfs > sushi.6709: reply ok 40 readlink "../var"
2052 sushi.201b > wrl.nfs:
2053 144 lookup fh 9,74/4096.6878 "xcolors"
2054 wrl.nfs > sushi.201b:
2055 reply ok 128 lookup fh 9,74/4134.3150
2056 \fR
2057 .sp .5
2058 .fi
2059 .RE
2060 In the first line, host \fIsushi\fP sends a transaction with id \fI6709\fP
2061 to \fIwrl\fP (note that the number following the src host is a
2062 transaction id, \fInot\fP the source port).
2063 The request was 112 bytes,
2064 excluding the UDP and IP headers.
2065 The operation was a \fIreadlink\fP
2066 (read symbolic link) on file handle (\fIfh\fP) 21,24/10.731657119.
2067 (If one is lucky, as in this case, the file handle can be interpreted
2068 as a major,minor device number pair, followed by the inode number and
2069 generation number.)
2070 \fIWrl\fP replies `ok' with the contents of the link.
2071 .LP
2072 In the third line, \fIsushi\fP asks \fIwrl\fP to lookup the name
2073 `\fIxcolors\fP' in directory file 9,74/4096.6878.
2074 Note that the data printed
2075 depends on the operation type.
2076 The format is intended to be self
2077 explanatory if read in conjunction with
2078 an NFS protocol spec.
2079 .LP
2080 If the \-v (verbose) flag is given, additional information is printed.
2081 For example:
2082 .RS
2083 .nf
2084 .sp .5
2085 \f(CW
2086 sushi.1372a > wrl.nfs:
2087 148 read fh 21,11/12.195 8192 bytes @ 24576
2088 wrl.nfs > sushi.1372a:
2089 reply ok 1472 read REG 100664 ids 417/0 sz 29388
2090 \fP
2091 .sp .5
2092 .fi
2093 .RE
2094 (\-v also prints the IP header TTL, ID, length, and fragmentation fields,
2095 which have been omitted from this example.) In the first line,
2096 \fIsushi\fP asks \fIwrl\fP to read 8192 bytes from file 21,11/12.195,
2097 at byte offset 24576.
2098 \fIWrl\fP replies `ok'; the packet shown on the
2099 second line is the first fragment of the reply, and hence is only 1472
2100 bytes long (the other bytes will follow in subsequent fragments, but
2101 these fragments do not have NFS or even UDP headers and so might not be
2102 printed, depending on the filter expression used).
2103 Because the \-v flag
2104 is given, some of the file attributes (which are returned in addition
2105 to the file data) are printed: the file type (``REG'', for regular file),
2106 the file mode (in octal), the uid and gid, and the file size.
2107 .LP
2108 If the \-v flag is given more than once, even more details are printed.
2109 .LP
2110 Note that NFS requests are very large and much of the detail won't be printed
2111 unless \fIsnaplen\fP is increased.
2112 Try using `\fB\-s 192\fP' to watch
2113 NFS traffic.
2114 .LP
2115 NFS reply packets do not explicitly identify the RPC operation.
2116 Instead,
2117 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
2118 replies using the transaction ID.
2119 If a reply does not closely follow the
2120 corresponding request, it might not be parsable.
2121 .HD
2122 AFS Requests and Replies
2123 .LP
2124 Transarc AFS (Andrew File System) requests and replies are printed
2125 as:
2126 .HD
2127 .RS
2128 .nf
2129 .sp .5
2130 \fIsrc.sport > dst.dport: rx packet-type\fP
2131 \fIsrc.sport > dst.dport: rx packet-type service call call-name args\fP
2132 \fIsrc.sport > dst.dport: rx packet-type service reply call-name args\fP
2133 .sp .5
2134 \f(CW
2135 elvis.7001 > pike.afsfs:
2136 rx data fs call rename old fid 536876964/1/1 ".newsrc.new"
2137 new fid 536876964/1/1 ".newsrc"
2138 pike.afsfs > elvis.7001: rx data fs reply rename
2139 \fR
2140 .sp .5
2141 .fi
2142 .RE
2143 In the first line, host elvis sends a RX packet to pike.
2144 This was
2145 a RX data packet to the fs (fileserver) service, and is the start of
2146 an RPC call.
2147 The RPC call was a rename, with the old directory file id
2148 of 536876964/1/1 and an old filename of `.newsrc.new', and a new directory
2149 file id of 536876964/1/1 and a new filename of `.newsrc'.
2150 The host pike
2151 responds with a RPC reply to the rename call (which was successful, because
2152 it was a data packet and not an abort packet).
2153 .LP
2154 In general, all AFS RPCs are decoded at least by RPC call name.
2155 Most
2156 AFS RPCs have at least some of the arguments decoded (generally only
2157 the `interesting' arguments, for some definition of interesting).
2158 .LP
2159 The format is intended to be self-describing, but it will probably
2160 not be useful to people who are not familiar with the workings of
2161 AFS and RX.
2162 .LP
2163 If the -v (verbose) flag is given twice, acknowledgement packets and
2164 additional header information is printed, such as the the RX call ID,
2165 call number, sequence number, serial number, and the RX packet flags.
2166 .LP
2167 If the -v flag is given twice, additional information is printed,
2168 such as the the RX call ID, serial number, and the RX packet flags.
2169 The MTU negotiation information is also printed from RX ack packets.
2170 .LP
2171 If the -v flag is given three times, the security index and service id
2172 are printed.
2173 .LP
2174 Error codes are printed for abort packets, with the exception of Ubik
2175 beacon packets (because abort packets are used to signify a yes vote
2176 for the Ubik protocol).
2177 .LP
2178 Note that AFS requests are very large and many of the arguments won't
2179 be printed unless \fIsnaplen\fP is increased.
2180 Try using `\fB-s 256\fP'
2181 to watch AFS traffic.
2182 .LP
2183 AFS reply packets do not explicitly identify the RPC operation.
2184 Instead,
2185 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
2186 replies using the call number and service ID.
2187 If a reply does not closely
2188 follow the
2189 corresponding request, it might not be parsable.
2190
2191 .HD
2192 KIP AppleTalk (DDP in UDP)
2193 .LP
2194 AppleTalk DDP packets encapsulated in UDP datagrams are de-encapsulated
2195 and dumped as DDP packets (i.e., all the UDP header information is
2196 discarded).
2197 The file
2198 .I /etc/atalk.names
2199 is used to translate AppleTalk net and node numbers to names.
2200 Lines in this file have the form
2201 .RS
2202 .nf
2203 .sp .5
2204 \fInumber name\fP
2205
2206 \f(CW1.254 ether
2207 16.1 icsd-net
2208 1.254.110 ace\fR
2209 .sp .5
2210 .fi
2211 .RE
2212 The first two lines give the names of AppleTalk networks.
2213 The third
2214 line gives the name of a particular host (a host is distinguished
2215 from a net by the 3rd octet in the number \-
2216 a net number \fImust\fP have two octets and a host number \fImust\fP
2217 have three octets.) The number and name should be separated by
2218 whitespace (blanks or tabs).
2219 The
2220 .I /etc/atalk.names
2221 file may contain blank lines or comment lines (lines starting with
2222 a `#').
2223 .LP
2224 AppleTalk addresses are printed in the form
2225 .RS
2226 .nf
2227 .sp .5
2228 \fInet.host.port\fP
2229
2230 \f(CW144.1.209.2 > icsd-net.112.220
2231 office.2 > icsd-net.112.220
2232 jssmag.149.235 > icsd-net.2\fR
2233 .sp .5
2234 .fi
2235 .RE
2236 (If the
2237 .I /etc/atalk.names
2238 doesn't exist or doesn't contain an entry for some AppleTalk
2239 host/net number, addresses are printed in numeric form.)
2240 In the first example, NBP (DDP port 2) on net 144.1 node 209
2241 is sending to whatever is listening on port 220 of net icsd node 112.
2242 The second line is the same except the full name of the source node
2243 is known (`office').
2244 The third line is a send from port 235 on
2245 net jssmag node 149 to broadcast on the icsd-net NBP port (note that
2246 the broadcast address (255) is indicated by a net name with no host
2247 number \- for this reason it's a good idea to keep node names and
2248 net names distinct in /etc/atalk.names).
2249 .LP
2250 NBP (name binding protocol) and ATP (AppleTalk transaction protocol)
2251 packets have their contents interpreted.
2252 Other protocols just dump
2253 the protocol name (or number if no name is registered for the
2254 protocol) and packet size.
2255
2256 \fBNBP packets\fP are formatted like the following examples:
2257 .RS
2258 .nf
2259 .sp .5
2260 \s-2\f(CWicsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*"
2261 jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250
2262 techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186\fR\s+2
2263 .sp .5
2264 .fi
2265 .RE
2266 The first line is a name lookup request for laserwriters sent by net icsd host
2267 112 and broadcast on net jssmag.
2268 The nbp id for the lookup is 190.
2269 The second line shows a reply for this request (note that it has the
2270 same id) from host jssmag.209 saying that it has a laserwriter
2271 resource named "RM1140" registered on port 250.
2272 The third line is
2273 another reply to the same request saying host techpit has laserwriter
2274 "techpit" registered on port 186.
2275
2276 \fBATP packet\fP formatting is demonstrated by the following example:
2277 .RS
2278 .nf
2279 .sp .5
2280 \s-2\f(CWjssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001
2281 helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000
2282 helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000
2283 helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000
2284 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
2285 helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000
2286 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
2287 helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000
2288 helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000
2289 jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001
2290 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
2291 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
2292 jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001
2293 jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002\fR\s+2
2294 .sp .5
2295 .fi
2296 .RE
2297 Jssmag.209 initiates transaction id 12266 with host helios by requesting
2298 up to 8 packets (the `<0-7>').
2299 The hex number at the end of the line
2300 is the value of the `userdata' field in the request.
2301 .LP
2302 Helios responds with 8 512-byte packets.
2303 The `:digit' following the
2304 transaction id gives the packet sequence number in the transaction
2305 and the number in parens is the amount of data in the packet,
2306 excluding the atp header.
2307 The `*' on packet 7 indicates that the
2308 EOM bit was set.
2309 .LP
2310 Jssmag.209 then requests that packets 3 & 5 be retransmitted.
2311 Helios
2312 resends them then jssmag.209 releases the transaction.
2313 Finally,
2314 jssmag.209 initiates the next request.
2315 The `*' on the request
2316 indicates that XO (`exactly once') was \fInot\fP set.
2317
2318 .HD
2319 IP Fragmentation
2320 .LP
2321 Fragmented Internet datagrams are printed as
2322 .RS
2323 .nf
2324 .sp .5
2325 \fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB+)\fR
2326 \fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB)\fR
2327 .sp .5
2328 .fi
2329 .RE
2330 (The first form indicates there are more fragments.
2331 The second
2332 indicates this is the last fragment.)
2333 .LP
2334 \fIId\fP is the fragment id.
2335 \fISize\fP is the fragment
2336 size (in bytes) excluding the IP header.
2337 \fIOffset\fP is this
2338 fragment's offset (in bytes) in the original datagram.
2339 .LP
2340 The fragment information is output for each fragment.
2341 The first
2342 fragment contains the higher level protocol header and the frag
2343 info is printed after the protocol info.
2344 Fragments
2345 after the first contain no higher level protocol header and the
2346 frag info is printed after the source and destination addresses.
2347 For example, here is part of an ftp from arizona.edu to lbl-rtsg.arpa
2348 over a CSNET connection that doesn't appear to handle 576 byte datagrams:
2349 .RS
2350 .nf
2351 .sp .5
2352 \s-2\f(CWarizona.ftp-data > rtsg.1170: . 1024:1332(308) ack 1 win 4096 (frag 595a:328@0+)
2353 arizona > rtsg: (frag 595a:204@328)
2354 rtsg.1170 > arizona.ftp-data: . ack 1536 win 2560\fP\s+2
2355 .sp .5
2356 .fi
2357 .RE
2358 There are a couple of things to note here: First, addresses in the
2359 2nd line don't include port numbers.
2360 This is because the TCP
2361 protocol information is all in the first fragment and we have no idea
2362 what the port or sequence numbers are when we print the later fragments.
2363 Second, the tcp sequence information in the first line is printed as if there
2364 were 308 bytes of user data when, in fact, there are 512 bytes (308 in
2365 the first frag and 204 in the second).
2366 If you are looking for holes
2367 in the sequence space or trying to match up acks
2368 with packets, this can fool you.
2369 .LP
2370 A packet with the IP \fIdon't fragment\fP flag is marked with a
2371 trailing \fB(DF)\fP.
2372 .HD
2373 Timestamps
2374 .LP
2375 By default, all output lines are preceded by a timestamp.
2376 The timestamp
2377 is the current clock time in the form
2378 .RS
2379 .nf
2380 \fIhh:mm:ss.frac\fP
2381 .fi
2382 .RE
2383 and is as accurate as the kernel's clock.
2384 The timestamp reflects the time the kernel first saw the packet.
2385 No attempt
2386 is made to account for the time lag between when the
2387 Ethernet interface removed the packet from the wire and when the kernel
2388 serviced the `new packet' interrupt.
2389 .SH "SEE ALSO"
2390 stty(1), pcap(3), bpf(4), nit(4P), pfconfig(8)
2391 .SH AUTHORS
2392 The original authors are:
2393 .LP
2394 Van Jacobson,
2395 Craig Leres and
2396 Steven McCanne, all of the
2397 Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
2398 .LP
2399 It is currently being maintained by tcpdump.org.
2400 .LP
2401 The current version is available via http:
2402 .LP
2403 .RS
2404 .I http://www.tcpdump.org/
2405 .RE
2406 .LP
2407 The original distribution is available via anonymous ftp:
2408 .LP
2409 .RS
2410 .I ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
2411 .RE
2412 .LP
2413 IPv6/IPsec support is added by WIDE/KAME project.
2414 This program uses Eric Young's SSLeay library, under specific configuration.
2415 .SH BUGS
2416 Please send problems, bugs, questions, desirable enhancements, etc. to:
2417 .LP
2418 .RS
2419 tcpdump-workers@tcpdump.org
2420 .RE
2421 .LP
2422 Please send source code contributions, etc. to:
2423 .LP
2424 .RS
2425 patches@tcpdump.org
2426 .RE
2427 .LP
2428 NIT doesn't let you watch your own outbound traffic, BPF will.
2429 We recommend that you use the latter.
2430 .LP
2431 On Linux systems with 2.0[.x] kernels:
2432 .IP
2433 packets on the loopback device will be seen twice;
2434 .IP
2435 packet filtering cannot be done in the kernel, so that all packets must
2436 be copied from the kernel in order to be filtered in user mode;
2437 .IP
2438 all of a packet, not just the part that's within the snapshot length,
2439 will be copied from the kernel (the 2.0[.x] packet capture mechanism, if
2440 asked to copy only part of a packet to userland, will not report the
2441 true length of the packet; this would cause most IP packets to get an
2442 error from
2443 .BR tcpdump );
2444 .IP
2445 capturing on some PPP devices won't work correctly.
2446 .LP
2447 We recommend that you upgrade to a 2.2 or later kernel.
2448 .LP
2449 Some attempt should be made to reassemble IP fragments or, at least
2450 to compute the right length for the higher level protocol.
2451 .LP
2452 Name server inverse queries are not dumped correctly: the (empty)
2453 question section is printed rather than real query in the answer
2454 section.
2455 Some believe that inverse queries are themselves a bug and
2456 prefer to fix the program generating them rather than \fItcpdump\fP.
2457 .LP
2458 A packet trace that crosses a daylight savings time change will give
2459 skewed time stamps (the time change is ignored).
2460 .LP
2461 Filter expressions on fields other than those in Token Ring headers will
2462 not correctly handle source-routed Token Ring packets.
2463 .LP
2464 Filter expressions on fields other than those in 802.11 headers will not
2465 correctly handle 802.11 data packets with both To DS and From DS set.
2466 .LP
2467 .BR "ip6 proto"
2468 should chase header chain, but at this moment it does not.
2469 .BR "ip6 protochain"
2470 is supplied for this behavior.
2471 .LP
2472 Arithmetic expression against transport layer headers, like \fBtcp[0]\fP,
2473 does not work against IPv6 packets.
2474 It only looks at IPv4 packets.