]> The Tcpdump Group git mirrors - tcpdump/blob - tcpdump.1
updated test cases for fixed msgid/cookie printing for IKEv2.
[tcpdump] / tcpdump.1
1 .\" @(#) $Header: /tcpdump/master/tcpdump/Attic/tcpdump.1,v 1.187 2007-11-18 02:47:24 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 "17 November 2007"
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 .BR "src or dst" ,
689 .BR "src and dst" ,
690 .BR addr1 ,
691 .BR addr2 ,
692 .BR addr3 ,
693 and
694 .BR addr4 .
695 E.g., `src foo', `dst net 128.3', `src or dst port ftp-data'.
696 If
697 there is no dir qualifier,
698 .B "src or dst"
699 is assumed.
700 The
701 .BR addr1 ,
702 .BR addr2 ,
703 .BR addr3 ,
704 and
705 .B addr4
706 qualifiers are only valid for IEEE 802.11 Wireless LAN link layers.
707 For some link layers, such as SLIP and the ``cooked'' Linux capture mode
708 used for the ``any'' device and for some other device types, the
709 .B inbound
710 and
711 .B outbound
712 qualifiers can be used to specify a desired direction.
713 .IP \fIproto\fP
714 qualifiers restrict the match to a particular protocol.
715 Possible
716 protos are:
717 .BR ether ,
718 .BR fddi ,
719 .BR tr ,
720 .BR wlan ,
721 .BR ip ,
722 .BR ip6 ,
723 .BR arp ,
724 .BR rarp ,
725 .BR decnet ,
726 .B tcp
727 and
728 .BR udp .
729 E.g., `ether src foo', `arp net 128.3', `tcp port 21', `udp portrange
730 7000-7009', `wlan addr2 0:2:3:4:5:6'.
731 If there is
732 no proto qualifier, all protocols consistent with the type are
733 assumed.
734 E.g., `src foo' means `(ip or arp or rarp) src foo'
735 (except the latter is not legal syntax), `net bar' means `(ip or
736 arp or rarp) net bar' and `port 53' means `(tcp or udp) port 53'.
737 .LP
738 [`fddi' is actually an alias for `ether'; the parser treats them
739 identically as meaning ``the data link level used on the specified
740 network interface.'' FDDI headers contain Ethernet-like source
741 and destination addresses, and often contain Ethernet-like packet
742 types, so you can filter on these FDDI fields just as with the
743 analogous Ethernet fields.
744 FDDI headers also contain other fields,
745 but you cannot name them explicitly in a filter expression.
746 .LP
747 Similarly, `tr' and `wlan' are aliases for `ether'; the previous
748 paragraph's statements about FDDI headers also apply to Token Ring
749 and 802.11 wireless LAN headers. For 802.11 headers, the destination
750 address is the DA field and the source address is the SA field; the
751 BSSID, RA, and TA fields aren't tested.]
752 .LP
753 In addition to the above, there are some special `primitive' keywords
754 that don't follow the pattern:
755 .BR gateway ,
756 .BR broadcast ,
757 .BR less ,
758 .B greater
759 and arithmetic expressions.
760 All of these are described below.
761 .LP
762 More complex filter expressions are built up by using the words
763 .BR and ,
764 .B or
765 and
766 .B not
767 to combine primitives.
768 E.g., `host foo and not port ftp and not port ftp-data'.
769 To save typing, identical qualifier lists can be omitted.
770 E.g.,
771 `tcp dst port ftp or ftp-data or domain' is exactly the same as
772 `tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain'.
773 .LP
774 Allowable primitives are:
775 .IP "\fBdst host \fIhost\fR"
776 True if the IPv4/v6 destination field of the packet is \fIhost\fP,
777 which may be either an address or a name.
778 .IP "\fBsrc host \fIhost\fR"
779 True if the IPv4/v6 source field of the packet is \fIhost\fP.
780 .IP "\fBhost \fIhost\fP
781 True if either the IPv4/v6 source or destination of the packet is \fIhost\fP.
782 .IP
783 Any of the above host expressions can be prepended with the keywords,
784 \fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
785 .in +.5i
786 .nf
787 \fBip host \fIhost\fR
788 .fi
789 .in -.5i
790 which is equivalent to:
791 .in +.5i
792 .nf
793 \fBether proto \fI\\ip\fB and host \fIhost\fR
794 .fi
795 .in -.5i
796 If \fIhost\fR is a name with multiple IP addresses, each address will
797 be checked for a match.
798 .IP "\fBether dst \fIehost\fP
799 True if the Ethernet destination address is \fIehost\fP.
800 \fIEhost\fP
801 may be either a name from /etc/ethers or a number (see
802 .IR ethers (3N)
803 for numeric format).
804 .IP "\fBether src \fIehost\fP
805 True if the Ethernet source address is \fIehost\fP.
806 .IP "\fBether host \fIehost\fP
807 True if either the Ethernet source or destination address is \fIehost\fP.
808 .IP "\fBgateway\fP \fIhost\fP
809 True if the packet used \fIhost\fP as a gateway.
810 I.e., the Ethernet
811 source or destination address was \fIhost\fP but neither the IP source
812 nor the IP destination was \fIhost\fP.
813 \fIHost\fP must be a name and
814 must be found both by the machine's host-name-to-IP-address resolution
815 mechanisms (host name file, DNS, NIS, etc.) and by the machine's
816 host-name-to-Ethernet-address resolution mechanism (/etc/ethers, etc.).
817 (An equivalent expression is
818 .in +.5i
819 .nf
820 \fBether host \fIehost \fBand not host \fIhost\fR
821 .fi
822 .in -.5i
823 which can be used with either names or numbers for \fIhost / ehost\fP.)
824 This syntax does not work in IPv6-enabled configuration at this moment.
825 .IP "\fBdst net \fInet\fR"
826 True if the IPv4/v6 destination address of the packet has a network
827 number of \fInet\fP.
828 \fINet\fP may be either a name from the networks database
829 (/etc/networks, etc.) or a network number.
830 An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0),
831 dotted triple (e.g., 192.168.1), dotted pair (e.g, 172.16), or single
832 number (e.g., 10); the netmask is 255.255.255.255 for a dotted quad
833 (which means that it's really a host match), 255.255.255.0 for a dotted
834 triple, 255.255.0.0 for a dotted pair, or 255.0.0.0 for a single number.
835 An IPv6 network number must be written out fully; the netmask is
836 ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always
837 host matches, and a network match requires a netmask length.
838 .IP "\fBsrc net \fInet\fR"
839 True if the IPv4/v6 source address of the packet has a network
840 number of \fInet\fP.
841 .IP "\fBnet \fInet\fR"
842 True if either the IPv4/v6 source or destination address of the packet has a network
843 number of \fInet\fP.
844 .IP "\fBnet \fInet\fR \fBmask \fInetmask\fR"
845 True if the IPv4 address matches \fInet\fR with the specific \fInetmask\fR.
846 May be qualified with \fBsrc\fR or \fBdst\fR.
847 Note that this syntax is not valid for IPv6 \fInet\fR.
848 .IP "\fBnet \fInet\fR/\fIlen\fR"
849 True if the IPv4/v6 address matches \fInet\fR with a netmask \fIlen\fR
850 bits wide.
851 May be qualified with \fBsrc\fR or \fBdst\fR.
852 .IP "\fBdst port \fIport\fR"
853 True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
854 destination port value of \fIport\fP.
855 The \fIport\fP can be a number or a name used in /etc/services (see
856 .IR tcp (4P)
857 and
858 .IR udp (4P)).
859 If a name is used, both the port
860 number and protocol are checked.
861 If a number or ambiguous name is used,
862 only the port number is checked (e.g., \fBdst port 513\fR will print both
863 tcp/login traffic and udp/who traffic, and \fBport domain\fR will print
864 both tcp/domain and udp/domain traffic).
865 .IP "\fBsrc port \fIport\fR"
866 True if the packet has a source port value of \fIport\fP.
867 .IP "\fBport \fIport\fR"
868 True if either the source or destination port of the packet is \fIport\fP.
869 .IP "\fBdst portrange \fIport1\fB-\fIport2\fR"
870 True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
871 destination port value between \fIport1\fP and \fIport2\fP.
872 .I port1
873 and
874 .I port2
875 are interpreted in the same fashion as the
876 .I port
877 parameter for
878 .BR port .
879 .IP "\fBsrc portrange \fIport1\fB-\fIport2\fR"
880 True if the packet has a source port value between \fIport1\fP and
881 \fIport2\fP.
882 .IP "\fBportrange \fIport1\fB-\fIport2\fR"
883 True if either the source or destination port of the packet is between
884 \fIport1\fP and \fIport2\fP.
885 .IP
886 Any of the above port or port range expressions can be prepended with
887 the keywords, \fBtcp\fP or \fBudp\fP, as in:
888 .in +.5i
889 .nf
890 \fBtcp src port \fIport\fR
891 .fi
892 .in -.5i
893 which matches only tcp packets whose source port is \fIport\fP.
894 .IP "\fBless \fIlength\fR"
895 True if the packet has a length less than or equal to \fIlength\fP.
896 This is equivalent to:
897 .in +.5i
898 .nf
899 \fBlen <= \fIlength\fP.
900 .fi
901 .in -.5i
902 .IP "\fBgreater \fIlength\fR"
903 True if the packet has a length greater than or equal to \fIlength\fP.
904 This is equivalent to:
905 .in +.5i
906 .nf
907 \fBlen >= \fIlength\fP.
908 .fi
909 .in -.5i
910 .IP "\fBip proto \fIprotocol\fR"
911 True if the packet is an IPv4 packet (see
912 .IR ip (4P))
913 of protocol type \fIprotocol\fP.
914 \fIProtocol\fP can be a number or one of the names
915 \fBicmp\fP, \fBicmp6\fP, \fBigmp\fP, \fBigrp\fP, \fBpim\fP, \fBah\fP,
916 \fBesp\fP, \fBvrrp\fP, \fBudp\fP, or \fBtcp\fP.
917 Note that the identifiers \fBtcp\fP, \fBudp\fP, and \fBicmp\fP are also
918 keywords and must be escaped via backslash (\\), which is \\\\ in the C-shell.
919 Note that this primitive does not chase the protocol header chain.
920 .IP "\fBip6 proto \fIprotocol\fR"
921 True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.
922 Note that this primitive does not chase the protocol header chain.
923 .IP "\fBip6 protochain \fIprotocol\fR"
924 True if the packet is IPv6 packet,
925 and contains protocol header with type \fIprotocol\fR
926 in its protocol header chain.
927 For example,
928 .in +.5i
929 .nf
930 \fBip6 protochain 6\fR
931 .fi
932 .in -.5i
933 matches any IPv6 packet with TCP protocol header in the protocol header chain.
934 The packet may contain, for example,
935 authentication header, routing header, or hop-by-hop option header,
936 between IPv6 header and TCP header.
937 The BPF code emitted by this primitive is complex and
938 cannot be optimized by BPF optimizer code in \fItcpdump\fP,
939 so this can be somewhat slow.
940 .IP "\fBip protochain \fIprotocol\fR"
941 Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
942 .IP "\fBether broadcast\fR"
943 True if the packet is an Ethernet broadcast packet.
944 The \fIether\fP
945 keyword is optional.
946 .IP "\fBip broadcast\fR"
947 True if the packet is an IPv4 broadcast packet.
948 It checks for both the all-zeroes and all-ones broadcast conventions,
949 and looks up the subnet mask on the interface on which the capture is
950 being done.
951 .IP
952 If the subnet mask of the interface on which the capture is being done
953 is not available, either because the interface on which capture is being
954 done has no netmask or because the capture is being done on the Linux
955 "any" interface, which can capture on more than one interface, this
956 check will not work correctly.
957 .IP "\fBether multicast\fR"
958 True if the packet is an Ethernet multicast packet.
959 The \fBether\fP
960 keyword is optional.
961 This is shorthand for `\fBether[0] & 1 != 0\fP'.
962 .IP "\fBip multicast\fR"
963 True if the packet is an IPv4 multicast packet.
964 .IP "\fBip6 multicast\fR"
965 True if the packet is an IPv6 multicast packet.
966 .IP "\fBether proto \fIprotocol\fR"
967 True if the packet is of ether type \fIprotocol\fR.
968 \fIProtocol\fP can be a number or one of the names
969 \fBip\fP, \fBip6\fP, \fBarp\fP, \fBrarp\fP, \fBatalk\fP, \fBaarp\fP,
970 \fBdecnet\fP, \fBsca\fP, \fBlat\fP, \fBmopdl\fP, \fBmoprc\fP,
971 \fBiso\fP, \fBstp\fP, \fBipx\fP, or \fBnetbeui\fP.
972 Note these identifiers are also keywords
973 and must be escaped via backslash (\\).
974 .IP
975 [In the case of FDDI (e.g., `\fBfddi protocol arp\fR'), Token Ring
976 (e.g., `\fBtr protocol arp\fR'), and IEEE 802.11 wireless LANS (e.g.,
977 `\fBwlan protocol arp\fR'), for most of those protocols, the
978 protocol identification comes from the 802.2 Logical Link Control (LLC)
979 header, which is usually layered on top of the FDDI, Token Ring, or
980 802.11 header.
981 .IP
982 When filtering for most protocol identifiers on FDDI, Token Ring, or
983 802.11, \fItcpdump\fR checks only the protocol ID field of an LLC header
984 in so-called SNAP format with an Organizational Unit Identifier (OUI) of
985 0x000000, for encapsulated Ethernet; it doesn't check whether the packet
986 is in SNAP format with an OUI of 0x000000.
987 The exceptions are:
988 .RS
989 .TP
990 \fBiso\fP
991 \fItcpdump\fR checks the DSAP (Destination Service Access Point) and
992 SSAP (Source Service Access Point) fields of the LLC header;
993 .TP
994 \fBstp\fP and \fBnetbeui\fP
995 \fItcpdump\fR checks the DSAP of the LLC header;
996 .TP
997 \fBatalk\fP
998 \fItcpdump\fR checks for a SNAP-format packet with an OUI of 0x080007
999 and the AppleTalk etype.
1000 .RE
1001 .IP
1002 In the case of Ethernet, \fItcpdump\fR checks the Ethernet type field
1003 for most of those protocols. The exceptions are:
1004 .RS
1005 .TP
1006 \fBiso\fP, \fBstp\fP, and \fBnetbeui\fP
1007 \fItcpdump\fR checks for an 802.3 frame and then checks the LLC header as
1008 it does for FDDI, Token Ring, and 802.11;
1009 .TP
1010 \fBatalk\fP
1011 \fItcpdump\fR checks both for the AppleTalk etype in an Ethernet frame and
1012 for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11;
1013 .TP
1014 \fBaarp\fP
1015 \fItcpdump\fR checks for the AppleTalk ARP etype in either an Ethernet
1016 frame or an 802.2 SNAP frame with an OUI of 0x000000;
1017 .TP
1018 \fBipx\fP
1019 \fItcpdump\fR checks for the IPX etype in an Ethernet frame, the IPX
1020 DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of
1021 IPX, and the IPX etype in a SNAP frame.
1022 .RE
1023 .IP "\fBdecnet src \fIhost\fR"
1024 True if the DECNET source address is
1025 .IR host ,
1026 which may be an address of the form ``10.123'', or a DECNET host
1027 name.
1028 [DECNET host name support is only available on ULTRIX systems
1029 that are configured to run DECNET.]
1030 .IP "\fBdecnet dst \fIhost\fR"
1031 True if the DECNET destination address is
1032 .IR host .
1033 .IP "\fBdecnet host \fIhost\fR"
1034 True if either the DECNET source or destination address is
1035 .IR host .
1036 .IP "\fBifname \fIinterface\fR"
1037 True if the packet was logged as coming from the specified interface (applies
1038 only to packets logged by OpenBSD's or FreeBSD's
1039 .BR pf (4)).
1040 .IP "\fBon \fIinterface\fR"
1041 Synonymous with the
1042 .B ifname
1043 modifier.
1044 .IP "\fBrnr \fInum\fR"
1045 True if the packet was logged as matching the specified PF rule number
1046 (applies only to packets logged by OpenBSD's or FreeBSD's
1047 .BR pf (4)).
1048 .IP "\fBrulenum \fInum\fR"
1049 Synonymous with the
1050 .B rnr
1051 modifier.
1052 .IP "\fBreason \fIcode\fR"
1053 True if the packet was logged with the specified PF reason code. The known
1054 codes are:
1055 .BR match ,
1056 .BR bad-offset ,
1057 .BR fragment ,
1058 .BR short ,
1059 .BR normalize ,
1060 and
1061 .B memory
1062 (applies only to packets logged by OpenBSD's or FreeBSD's
1063 .BR pf (4)).
1064 .IP "\fBrset \fIname\fR"
1065 True if the packet was logged as matching the specified PF ruleset
1066 name of an anchored ruleset (applies only to packets logged by OpenBSD's
1067 or FreeBSD's
1068 .BR pf (4)).
1069 .IP "\fBruleset \fIname\fR"
1070 Synonomous with the
1071 .B rset
1072 modifier.
1073 .IP "\fBsrnr \fInum\fR"
1074 True if the packet was logged as matching the specified PF rule number
1075 of an anchored ruleset (applies only to packets logged by OpenBSD's or
1076 FreeBSD's
1077 .BR pf (4)).
1078 .IP "\fBsubrulenum \fInum\fR"
1079 Synonomous with the
1080 .B srnr
1081 modifier.
1082 .IP "\fBaction \fIact\fR"
1083 True if PF took the specified action when the packet was logged. Known actions
1084 are:
1085 .B pass
1086 and
1087 .B block
1088 and, with later versions of
1089 .BR pf (4)),
1090 .BR nat ,
1091 .BR rdr ,
1092 .B binat
1093 and
1094 .B scrub
1095 (applies only to packets logged by OpenBSD's or FreeBSD's
1096 .BR pf (4)).
1097 .IP "\fBwlan addr1 \fIehost\fR"
1098 True if the first IEEE 802.11 address is
1099 .IR ehost .
1100 .IP "\fBwlan addr2 \fIehost\fR"
1101 True if the second IEEE 802.11 address, if present, is
1102 .IR ehost .
1103 The second address field is used in all frames except for CTS (Clear To
1104 Send) and ACK (Acknowledgment) control frames.
1105 .IP "\fBwlan addr3 \fIehost\fR"
1106 True if the third IEEE 802.11 address, if present, is
1107 .IR ehost .
1108 The third address field is used in management and data frames, but not
1109 in control frames.
1110 .IP "\fBwlan addr4 \fIehost\fR"
1111 True if the fourth IEEE 802.11 address, if present, is
1112 .IR ehost .
1113 The fourth address field is only used for
1114 WDS (Wireless Distribution System) frames.
1115 .IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fInetbeui\fP"
1116 Abbreviations for:
1117 .in +.5i
1118 .nf
1119 \fBether proto \fIp\fR
1120 .fi
1121 .in -.5i
1122 where \fIp\fR is one of the above protocols.
1123 .IP "\fBlat\fR, \fBmoprc\fR, \fBmopdl\fR"
1124 Abbreviations for:
1125 .in +.5i
1126 .nf
1127 \fBether proto \fIp\fR
1128 .fi
1129 .in -.5i
1130 where \fIp\fR is one of the above protocols.
1131 Note that
1132 \fItcpdump\fP does not currently know how to parse these protocols.
1133 .IP "\fBtype \fIwlan_type\fR"
1134 True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR.
1135 Valid \fIwlan_type\fRs are:
1136 \fBmgt\fP,
1137 \fBctl\fP
1138 and \fBdata\fP.
1139 .IP "\fBtype \fIwlan_type \fBsubtype \fIwlan_subtype\fR"
1140 True if the IEEE 802.11 frame type matches the specified \fIwlan_type\fR
1141 and frame subtype matches the specified \fIwlan_subtype\fR.
1142 .IP
1143 If the specified \fIwlan_type\fR is \fBmgt\fP,
1144 then valid \fIwlan_subtype\fRs are:
1145 \fBassoc-req\fP,
1146 \fBassoc-resp\fP,
1147 \fBreassoc-req\fP,
1148 \fBreassoc-resp\fP,
1149 \fBprobe-req\fP,
1150 \fBprobe-resp\fP,
1151 \fBbeacon\fP,
1152 \fBatim\fP,
1153 \fBdisassoc\fP,
1154 \fBauth\fP and
1155 \fBdeauth\fP.
1156 .IP
1157 If the specified \fIwlan_type\fR is \fBctl\fP,
1158 then valid \fIwlan_subtype\fRs are:
1159 \fBps-poll\fP,
1160 \fBrts\fP,
1161 \fBcts\fP,
1162 \fBack\fP,
1163 \fBcf-end\fP and
1164 \fBcf-end-ack\fP.
1165 .IP
1166 If the specified \fIwlan_type\fR is \fBdata\fP,
1167 then valid \fIwlan_subtype\fRs are:
1168 \fBdata\fP,
1169 \fBdata-cf-ack\fP,
1170 \fBdata-cf-poll\fP,
1171 \fBdata-cf-ack-poll\fP,
1172 \fBnull\fP,
1173 \fBcf-ack\fP,
1174 \fBcf-poll\fP,
1175 \fBcf-ack-poll\fP,
1176 \fBqos-data\fP,
1177 \fBqos-data-cf-ack\fP,
1178 \fBqos-data-cf-poll\fP,
1179 \fBqos-data-cf-ack-poll\fP,
1180 \fBqos\fP,
1181 \fBqos-cf-poll\fP and
1182 \fBqos-cf-ack-poll\fP.
1183 .IP "\fBsubtype \fIwlan_subtype\fR"
1184 True if the IEEE 802.11 frame subtype matches the specified \fIwlan_subtype\fR
1185 and frame has the type to which the specified \fIwlan_subtype\fR belongs.
1186 .IP "\fBdir \fIdir\fR"
1187 True if the IEEE 802.11 frame direction matches the specified
1188 .IR dir .
1189 Valid directions are:
1190 .BR nods ,
1191 .BR tods ,
1192 .BR fromds ,
1193 .BR dstods ,
1194 or a numeric value.
1195 .IP "\fBvlan \fI[vlan_id]\fR"
1196 True if the packet is an IEEE 802.1Q VLAN packet.
1197 If \fI[vlan_id]\fR is specified, only true if the packet has the specified
1198 \fIvlan_id\fR.
1199 Note that the first \fBvlan\fR keyword encountered in \fIexpression\fR
1200 changes the decoding offsets for the remainder of \fIexpression\fR on
1201 the assumption that the packet is a VLAN packet. The \fBvlan
1202 \fI[vlan_id]\fR expression may be used more than once, to filter on VLAN
1203 hierarchies. Each use of that expression increments the filter offsets
1204 by 4.
1205 .IP
1206 For example:
1207 .in +.5i
1208 .nf
1209 \fBvlan 100 && vlan 200\fR
1210 .fi
1211 .in -.5i
1212 filters on VLAN 200 encapsulated within VLAN 100, and
1213 .in +.5i
1214 .nf
1215 \fBvlan && vlan 300 && ip\fR
1216 .fi
1217 .in -.5i
1218 filters IPv4 protocols encapsulated in VLAN 300 encapsulated within any
1219 higher order VLAN.
1220 .IP "\fBmpls \fI[label_num]\fR"
1221 True if the packet is an MPLS packet.
1222 If \fI[label_num]\fR is specified, only true is the packet has the specified
1223 \fIlabel_num\fR.
1224 Note that the first \fBmpls\fR keyword encountered in \fIexpression\fR
1225 changes the decoding offsets for the remainder of \fIexpression\fR on
1226 the assumption that the packet is a MPLS-encapsulated IP packet. The
1227 \fBmpls \fI[label_num]\fR expression may be used more than once, to
1228 filter on MPLS hierarchies. Each use of that expression increments the
1229 filter offsets by 4.
1230 .IP
1231 For example:
1232 .in +.5i
1233 .nf
1234 \fBmpls 100000 && mpls 1024\fR
1235 .fi
1236 .in -.5i
1237 filters packets with an outer label of 100000 and an inner label of
1238 1024, and
1239 .in +.5i
1240 .nf
1241 \fBmpls && mpls 1024 && host 192.9.200.1\fR
1242 .fi
1243 .in -.5i
1244 filters packets to or from 192.9.200.1 with an inner label of 1024 and
1245 any outer label.
1246 .IP \fBpppoed\fP
1247 True if the packet is a PPP-over-Ethernet Discovery packet (Ethernet
1248 type 0x8863).
1249 .IP \fBpppoes\fP
1250 True if the packet is a PPP-over-Ethernet Session packet (Ethernet
1251 type 0x8864).
1252 Note that the first \fBpppoes\fR keyword encountered in \fIexpression\fR
1253 changes the decoding offsets for the remainder of \fIexpression\fR on
1254 the assumption that the packet is a PPPoE session packet.
1255 .IP
1256 For example:
1257 .in +.5i
1258 .nf
1259 \fBpppoes && ip\fR
1260 .fi
1261 .in -.5i
1262 filters IPv4 protocols encapsulated in PPPoE.
1263 .IP "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"
1264 Abbreviations for:
1265 .in +.5i
1266 .nf
1267 \fBip proto \fIp\fR\fB or ip6 proto \fIp\fR
1268 .fi
1269 .in -.5i
1270 where \fIp\fR is one of the above protocols.
1271 .IP "\fBiso proto \fIprotocol\fR"
1272 True if the packet is an OSI packet of protocol type \fIprotocol\fP.
1273 \fIProtocol\fP can be a number or one of the names
1274 \fBclnp\fP, \fBesis\fP, or \fBisis\fP.
1275 .IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"
1276 Abbreviations for:
1277 .in +.5i
1278 .nf
1279 \fBiso proto \fIp\fR
1280 .fi
1281 .in -.5i
1282 where \fIp\fR is one of the above protocols.
1283 .IP "\fBl1\fR, \fBl2\fR, \fBiih\fR, \fBlsp\fR, \fBsnp\fR, \fBcsnp\fR, \fBpsnp\fR"
1284 Abbreviations for IS-IS PDU types.
1285 .IP "\fBvpi\fP \fIn\fR
1286 True if the packet is an ATM packet, for SunATM on Solaris, with a
1287 virtual path identifier of
1288 .IR n .
1289 .IP "\fBvci\fP \fIn\fR
1290 True if the packet is an ATM packet, for SunATM on Solaris, with a
1291 virtual channel identifier of
1292 .IR n .
1293 .IP \fBlane\fP
1294 True if the packet is an ATM packet, for SunATM on Solaris, and is
1295 an ATM LANE packet.
1296 Note that the first \fBlane\fR keyword encountered in \fIexpression\fR
1297 changes the tests done in the remainder of \fIexpression\fR
1298 on the assumption that the packet is either a LANE emulated Ethernet
1299 packet or a LANE LE Control packet. If \fBlane\fR isn't specified, the
1300 tests are done under the assumption that the packet is an
1301 LLC-encapsulated packet.
1302 .IP \fBllc\fP
1303 True if the packet is an ATM packet, for SunATM on Solaris, and is
1304 an LLC-encapsulated packet.
1305 .IP \fBoamf4s\fP
1306 True if the packet is an ATM packet, for SunATM on Solaris, and is
1307 a segment OAM F4 flow cell (VPI=0 & VCI=3).
1308 .IP \fBoamf4e\fP
1309 True if the packet is an ATM packet, for SunATM on Solaris, and is
1310 an end-to-end OAM F4 flow cell (VPI=0 & VCI=4).
1311 .IP \fBoamf4\fP
1312 True if the packet is an ATM packet, for SunATM on Solaris, and is
1313 a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
1314 .IP \fBoam\fP
1315 True if the packet is an ATM packet, for SunATM on Solaris, and is
1316 a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
1317 .IP \fBmetac\fP
1318 True if the packet is an ATM packet, for SunATM on Solaris, and is
1319 on a meta signaling circuit (VPI=0 & VCI=1).
1320 .IP \fBbcc\fP
1321 True if the packet is an ATM packet, for SunATM on Solaris, and is
1322 on a broadcast signaling circuit (VPI=0 & VCI=2).
1323 .IP \fBsc\fP
1324 True if the packet is an ATM packet, for SunATM on Solaris, and is
1325 on a signaling circuit (VPI=0 & VCI=5).
1326 .IP \fBilmic\fP
1327 True if the packet is an ATM packet, for SunATM on Solaris, and is
1328 on an ILMI circuit (VPI=0 & VCI=16).
1329 .IP \fBconnectmsg\fP
1330 True if the packet is an ATM packet, for SunATM on Solaris, and is
1331 on a signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
1332 Connect Ack, Release, or Release Done message.
1333 .IP \fBmetaconnect\fP
1334 True if the packet is an ATM packet, for SunATM on Solaris, and is
1335 on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
1336 Release, or Release Done message.
1337 .IP "\fIexpr relop expr\fR"
1338 True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
1339 !=, and \fIexpr\fR is an arithmetic expression composed of integer
1340 constants (expressed in standard C syntax), the normal binary operators
1341 [+, -, *, /, &, |, <<, >>], a length operator, and special packet data
1342 accessors. Note that all comparisons are unsigned, so that, for example,
1343 0x80000000 and 0xffffffff are > 0.
1344 To access
1345 data inside the packet, use the following syntax:
1346 .in +.5i
1347 .nf
1348 \fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
1349 .fi
1350 .in -.5i
1351 \fIProto\fR is one of \fBether, fddi, tr, wlan, ppp, slip, link,
1352 ip, arp, rarp, tcp, udp, icmp, ip6\fR or \fBradio\fR, and
1353 indicates the protocol layer for the index operation.
1354 (\fBether, fddi, wlan, tr, ppp, slip\fR and \fBlink\fR all refer to the
1355 link layer. \fBradio\fR refers to the "radio header" added to some
1356 802.11 captures.)
1357 Note that \fItcp, udp\fR and other upper-layer protocol types only
1358 apply to IPv4, not IPv6 (this will be fixed in the future).
1359 The byte offset, relative to the indicated protocol layer, is
1360 given by \fIexpr\fR.
1361 \fISize\fR is optional and indicates the number of bytes in the
1362 field of interest; it can be either one, two, or four, and defaults to one.
1363 The length operator, indicated by the keyword \fBlen\fP, gives the
1364 length of the packet.
1365
1366 For example, `\fBether[0] & 1 != 0\fP' catches all multicast traffic.
1367 The expression `\fBip[0] & 0xf != 5\fP'
1368 catches all IPv4 packets with options.
1369 The expression
1370 `\fBip[6:2] & 0x1fff = 0\fP'
1371 catches only unfragmented IPv4 datagrams and frag zero of fragmented
1372 IPv4 datagrams.
1373 This check is implicitly applied to the \fBtcp\fP and \fBudp\fP
1374 index operations.
1375 For instance, \fBtcp[0]\fP always means the first
1376 byte of the TCP \fIheader\fP, and never means the first byte of an
1377 intervening fragment.
1378
1379 Some offsets and field values may be expressed as names rather than
1380 as numeric values.
1381 The following protocol header field offsets are
1382 available: \fBicmptype\fP (ICMP type field), \fBicmpcode\fP (ICMP
1383 code field), and \fBtcpflags\fP (TCP flags field).
1384
1385 The following ICMP type field values are available: \fBicmp-echoreply\fP,
1386 \fBicmp-unreach\fP, \fBicmp-sourcequench\fP, \fBicmp-redirect\fP,
1387 \fBicmp-echo\fP, \fBicmp-routeradvert\fP, \fBicmp-routersolicit\fP,
1388 \fBicmp-timxceed\fP, \fBicmp-paramprob\fP, \fBicmp-tstamp\fP,
1389 \fBicmp-tstampreply\fP, \fBicmp-ireq\fP, \fBicmp-ireqreply\fP,
1390 \fBicmp-maskreq\fP, \fBicmp-maskreply\fP.
1391
1392 The following TCP flags field values are available: \fBtcp-fin\fP,
1393 \fBtcp-syn\fP, \fBtcp-rst\fP, \fBtcp-push\fP,
1394 \fBtcp-ack\fP, \fBtcp-urg\fP.
1395 .LP
1396 Primitives may be combined using:
1397 .IP
1398 A parenthesized group of primitives and operators
1399 (parentheses are special to the Shell and must be escaped).
1400 .IP
1401 Negation (`\fB!\fP' or `\fBnot\fP').
1402 .IP
1403 Concatenation (`\fB&&\fP' or `\fBand\fP').
1404 .IP
1405 Alternation (`\fB||\fP' or `\fBor\fP').
1406 .LP
1407 Negation has highest precedence.
1408 Alternation and concatenation have equal precedence and associate
1409 left to right.
1410 Note that explicit \fBand\fR tokens, not juxtaposition,
1411 are now required for concatenation.
1412 .LP
1413 If an identifier is given without a keyword, the most recent keyword
1414 is assumed.
1415 For example,
1416 .in +.5i
1417 .nf
1418 \fBnot host vs and ace\fR
1419 .fi
1420 .in -.5i
1421 is short for
1422 .in +.5i
1423 .nf
1424 \fBnot host vs and host ace\fR
1425 .fi
1426 .in -.5i
1427 which should not be confused with
1428 .in +.5i
1429 .nf
1430 \fBnot ( host vs or ace )\fR
1431 .fi
1432 .in -.5i
1433 .LP
1434 Expression arguments can be passed to \fItcpdump\fP as either a single
1435 argument or as multiple arguments, whichever is more convenient.
1436 Generally, if the expression contains Shell metacharacters, it is
1437 easier to pass it as a single, quoted argument.
1438 Multiple arguments are concatenated with spaces before being parsed.
1439 .SH EXAMPLES
1440 .LP
1441 To print all packets arriving at or departing from \fIsundown\fP:
1442 .RS
1443 .nf
1444 \fBtcpdump host sundown\fP
1445 .fi
1446 .RE
1447 .LP
1448 To print traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR:
1449 .RS
1450 .nf
1451 \fBtcpdump host helios and \\( hot or ace \\)\fP
1452 .fi
1453 .RE
1454 .LP
1455 To print all IP packets between \fIace\fR and any host except \fIhelios\fR:
1456 .RS
1457 .nf
1458 \fBtcpdump ip host ace and not helios\fP
1459 .fi
1460 .RE
1461 .LP
1462 To print all traffic between local hosts and hosts at Berkeley:
1463 .RS
1464 .nf
1465 .B
1466 tcpdump net ucb-ether
1467 .fi
1468 .RE
1469 .LP
1470 To print all ftp traffic through internet gateway \fIsnup\fP:
1471 (note that the expression is quoted to prevent the shell from
1472 (mis-)interpreting the parentheses):
1473 .RS
1474 .nf
1475 .B
1476 tcpdump 'gateway snup and (port ftp or ftp-data)'
1477 .fi
1478 .RE
1479 .LP
1480 To print traffic neither sourced from nor destined for local hosts
1481 (if you gateway to one other net, this stuff should never make it
1482 onto your local net).
1483 .RS
1484 .nf
1485 .B
1486 tcpdump ip and not net \fIlocalnet\fP
1487 .fi
1488 .RE
1489 .LP
1490 To print the start and end packets (the SYN and FIN packets) of each
1491 TCP conversation that involves a non-local host.
1492 .RS
1493 .nf
1494 .B
1495 tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocalnet\fP'
1496 .fi
1497 .RE
1498 .LP
1499 To print all IPv4 HTTP packets to and from port 80, i.e. print only
1500 packets that contain data, not, for example, SYN and FIN packets and
1501 ACK-only packets. (IPv6 is left as an exercise for the reader.)
1502 .RS
1503 .nf
1504 .B
1505 tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
1506 .fi
1507 .RE
1508 .LP
1509 To print IP packets longer than 576 bytes sent through gateway \fIsnup\fP:
1510 .RS
1511 .nf
1512 .B
1513 tcpdump 'gateway snup and ip[2:2] > 576'
1514 .fi
1515 .RE
1516 .LP
1517 To print IP broadcast or multicast packets that were
1518 .I not
1519 sent via Ethernet broadcast or multicast:
1520 .RS
1521 .nf
1522 .B
1523 tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'
1524 .fi
1525 .RE
1526 .LP
1527 To print all ICMP packets that are not echo requests/replies (i.e., not
1528 ping packets):
1529 .RS
1530 .nf
1531 .B
1532 tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'
1533 .fi
1534 .RE
1535 .SH OUTPUT FORMAT
1536 .LP
1537 The output of \fItcpdump\fP is protocol dependent.
1538 The following
1539 gives a brief description and examples of most of the formats.
1540 .de HD
1541 .sp 1.5
1542 .B
1543 ..
1544 .HD
1545 Link Level Headers
1546 .LP
1547 If the '-e' option is given, the link level header is printed out.
1548 On Ethernets, the source and destination addresses, protocol,
1549 and packet length are printed.
1550 .LP
1551 On FDDI networks, the '-e' option causes \fItcpdump\fP to print
1552 the `frame control' field, the source and destination addresses,
1553 and the packet length.
1554 (The `frame control' field governs the
1555 interpretation of the rest of the packet.
1556 Normal packets (such
1557 as those containing IP datagrams) are `async' packets, with a priority
1558 value between 0 and 7; for example, `\fBasync4\fR'.
1559 Such packets
1560 are assumed to contain an 802.2 Logical Link Control (LLC) packet;
1561 the LLC header is printed if it is \fInot\fR an ISO datagram or a
1562 so-called SNAP packet.
1563 .LP
1564 On Token Ring networks, the '-e' option causes \fItcpdump\fP to print
1565 the `access control' and `frame control' fields, the source and
1566 destination addresses, and the packet length.
1567 As on FDDI networks,
1568 packets are assumed to contain an LLC packet.
1569 Regardless of whether
1570 the '-e' option is specified or not, the source routing information is
1571 printed for source-routed packets.
1572 .LP
1573 On 802.11 networks, the '-e' option causes \fItcpdump\fP to print
1574 the `frame control' fields, all of the addresses in the 802.11 header,
1575 and the packet length.
1576 As on FDDI networks,
1577 packets are assumed to contain an LLC packet.
1578 .LP
1579 \fI(N.B.: The following description assumes familiarity with
1580 the SLIP compression algorithm described in RFC-1144.)\fP
1581 .LP
1582 On SLIP links, a direction indicator (``I'' for inbound, ``O'' for outbound),
1583 packet type, and compression information are printed out.
1584 The packet type is printed first.
1585 The three types are \fIip\fP, \fIutcp\fP, and \fIctcp\fP.
1586 No further link information is printed for \fIip\fR packets.
1587 For TCP packets, the connection identifier is printed following the type.
1588 If the packet is compressed, its encoded header is printed out.
1589 The special cases are printed out as
1590 \fB*S+\fIn\fR and \fB*SA+\fIn\fR, where \fIn\fR is the amount by which
1591 the sequence number (or sequence number and ack) has changed.
1592 If it is not a special case,
1593 zero or more changes are printed.
1594 A change is indicated by U (urgent pointer), W (window), A (ack),
1595 S (sequence number), and I (packet ID), followed by a delta (+n or -n),
1596 or a new value (=n).
1597 Finally, the amount of data in the packet and compressed header length
1598 are printed.
1599 .LP
1600 For example, the following line shows an outbound compressed TCP packet,
1601 with an implicit connection identifier; the ack has changed by 6,
1602 the sequence number by 49, and the packet ID by 6; there are 3 bytes of
1603 data and 6 bytes of compressed header:
1604 .RS
1605 .nf
1606 \fBO ctcp * A+6 S+49 I+6 3 (6)\fP
1607 .fi
1608 .RE
1609 .HD
1610 ARP/RARP Packets
1611 .LP
1612 Arp/rarp output shows the type of request and its arguments.
1613 The
1614 format is intended to be self explanatory.
1615 Here is a short sample taken from the start of an `rlogin' from
1616 host \fIrtsg\fP to host \fIcsam\fP:
1617 .RS
1618 .nf
1619 .sp .5
1620 \f(CWarp who-has csam tell rtsg
1621 arp reply csam is-at CSAM\fR
1622 .sp .5
1623 .fi
1624 .RE
1625 The first line says that rtsg sent an arp packet asking
1626 for the Ethernet address of internet host csam.
1627 Csam
1628 replies with its Ethernet address (in this example, Ethernet addresses
1629 are in caps and internet addresses in lower case).
1630 .LP
1631 This would look less redundant if we had done \fItcpdump \-n\fP:
1632 .RS
1633 .nf
1634 .sp .5
1635 \f(CWarp who-has 128.3.254.6 tell 128.3.254.68
1636 arp reply 128.3.254.6 is-at 02:07:01:00:01:c4\fP
1637 .fi
1638 .RE
1639 .LP
1640 If we had done \fItcpdump \-e\fP, the fact that the first packet is
1641 broadcast and the second is point-to-point would be visible:
1642 .RS
1643 .nf
1644 .sp .5
1645 \f(CWRTSG Broadcast 0806 64: arp who-has csam tell rtsg
1646 CSAM RTSG 0806 64: arp reply csam is-at CSAM\fR
1647 .sp .5
1648 .fi
1649 .RE
1650 For the first packet this says the Ethernet source address is RTSG, the
1651 destination is the Ethernet broadcast address, the type field
1652 contained hex 0806 (type ETHER_ARP) and the total length was 64 bytes.
1653 .HD
1654 TCP Packets
1655 .LP
1656 \fI(N.B.:The following description assumes familiarity with
1657 the TCP protocol described in RFC-793.
1658 If you are not familiar
1659 with the protocol, neither this description nor \fItcpdump\fP will
1660 be of much use to you.)\fP
1661 .LP
1662 The general format of a tcp protocol line is:
1663 .RS
1664 .nf
1665 .sp .5
1666 \fIsrc > dst: flags data-seqno ack window urgent options\fP
1667 .sp .5
1668 .fi
1669 .RE
1670 \fISrc\fP and \fIdst\fP are the source and destination IP
1671 addresses and ports.
1672 \fIFlags\fP are some combination of S (SYN),
1673 F (FIN), P (PUSH), R (RST), W (ECN CWR) or E (ECN-Echo), or a single
1674 `.' (no flags).
1675 \fIData-seqno\fP describes the portion of sequence space covered
1676 by the data in this packet (see example below).
1677 \fIAck\fP is sequence number of the next data expected the other
1678 direction on this connection.
1679 \fIWindow\fP is the number of bytes of receive buffer space available
1680 the other direction on this connection.
1681 \fIUrg\fP indicates there is `urgent' data in the packet.
1682 \fIOptions\fP are tcp options enclosed in angle brackets (e.g., <mss 1024>).
1683 .LP
1684 \fISrc, dst\fP and \fIflags\fP are always present.
1685 The other fields
1686 depend on the contents of the packet's tcp protocol header and
1687 are output only if appropriate.
1688 .LP
1689 Here is the opening portion of an rlogin from host \fIrtsg\fP to
1690 host \fIcsam\fP.
1691 .RS
1692 .nf
1693 .sp .5
1694 \s-2\f(CWrtsg.1023 > csam.login: S 768512:768512(0) win 4096 <mss 1024>
1695 csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 <mss 1024>
1696 rtsg.1023 > csam.login: . ack 1 win 4096
1697 rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096
1698 csam.login > rtsg.1023: . ack 2 win 4096
1699 rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096
1700 csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077
1701 csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1
1702 csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1\fR\s+2
1703 .sp .5
1704 .fi
1705 .RE
1706 The first line says that tcp port 1023 on rtsg sent a packet
1707 to port \fIlogin\fP
1708 on csam.
1709 The \fBS\fP indicates that the \fISYN\fP flag was set.
1710 The packet sequence number was 768512 and it contained no data.
1711 (The notation is `first:last(nbytes)' which means `sequence
1712 numbers \fIfirst\fP
1713 up to but not including \fIlast\fP which is \fInbytes\fP bytes of user data'.)
1714 There was no piggy-backed ack, the available receive window was 4096
1715 bytes and there was a max-segment-size option requesting an mss of
1716 1024 bytes.
1717 .LP
1718 Csam replies with a similar packet except it includes a piggy-backed
1719 ack for rtsg's SYN.
1720 Rtsg then acks csam's SYN.
1721 The `.' means no
1722 flags were set.
1723 The packet contained no data so there is no data sequence number.
1724 Note that the ack sequence
1725 number is a small integer (1).
1726 The first time \fItcpdump\fP sees a
1727 tcp `conversation', it prints the sequence number from the packet.
1728 On subsequent packets of the conversation, the difference between
1729 the current packet's sequence number and this initial sequence number
1730 is printed.
1731 This means that sequence numbers after the
1732 first can be interpreted
1733 as relative byte positions in the conversation's data stream (with the
1734 first data byte each direction being `1').
1735 `-S' will override this
1736 feature, causing the original sequence numbers to be output.
1737 .LP
1738 On the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20
1739 in the rtsg \(-> csam side of the conversation).
1740 The PUSH flag is set in the packet.
1741 On the 7th line, csam says it's received data sent by rtsg up to
1742 but not including byte 21.
1743 Most of this data is apparently sitting in the
1744 socket buffer since csam's receive window has gotten 19 bytes smaller.
1745 Csam also sends one byte of data to rtsg in this packet.
1746 On the 8th and 9th lines,
1747 csam sends two bytes of urgent, pushed data to rtsg.
1748 .LP
1749 If the snapshot was small enough that \fItcpdump\fP didn't capture
1750 the full TCP header, it interprets as much of the header as it can
1751 and then reports ``[|\fItcp\fP]'' to indicate the remainder could not
1752 be interpreted.
1753 If the header contains a bogus option (one with a length
1754 that's either too small or beyond the end of the header), \fItcpdump\fP
1755 reports it as ``[\fIbad opt\fP]'' and does not interpret any further
1756 options (since it's impossible to tell where they start).
1757 If the header
1758 length indicates options are present but the IP datagram length is not
1759 long enough for the options to actually be there, \fItcpdump\fP reports
1760 it as ``[\fIbad hdr length\fP]''.
1761 .HD
1762 .B Capturing TCP packets with particular flag combinations (SYN-ACK, URG-ACK, etc.)
1763 .PP
1764 There are 8 bits in the control bits section of the TCP header:
1765 .IP
1766 .I CWR | ECE | URG | ACK | PSH | RST | SYN | FIN
1767 .PP
1768 Let's assume that we want to watch packets used in establishing
1769 a TCP connection.
1770 Recall that TCP uses a 3-way handshake protocol
1771 when it initializes a new connection; the connection sequence with
1772 regard to the TCP control bits is
1773 .PP
1774 .RS
1775 1) Caller sends SYN
1776 .RE
1777 .RS
1778 2) Recipient responds with SYN, ACK
1779 .RE
1780 .RS
1781 3) Caller sends ACK
1782 .RE
1783 .PP
1784 Now we're interested in capturing packets that have only the
1785 SYN bit set (Step 1).
1786 Note that we don't want packets from step 2
1787 (SYN-ACK), just a plain initial SYN.
1788 What we need is a correct filter
1789 expression for \fItcpdump\fP.
1790 .PP
1791 Recall the structure of a TCP header without options:
1792 .PP
1793 .nf
1794 0 15 31
1795 -----------------------------------------------------------------
1796 | source port | destination port |
1797 -----------------------------------------------------------------
1798 | sequence number |
1799 -----------------------------------------------------------------
1800 | acknowledgment number |
1801 -----------------------------------------------------------------
1802 | HL | rsvd |C|E|U|A|P|R|S|F| window size |
1803 -----------------------------------------------------------------
1804 | TCP checksum | urgent pointer |
1805 -----------------------------------------------------------------
1806 .fi
1807 .PP
1808 A TCP header usually holds 20 octets of data, unless options are
1809 present.
1810 The first line of the graph contains octets 0 - 3, the
1811 second line shows octets 4 - 7 etc.
1812 .PP
1813 Starting to count with 0, the relevant TCP control bits are contained
1814 in octet 13:
1815 .PP
1816 .nf
1817 0 7| 15| 23| 31
1818 ----------------|---------------|---------------|----------------
1819 | HL | rsvd |C|E|U|A|P|R|S|F| window size |
1820 ----------------|---------------|---------------|----------------
1821 | | 13th octet | | |
1822 .fi
1823 .PP
1824 Let's have a closer look at octet no. 13:
1825 .PP
1826 .nf
1827 | |
1828 |---------------|
1829 |C|E|U|A|P|R|S|F|
1830 |---------------|
1831 |7 5 3 0|
1832 .fi
1833 .PP
1834 These are the TCP control bits we are interested
1835 in.
1836 We have numbered the bits in this octet from 0 to 7, right to
1837 left, so the PSH bit is bit number 3, while the URG bit is number 5.
1838 .PP
1839 Recall that we want to capture packets with only SYN set.
1840 Let's see what happens to octet 13 if a TCP datagram arrives
1841 with the SYN bit set in its header:
1842 .PP
1843 .nf
1844 |C|E|U|A|P|R|S|F|
1845 |---------------|
1846 |0 0 0 0 0 0 1 0|
1847 |---------------|
1848 |7 6 5 4 3 2 1 0|
1849 .fi
1850 .PP
1851 Looking at the
1852 control bits section we see that only bit number 1 (SYN) is set.
1853 .PP
1854 Assuming that octet number 13 is an 8-bit unsigned integer in
1855 network byte order, the binary value of this octet is
1856 .IP
1857 00000010
1858 .PP
1859 and its decimal representation is
1860 .PP
1861 .nf
1862 7 6 5 4 3 2 1 0
1863 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 1*2 + 0*2 = 2
1864 .fi
1865 .PP
1866 We're almost done, because now we know that if only SYN is set,
1867 the value of the 13th octet in the TCP header, when interpreted
1868 as a 8-bit unsigned integer in network byte order, must be exactly 2.
1869 .PP
1870 This relationship can be expressed as
1871 .RS
1872 .B
1873 tcp[13] == 2
1874 .RE
1875 .PP
1876 We can use this expression as the filter for \fItcpdump\fP in order
1877 to watch packets which have only SYN set:
1878 .RS
1879 .B
1880 tcpdump -i xl0 tcp[13] == 2
1881 .RE
1882 .PP
1883 The expression says "let the 13th octet of a TCP datagram have
1884 the decimal value 2", which is exactly what we want.
1885 .PP
1886 Now, let's assume that we need to capture SYN packets, but we
1887 don't care if ACK or any other TCP control bit is set at the
1888 same time.
1889 Let's see what happens to octet 13 when a TCP datagram
1890 with SYN-ACK set arrives:
1891 .PP
1892 .nf
1893 |C|E|U|A|P|R|S|F|
1894 |---------------|
1895 |0 0 0 1 0 0 1 0|
1896 |---------------|
1897 |7 6 5 4 3 2 1 0|
1898 .fi
1899 .PP
1900 Now bits 1 and 4 are set in the 13th octet.
1901 The binary value of
1902 octet 13 is
1903 .IP
1904 00010010
1905 .PP
1906 which translates to decimal
1907 .PP
1908 .nf
1909 7 6 5 4 3 2 1 0
1910 0*2 + 0*2 + 0*2 + 1*2 + 0*2 + 0*2 + 1*2 + 0*2 = 18
1911 .fi
1912 .PP
1913 Now we can't just use 'tcp[13] == 18' in the \fItcpdump\fP filter
1914 expression, because that would select only those packets that have
1915 SYN-ACK set, but not those with only SYN set.
1916 Remember that we don't care
1917 if ACK or any other control bit is set as long as SYN is set.
1918 .PP
1919 In order to achieve our goal, we need to logically AND the
1920 binary value of octet 13 with some other value to preserve
1921 the SYN bit.
1922 We know that we want SYN to be set in any case,
1923 so we'll logically AND the value in the 13th octet with
1924 the binary value of a SYN:
1925 .PP
1926 .nf
1927
1928 00010010 SYN-ACK 00000010 SYN
1929 AND 00000010 (we want SYN) AND 00000010 (we want SYN)
1930 -------- --------
1931 = 00000010 = 00000010
1932 .fi
1933 .PP
1934 We see that this AND operation delivers the same result
1935 regardless whether ACK or another TCP control bit is set.
1936 The decimal representation of the AND value as well as
1937 the result of this operation is 2 (binary 00000010),
1938 so we know that for packets with SYN set the following
1939 relation must hold true:
1940 .IP
1941 ( ( value of octet 13 ) AND ( 2 ) ) == ( 2 )
1942 .PP
1943 This points us to the \fItcpdump\fP filter expression
1944 .RS
1945 .B
1946 tcpdump -i xl0 'tcp[13] & 2 == 2'
1947 .RE
1948 .PP
1949 Note that you should use single quotes or a backslash
1950 in the expression to hide the AND ('&') special character
1951 from the shell.
1952 .HD
1953 .B
1954 UDP Packets
1955 .LP
1956 UDP format is illustrated by this rwho packet:
1957 .RS
1958 .nf
1959 .sp .5
1960 \f(CWactinide.who > broadcast.who: udp 84\fP
1961 .sp .5
1962 .fi
1963 .RE
1964 This says that port \fIwho\fP on host \fIactinide\fP sent a udp
1965 datagram to port \fIwho\fP on host \fIbroadcast\fP, the Internet
1966 broadcast address.
1967 The packet contained 84 bytes of user data.
1968 .LP
1969 Some UDP services are recognized (from the source or destination
1970 port number) and the higher level protocol information printed.
1971 In particular, Domain Name service requests (RFC-1034/1035) and Sun
1972 RPC calls (RFC-1050) to NFS.
1973 .HD
1974 UDP Name Server Requests
1975 .LP
1976 \fI(N.B.:The following description assumes familiarity with
1977 the Domain Service protocol described in RFC-1035.
1978 If you are not familiar
1979 with the protocol, the following description will appear to be written
1980 in greek.)\fP
1981 .LP
1982 Name server requests are formatted as
1983 .RS
1984 .nf
1985 .sp .5
1986 \fIsrc > dst: id op? flags qtype qclass name (len)\fP
1987 .sp .5
1988 \f(CWh2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)\fR
1989 .sp .5
1990 .fi
1991 .RE
1992 Host \fIh2opolo\fP asked the domain server on \fIhelios\fP for an
1993 address record (qtype=A) associated with the name \fIucbvax.berkeley.edu.\fP
1994 The query id was `3'.
1995 The `+' indicates the \fIrecursion desired\fP flag
1996 was set.
1997 The query length was 37 bytes, not including the UDP and
1998 IP protocol headers.
1999 The query operation was the normal one, \fIQuery\fP,
2000 so the op field was omitted.
2001 If the op had been anything else, it would
2002 have been printed between the `3' and the `+'.
2003 Similarly, the qclass was the normal one,
2004 \fIC_IN\fP, and omitted.
2005 Any other qclass would have been printed
2006 immediately after the `A'.
2007 .LP
2008 A few anomalies are checked and may result in extra fields enclosed in
2009 square brackets: If a query contains an answer, authority records or
2010 additional records section,
2011 .IR ancount ,
2012 .IR nscount ,
2013 or
2014 .I arcount
2015 are printed as `[\fIn\fPa]', `[\fIn\fPn]' or `[\fIn\fPau]' where \fIn\fP
2016 is the appropriate count.
2017 If any of the response bits are set (AA, RA or rcode) or any of the
2018 `must be zero' bits are set in bytes two and three, `[b2&3=\fIx\fP]'
2019 is printed, where \fIx\fP is the hex value of header bytes two and three.
2020 .HD
2021 UDP Name Server Responses
2022 .LP
2023 Name server responses are formatted as
2024 .RS
2025 .nf
2026 .sp .5
2027 \fIsrc > dst: id op rcode flags a/n/au type class data (len)\fP
2028 .sp .5
2029 \f(CWhelios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)
2030 helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)\fR
2031 .sp .5
2032 .fi
2033 .RE
2034 In the first example, \fIhelios\fP responds to query id 3 from \fIh2opolo\fP
2035 with 3 answer records, 3 name server records and 7 additional records.
2036 The first answer record is type A (address) and its data is internet
2037 address 128.32.137.3.
2038 The total size of the response was 273 bytes,
2039 excluding UDP and IP headers.
2040 The op (Query) and response code
2041 (NoError) were omitted, as was the class (C_IN) of the A record.
2042 .LP
2043 In the second example, \fIhelios\fP responds to query 2 with a
2044 response code of non-existent domain (NXDomain) with no answers,
2045 one name server and no authority records.
2046 The `*' indicates that
2047 the \fIauthoritative answer\fP bit was set.
2048 Since there were no
2049 answers, no type, class or data were printed.
2050 .LP
2051 Other flag characters that might appear are `\-' (recursion available,
2052 RA, \fInot\fP set) and `|' (truncated message, TC, set).
2053 If the
2054 `question' section doesn't contain exactly one entry, `[\fIn\fPq]'
2055 is printed.
2056 .LP
2057 Note that name server requests and responses tend to be large and the
2058 default \fIsnaplen\fP of 68 bytes may not capture enough of the packet
2059 to print.
2060 Use the \fB\-s\fP flag to increase the snaplen if you
2061 need to seriously investigate name server traffic.
2062 `\fB\-s 128\fP'
2063 has worked well for me.
2064
2065 .HD
2066 SMB/CIFS decoding
2067 .LP
2068 \fItcpdump\fP now includes fairly extensive SMB/CIFS/NBT decoding for data
2069 on UDP/137, UDP/138 and TCP/139.
2070 Some primitive decoding of IPX and
2071 NetBEUI SMB data is also done.
2072
2073 By default a fairly minimal decode is done, with a much more detailed
2074 decode done if -v is used.
2075 Be warned that with -v a single SMB packet
2076 may take up a page or more, so only use -v if you really want all the
2077 gory details.
2078
2079 For information on SMB packet formats and what all te fields mean see
2080 www.cifs.org or the pub/samba/specs/ directory on your favorite
2081 samba.org mirror site.
2082 The SMB patches were written by Andrew Tridgell
2083 (tridge@samba.org).
2084
2085 .HD
2086 NFS Requests and Replies
2087 .LP
2088 Sun NFS (Network File System) requests and replies are printed as:
2089 .RS
2090 .nf
2091 .sp .5
2092 \fIsrc.xid > dst.nfs: len op args\fP
2093 \fIsrc.nfs > dst.xid: reply stat len op results\fP
2094 .sp .5
2095 \f(CW
2096 sushi.6709 > wrl.nfs: 112 readlink fh 21,24/10.73165
2097 wrl.nfs > sushi.6709: reply ok 40 readlink "../var"
2098 sushi.201b > wrl.nfs:
2099 144 lookup fh 9,74/4096.6878 "xcolors"
2100 wrl.nfs > sushi.201b:
2101 reply ok 128 lookup fh 9,74/4134.3150
2102 \fR
2103 .sp .5
2104 .fi
2105 .RE
2106 In the first line, host \fIsushi\fP sends a transaction with id \fI6709\fP
2107 to \fIwrl\fP (note that the number following the src host is a
2108 transaction id, \fInot\fP the source port).
2109 The request was 112 bytes,
2110 excluding the UDP and IP headers.
2111 The operation was a \fIreadlink\fP
2112 (read symbolic link) on file handle (\fIfh\fP) 21,24/10.731657119.
2113 (If one is lucky, as in this case, the file handle can be interpreted
2114 as a major,minor device number pair, followed by the inode number and
2115 generation number.)
2116 \fIWrl\fP replies `ok' with the contents of the link.
2117 .LP
2118 In the third line, \fIsushi\fP asks \fIwrl\fP to lookup the name
2119 `\fIxcolors\fP' in directory file 9,74/4096.6878.
2120 Note that the data printed
2121 depends on the operation type.
2122 The format is intended to be self
2123 explanatory if read in conjunction with
2124 an NFS protocol spec.
2125 .LP
2126 If the \-v (verbose) flag is given, additional information is printed.
2127 For example:
2128 .RS
2129 .nf
2130 .sp .5
2131 \f(CW
2132 sushi.1372a > wrl.nfs:
2133 148 read fh 21,11/12.195 8192 bytes @ 24576
2134 wrl.nfs > sushi.1372a:
2135 reply ok 1472 read REG 100664 ids 417/0 sz 29388
2136 \fP
2137 .sp .5
2138 .fi
2139 .RE
2140 (\-v also prints the IP header TTL, ID, length, and fragmentation fields,
2141 which have been omitted from this example.) In the first line,
2142 \fIsushi\fP asks \fIwrl\fP to read 8192 bytes from file 21,11/12.195,
2143 at byte offset 24576.
2144 \fIWrl\fP replies `ok'; the packet shown on the
2145 second line is the first fragment of the reply, and hence is only 1472
2146 bytes long (the other bytes will follow in subsequent fragments, but
2147 these fragments do not have NFS or even UDP headers and so might not be
2148 printed, depending on the filter expression used).
2149 Because the \-v flag
2150 is given, some of the file attributes (which are returned in addition
2151 to the file data) are printed: the file type (``REG'', for regular file),
2152 the file mode (in octal), the uid and gid, and the file size.
2153 .LP
2154 If the \-v flag is given more than once, even more details are printed.
2155 .LP
2156 Note that NFS requests are very large and much of the detail won't be printed
2157 unless \fIsnaplen\fP is increased.
2158 Try using `\fB\-s 192\fP' to watch
2159 NFS traffic.
2160 .LP
2161 NFS reply packets do not explicitly identify the RPC operation.
2162 Instead,
2163 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
2164 replies using the transaction ID.
2165 If a reply does not closely follow the
2166 corresponding request, it might not be parsable.
2167 .HD
2168 AFS Requests and Replies
2169 .LP
2170 Transarc AFS (Andrew File System) requests and replies are printed
2171 as:
2172 .HD
2173 .RS
2174 .nf
2175 .sp .5
2176 \fIsrc.sport > dst.dport: rx packet-type\fP
2177 \fIsrc.sport > dst.dport: rx packet-type service call call-name args\fP
2178 \fIsrc.sport > dst.dport: rx packet-type service reply call-name args\fP
2179 .sp .5
2180 \f(CW
2181 elvis.7001 > pike.afsfs:
2182 rx data fs call rename old fid 536876964/1/1 ".newsrc.new"
2183 new fid 536876964/1/1 ".newsrc"
2184 pike.afsfs > elvis.7001: rx data fs reply rename
2185 \fR
2186 .sp .5
2187 .fi
2188 .RE
2189 In the first line, host elvis sends a RX packet to pike.
2190 This was
2191 a RX data packet to the fs (fileserver) service, and is the start of
2192 an RPC call.
2193 The RPC call was a rename, with the old directory file id
2194 of 536876964/1/1 and an old filename of `.newsrc.new', and a new directory
2195 file id of 536876964/1/1 and a new filename of `.newsrc'.
2196 The host pike
2197 responds with a RPC reply to the rename call (which was successful, because
2198 it was a data packet and not an abort packet).
2199 .LP
2200 In general, all AFS RPCs are decoded at least by RPC call name.
2201 Most
2202 AFS RPCs have at least some of the arguments decoded (generally only
2203 the `interesting' arguments, for some definition of interesting).
2204 .LP
2205 The format is intended to be self-describing, but it will probably
2206 not be useful to people who are not familiar with the workings of
2207 AFS and RX.
2208 .LP
2209 If the -v (verbose) flag is given twice, acknowledgement packets and
2210 additional header information is printed, such as the the RX call ID,
2211 call number, sequence number, serial number, and the RX packet flags.
2212 .LP
2213 If the -v flag is given twice, additional information is printed,
2214 such as the the RX call ID, serial number, and the RX packet flags.
2215 The MTU negotiation information is also printed from RX ack packets.
2216 .LP
2217 If the -v flag is given three times, the security index and service id
2218 are printed.
2219 .LP
2220 Error codes are printed for abort packets, with the exception of Ubik
2221 beacon packets (because abort packets are used to signify a yes vote
2222 for the Ubik protocol).
2223 .LP
2224 Note that AFS requests are very large and many of the arguments won't
2225 be printed unless \fIsnaplen\fP is increased.
2226 Try using `\fB-s 256\fP'
2227 to watch AFS traffic.
2228 .LP
2229 AFS reply packets do not explicitly identify the RPC operation.
2230 Instead,
2231 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
2232 replies using the call number and service ID.
2233 If a reply does not closely
2234 follow the
2235 corresponding request, it might not be parsable.
2236
2237 .HD
2238 KIP AppleTalk (DDP in UDP)
2239 .LP
2240 AppleTalk DDP packets encapsulated in UDP datagrams are de-encapsulated
2241 and dumped as DDP packets (i.e., all the UDP header information is
2242 discarded).
2243 The file
2244 .I /etc/atalk.names
2245 is used to translate AppleTalk net and node numbers to names.
2246 Lines in this file have the form
2247 .RS
2248 .nf
2249 .sp .5
2250 \fInumber name\fP
2251
2252 \f(CW1.254 ether
2253 16.1 icsd-net
2254 1.254.110 ace\fR
2255 .sp .5
2256 .fi
2257 .RE
2258 The first two lines give the names of AppleTalk networks.
2259 The third
2260 line gives the name of a particular host (a host is distinguished
2261 from a net by the 3rd octet in the number \-
2262 a net number \fImust\fP have two octets and a host number \fImust\fP
2263 have three octets.) The number and name should be separated by
2264 whitespace (blanks or tabs).
2265 The
2266 .I /etc/atalk.names
2267 file may contain blank lines or comment lines (lines starting with
2268 a `#').
2269 .LP
2270 AppleTalk addresses are printed in the form
2271 .RS
2272 .nf
2273 .sp .5
2274 \fInet.host.port\fP
2275
2276 \f(CW144.1.209.2 > icsd-net.112.220
2277 office.2 > icsd-net.112.220
2278 jssmag.149.235 > icsd-net.2\fR
2279 .sp .5
2280 .fi
2281 .RE
2282 (If the
2283 .I /etc/atalk.names
2284 doesn't exist or doesn't contain an entry for some AppleTalk
2285 host/net number, addresses are printed in numeric form.)
2286 In the first example, NBP (DDP port 2) on net 144.1 node 209
2287 is sending to whatever is listening on port 220 of net icsd node 112.
2288 The second line is the same except the full name of the source node
2289 is known (`office').
2290 The third line is a send from port 235 on
2291 net jssmag node 149 to broadcast on the icsd-net NBP port (note that
2292 the broadcast address (255) is indicated by a net name with no host
2293 number \- for this reason it's a good idea to keep node names and
2294 net names distinct in /etc/atalk.names).
2295 .LP
2296 NBP (name binding protocol) and ATP (AppleTalk transaction protocol)
2297 packets have their contents interpreted.
2298 Other protocols just dump
2299 the protocol name (or number if no name is registered for the
2300 protocol) and packet size.
2301
2302 \fBNBP packets\fP are formatted like the following examples:
2303 .RS
2304 .nf
2305 .sp .5
2306 \s-2\f(CWicsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*"
2307 jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250
2308 techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186\fR\s+2
2309 .sp .5
2310 .fi
2311 .RE
2312 The first line is a name lookup request for laserwriters sent by net icsd host
2313 112 and broadcast on net jssmag.
2314 The nbp id for the lookup is 190.
2315 The second line shows a reply for this request (note that it has the
2316 same id) from host jssmag.209 saying that it has a laserwriter
2317 resource named "RM1140" registered on port 250.
2318 The third line is
2319 another reply to the same request saying host techpit has laserwriter
2320 "techpit" registered on port 186.
2321
2322 \fBATP packet\fP formatting is demonstrated by the following example:
2323 .RS
2324 .nf
2325 .sp .5
2326 \s-2\f(CWjssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001
2327 helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000
2328 helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000
2329 helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000
2330 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
2331 helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000
2332 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
2333 helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000
2334 helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000
2335 jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001
2336 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
2337 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
2338 jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001
2339 jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002\fR\s+2
2340 .sp .5
2341 .fi
2342 .RE
2343 Jssmag.209 initiates transaction id 12266 with host helios by requesting
2344 up to 8 packets (the `<0-7>').
2345 The hex number at the end of the line
2346 is the value of the `userdata' field in the request.
2347 .LP
2348 Helios responds with 8 512-byte packets.
2349 The `:digit' following the
2350 transaction id gives the packet sequence number in the transaction
2351 and the number in parens is the amount of data in the packet,
2352 excluding the atp header.
2353 The `*' on packet 7 indicates that the
2354 EOM bit was set.
2355 .LP
2356 Jssmag.209 then requests that packets 3 & 5 be retransmitted.
2357 Helios
2358 resends them then jssmag.209 releases the transaction.
2359 Finally,
2360 jssmag.209 initiates the next request.
2361 The `*' on the request
2362 indicates that XO (`exactly once') was \fInot\fP set.
2363
2364 .HD
2365 IP Fragmentation
2366 .LP
2367 Fragmented Internet datagrams are printed as
2368 .RS
2369 .nf
2370 .sp .5
2371 \fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB+)\fR
2372 \fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB)\fR
2373 .sp .5
2374 .fi
2375 .RE
2376 (The first form indicates there are more fragments.
2377 The second
2378 indicates this is the last fragment.)
2379 .LP
2380 \fIId\fP is the fragment id.
2381 \fISize\fP is the fragment
2382 size (in bytes) excluding the IP header.
2383 \fIOffset\fP is this
2384 fragment's offset (in bytes) in the original datagram.
2385 .LP
2386 The fragment information is output for each fragment.
2387 The first
2388 fragment contains the higher level protocol header and the frag
2389 info is printed after the protocol info.
2390 Fragments
2391 after the first contain no higher level protocol header and the
2392 frag info is printed after the source and destination addresses.
2393 For example, here is part of an ftp from arizona.edu to lbl-rtsg.arpa
2394 over a CSNET connection that doesn't appear to handle 576 byte datagrams:
2395 .RS
2396 .nf
2397 .sp .5
2398 \s-2\f(CWarizona.ftp-data > rtsg.1170: . 1024:1332(308) ack 1 win 4096 (frag 595a:328@0+)
2399 arizona > rtsg: (frag 595a:204@328)
2400 rtsg.1170 > arizona.ftp-data: . ack 1536 win 2560\fP\s+2
2401 .sp .5
2402 .fi
2403 .RE
2404 There are a couple of things to note here: First, addresses in the
2405 2nd line don't include port numbers.
2406 This is because the TCP
2407 protocol information is all in the first fragment and we have no idea
2408 what the port or sequence numbers are when we print the later fragments.
2409 Second, the tcp sequence information in the first line is printed as if there
2410 were 308 bytes of user data when, in fact, there are 512 bytes (308 in
2411 the first frag and 204 in the second).
2412 If you are looking for holes
2413 in the sequence space or trying to match up acks
2414 with packets, this can fool you.
2415 .LP
2416 A packet with the IP \fIdon't fragment\fP flag is marked with a
2417 trailing \fB(DF)\fP.
2418 .HD
2419 Timestamps
2420 .LP
2421 By default, all output lines are preceded by a timestamp.
2422 The timestamp
2423 is the current clock time in the form
2424 .RS
2425 .nf
2426 \fIhh:mm:ss.frac\fP
2427 .fi
2428 .RE
2429 and is as accurate as the kernel's clock.
2430 The timestamp reflects the time the kernel first saw the packet.
2431 No attempt
2432 is made to account for the time lag between when the
2433 Ethernet interface removed the packet from the wire and when the kernel
2434 serviced the `new packet' interrupt.
2435 .SH "SEE ALSO"
2436 stty(1), pcap(3), bpf(4), nit(4P), pfconfig(8)
2437 .SH AUTHORS
2438 The original authors are:
2439 .LP
2440 Van Jacobson,
2441 Craig Leres and
2442 Steven McCanne, all of the
2443 Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
2444 .LP
2445 It is currently being maintained by tcpdump.org.
2446 .LP
2447 The current version is available via http:
2448 .LP
2449 .RS
2450 .I http://www.tcpdump.org/
2451 .RE
2452 .LP
2453 The original distribution is available via anonymous ftp:
2454 .LP
2455 .RS
2456 .I ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
2457 .RE
2458 .LP
2459 IPv6/IPsec support is added by WIDE/KAME project.
2460 This program uses Eric Young's SSLeay library, under specific configuration.
2461 .SH BUGS
2462 Please send problems, bugs, questions, desirable enhancements, etc. to:
2463 .LP
2464 .RS
2465 tcpdump-workers@tcpdump.org
2466 .RE
2467 .LP
2468 Please send source code contributions, etc. to:
2469 .LP
2470 .RS
2471 patches@tcpdump.org
2472 .RE
2473 .LP
2474 NIT doesn't let you watch your own outbound traffic, BPF will.
2475 We recommend that you use the latter.
2476 .LP
2477 On Linux systems with 2.0[.x] kernels:
2478 .IP
2479 packets on the loopback device will be seen twice;
2480 .IP
2481 packet filtering cannot be done in the kernel, so that all packets must
2482 be copied from the kernel in order to be filtered in user mode;
2483 .IP
2484 all of a packet, not just the part that's within the snapshot length,
2485 will be copied from the kernel (the 2.0[.x] packet capture mechanism, if
2486 asked to copy only part of a packet to userland, will not report the
2487 true length of the packet; this would cause most IP packets to get an
2488 error from
2489 .BR tcpdump );
2490 .IP
2491 capturing on some PPP devices won't work correctly.
2492 .LP
2493 We recommend that you upgrade to a 2.2 or later kernel.
2494 .LP
2495 Some attempt should be made to reassemble IP fragments or, at least
2496 to compute the right length for the higher level protocol.
2497 .LP
2498 Name server inverse queries are not dumped correctly: the (empty)
2499 question section is printed rather than real query in the answer
2500 section.
2501 Some believe that inverse queries are themselves a bug and
2502 prefer to fix the program generating them rather than \fItcpdump\fP.
2503 .LP
2504 A packet trace that crosses a daylight savings time change will give
2505 skewed time stamps (the time change is ignored).
2506 .LP
2507 Filter expressions on fields other than those in Token Ring headers will
2508 not correctly handle source-routed Token Ring packets.
2509 .LP
2510 Filter expressions on fields other than those in 802.11 headers will not
2511 correctly handle 802.11 data packets with both To DS and From DS set.
2512 .LP
2513 .BR "ip6 proto"
2514 should chase header chain, but at this moment it does not.
2515 .BR "ip6 protochain"
2516 is supplied for this behavior.
2517 .LP
2518 Arithmetic expression against transport layer headers, like \fBtcp[0]\fP,
2519 does not work against IPv6 packets.
2520 It only looks at IPv4 packets.