]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/tcpdump/tcpdump.1
This commit was generated by cvs2svn to compensate for changes in r101613,
[FreeBSD/FreeBSD.git] / contrib / tcpdump / tcpdump.1
1 .\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.114 2002/01/04 07:37:49 guy Exp $ (LBL)
2 .\"
3 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\" All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that: (1) source code distributions
9 .\" retain the above copyright notice and this paragraph in its entirety, (2)
10 .\" distributions including binary code include the above copyright notice and
11 .\" this paragraph in its entirety in the documentation or other materials
12 .\" provided with the distribution, and (3) all advertising materials mentioning
13 .\" features or use of this software display the following acknowledgement:
14 .\" ``This product includes software developed by the University of California,
15 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
16 .\" the University nor the names of its contributors may be used to endorse
17 .\" or promote products derived from this software without specific prior
18 .\" written permission.
19 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 .\"
23 .\" $FreeBSD$
24 .\"
25 .TH TCPDUMP 1  "3 January 2001"
26 .SH NAME
27 tcpdump \- dump traffic on a network
28 .SH SYNOPSIS
29 .na
30 .B tcpdump
31 [
32 .B \-adeflnNOpqRStuvxX
33 ] [
34 .B \-c
35 .I count
36 ]
37 .br
38 .ti +8
39 [
40 .B \-C
41 .I file_size
42 ] [
43 .B \-F
44 .I file
45 ]
46 .br
47 .ti +8
48 [
49 .B \-i
50 .I interface
51 ]
52 [
53 .B \-m
54 .I module
55 ]
56 [
57 .B \-r
58 .I file
59 ]
60 .br
61 .ti +8
62 [
63 .B \-s
64 .I snaplen
65 ]
66 [
67 .B \-T
68 .I type
69 ]
70 [
71 .B \-w
72 .I file
73 ]
74 .br
75 .ti +8
76 [
77 .B \-E
78 .I algo:secret
79 ]
80 [
81 .I expression
82 ]
83 .br
84 .ad
85 .SH DESCRIPTION
86 .LP
87 \fITcpdump\fP prints out the headers of packets on a network interface
88 that match the boolean \fIexpression\fP.  It can also be run with the
89 .B \-w
90 flag, which causes it to save the packet data to a file for later
91 analysis, and/or with the
92 .B \-b
93 flag, which causes it to read from a saved packet file rather than to
94 read packets from a network interface.  In all cases, only packets that
95 match
96 .I expression
97 will be processed by
98 .IR tcpdump .
99 .LP
100 .I Tcpdump
101 will, if not run with the
102 .B \-c
103 flag, continue capturing packets until it is interrupted by a SIGINT
104 signal (generated, for example, by typing your interrupt character,
105 typically control-C) or a SIGTERM signal (typically generated with the
106 .BR kill (1)
107 command); if run with the
108 .B \-c
109 flag, it will capture packets until it is interrupted by a SIGINT or
110 SIGTERM signal or the specified number of packets have been processed.
111 .LP
112 When
113 .I tcpdump
114 finishes capturing packets, it will report counts of:
115 .IP
116 packets ``received by filter'' (the meaning of this depends on the OS on
117 which you're running
118 .IR tcpdump ,
119 and possibly on the way the OS was configured - if a filter was
120 specified on the command line, on some OSes it counts packets regardless
121 of whether they were matched by the filter expression, and on other OSes
122 it counts only packets that were matched by the filter expression and
123 were processed by
124 .IR tcpdump );
125 .IP
126 packets ``dropped by kernel'' (this is the number of packets that were
127 dropped, due to a lack of buffer space, by the packet capture mechanism
128 in the OS on which
129 .I tcpdump
130 is running, if the OS reports that information to applications; if not,
131 it will be reported as 0).
132 .LP
133 On platforms that support the SIGINFO signal, such as most BSDs, it will
134 report those counts when it receives a SIGINFO signal (generated, for
135 example, by typing your ``status'' character, typically control-T) and
136 will continue capturing packets.
137 .LP
138 Reading packets from a network interface may require that you have
139 special privileges:
140 .TP
141 .B Under SunOS 3.x or 4.x with NIT or BPF:
142 You must have read access to
143 .I /dev/nit
144 or
145 .IR /dev/bpf* .
146 .TP
147 .B Under Solaris with DLPI:
148 You must have read/write access to the network pseudo device, e.g.
149 .IR /dev/le .
150 On at least some versions of Solaris, however, this is not sufficient to
151 allow
152 .I tcpdump
153 to capture in promiscuous mode; on those versions of Solaris, you must
154 be root, or
155 .I tcpdump
156 must be installed setuid to root, in order to capture in promiscuous
157 mode.
158 .TP
159 .B Under HP-UX with DLPI:
160 You must be root or
161 .I tcpdump
162 must be installed setuid to root.
163 .TP
164 .B Under IRIX with snoop:
165 You must be root or
166 .I tcpdump
167 must be installed setuid to root.
168 .TP
169 .B Under Linux:
170 You must be root or
171 .I tcpdump
172 must be installed setuid to root.
173 .TP
174 .B Under Ultrix and Digital UNIX:
175 Once the super-user has enabled promiscuous-mode operation using
176 .IR pfconfig (8),
177 any user may capture network traffic with
178 .IR tcpdump .
179 .TP
180 .B Under BSD:
181 You must have read access to
182 .IR /dev/bpf* .
183 .LP
184 Reading a saved packet file doesn't require special privileges.
185 .SH OPTIONS
186 .TP
187 .B \-a
188 Attempt to convert network and broadcast addresses to names.
189 .TP
190 .B \-c
191 Exit after receiving \fIcount\fP packets.
192 .TP
193 .B \-C
194 Before writing a raw packet to a savefile, check whether the file is
195 currently larger than \fIfile_size\fP and, if so, close the current
196 savefile and open a new one.  Savefiles after the first savefile will
197 have the name specified with the
198 .B \-w
199 flag, with a number after it, starting at 2 and continuing upward.
200 The units of \fIfile_size\fP are millions of bytes (1,000,000 bytes,
201 not 1,048,576 bytes).
202 .TP
203 .B \-d
204 Dump the compiled packet-matching code in a human readable form to
205 standard output and stop.
206 .TP
207 .B \-dd
208 Dump packet-matching code as a
209 .B C
210 program fragment.
211 .TP
212 .B \-ddd
213 Dump packet-matching code as decimal numbers (preceded with a count).
214 .TP
215 .B \-e
216 Print the link-level header on each dump line.
217 .TP
218 .B \-E
219 Use \fIalgo:secret\fP for decrypting IPsec ESP packets.
220 Algorithms may be
221 \fBdes-cbc\fP,
222 \fB3des-cbc\fP,
223 \fBblowfish-cbc\fP,
224 \fBrc3-cbc\fP,
225 \fBcast128-cbc\fP, or
226 \fBnone\fP.
227 The default is \fBdes-cbc\fP.
228 The ability to decrypt packets is only present if \fItcpdump\fP was compiled
229 with cryptography enabled.
230 \fIsecret\fP the ascii text for ESP secret key.
231 We cannot take arbitrary binary value at this moment.
232 The option assumes RFC2406 ESP, not RFC1827 ESP.
233 The option is only for debugging purposes, and
234 the use of this option with truly `secret' key is discouraged.
235 By presenting IPsec secret key onto command line
236 you make it visible to others, via
237 .IR ps (1)
238 and other occasions.
239 .TP
240 .B \-f
241 Print `foreign' internet addresses numerically rather than symbolically
242 (this option is intended to get around serious brain damage in
243 Sun's yp server \(em usually it hangs forever translating non-local
244 internet numbers).
245 .TP
246 .B \-F
247 Use \fIfile\fP as input for the filter expression.
248 An additional expression given on the command line is ignored.
249 .TP
250 .B \-i
251 Listen on \fIinterface\fP.
252 If unspecified, \fItcpdump\fP searches the system interface list for the
253 lowest numbered, configured up interface (excluding loopback).
254 Ties are broken by choosing the earliest match.
255 .IP
256 On Linux systems with 2.2 or later kernels, an
257 .I interface
258 argument of ``any'' can be used to capture packets from all interfaces.
259 Note that captures on the ``any'' device will not be done in promiscuous
260 mode.
261 .TP
262 .B \-l
263 Make stdout line buffered.
264 Useful if you want to see the data
265 while capturing it.
266 E.g.,
267 .br
268 ``tcpdump\ \ \-l\ \ |\ \ tee dat'' or
269 ``tcpdump\ \ \-l \ \ > dat\ \ &\ \ tail\ \ \-f\ \ dat''.
270 .TP
271 .B \-m
272 Load SMI MIB module definitions from file \fImodule\fR.
273 This option
274 can be used several times to load several MIB modules into \fItcpdump\fP.
275 .TP
276 .B \-n
277 Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.
278 .TP
279 .B \-N
280 Don't print domain name qualification of host names.
281 E.g.,
282 if you give this flag then \fItcpdump\fP will print ``nic''
283 instead of ``nic.ddn.mil''.
284 .TP
285 .B \-O
286 Do not run the packet-matching code optimizer.
287 This is useful only
288 if you suspect a bug in the optimizer.
289 .TP
290 .B \-p
291 \fIDon't\fP put the interface
292 into promiscuous mode.
293 Note that the interface might be in promiscuous
294 mode for some other reason; hence, `-p' cannot be used as an abbreviation for
295 `ether host {local-hw-addr} or ether broadcast'.
296 .TP
297 .B \-q
298 Quick (quiet?) output.
299 Print less protocol information so output
300 lines are shorter.
301 .TP
302 .B \-R
303 Assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829).
304 If specified, \fItcpdump\fP will not print replay prevention field.
305 Since there is no protocol version field in ESP/AH specification,
306 \fItcpdump\fP cannot deduce the version of ESP/AH protocol.
307 .TP
308 .B \-r
309 Read packets from \fIfile\fR (which was created with the -w option).
310 Standard input is used if \fIfile\fR is ``-''.
311 .TP
312 .B \-S
313 Print absolute, rather than relative, TCP sequence numbers.
314 .TP
315 .B \-s
316 Snarf \fIsnaplen\fP bytes of data from each packet rather than the
317 default of 68 (with SunOS's NIT, the minimum is actually 96).
318 68 bytes is adequate for IP, ICMP, TCP
319 and UDP but may truncate protocol information from name server and NFS
320 packets (see below).
321 Packets truncated because of a limited snapshot
322 are indicated in the output with ``[|\fIproto\fP]'', where \fIproto\fP
323 is the name of the protocol level at which the truncation has occurred.
324 Note that taking larger snapshots both increases
325 the amount of time it takes to process packets and, effectively,
326 decreases the amount of packet buffering.
327 This may cause packets to be
328 lost.
329 You should limit \fIsnaplen\fP to the smallest number that will
330 capture the protocol information you're interested in.
331 Setting
332 \fIsnaplen\fP to 0 means use the required length to catch whole packets.
333 .TP
334 .B \-T
335 Force packets selected by "\fIexpression\fP" to be interpreted the
336 specified \fItype\fR.
337 Currently known types are
338 \fBcnfp\fR (Cisco NetFlow protocol),
339 \fBrpc\fR (Remote Procedure Call),
340 \fBrtp\fR (Real-Time Applications protocol),
341 \fBrtcp\fR (Real-Time Applications control protocol),
342 \fBsnmp\fR (Simple Network Management Protocol),
343 \fBvat\fR (Visual Audio Tool),
344 and
345 \fBwb\fR (distributed White Board).
346 .TP
347 .B \-t
348 \fIDon't\fP print a timestamp on each dump line.
349 .TP
350 .B \-tt
351 Print an unformatted timestamp on each dump line.
352 .TP
353 .B \-ttt
354 Print a delta (in micro-seconds) between current and previous line
355 on each dump line.
356 .TP
357 .B \-tttt
358 Print a timestamp in default format proceeded by date on each dump line.
359 .B \-u
360 Print undecoded NFS handles.
361 .TP
362 .B \-v
363 (Slightly more) verbose output.
364 For example, the time to live,
365 identification, total length and options in an IP packet are printed.
366 Also enables additional packet integrity checks such as verifying the
367 IP and ICMP header checksum.
368 .TP
369 .B \-vv
370 Even more verbose output.
371 For example, additional fields are
372 printed from NFS reply packets, and SMB packets are fully decoded.
373 .TP
374 .B \-vvv
375 Even more verbose output.
376 For example,
377 telnet \fBSB\fP ... \fBSE\fP options
378 are printed in full.
379 With
380 .B \-X
381 telnet options are printed in hex as well.
382 .TP
383 .B \-w
384 Write the raw packets to \fIfile\fR rather than parsing and printing
385 them out.
386 They can later be printed with the \-r option.
387 Standard output is used if \fIfile\fR is ``-''.
388 .TP
389 .B \-x
390 Print each packet (minus its link level header) in hex.
391 The smaller of the entire packet or
392 .I snaplen
393 bytes will be printed.
394 .TP
395 .B \-X
396 When printing hex, print ascii too.
397 Thus if
398 .B \-x
399 is also set, the packet is printed in hex/ascii.
400 This is very handy for analysing new protocols.
401 Even if
402 .B \-x
403 is not also set, some parts of some packets may be printed
404 in hex/ascii.
405 .IP "\fI expression\fP"
406 .RS
407 selects which packets will be dumped.
408 If no \fIexpression\fP
409 is given, all packets on the net will be dumped.
410 Otherwise,
411 only packets for which \fIexpression\fP is `true' will be dumped.
412 .LP
413 The \fIexpression\fP consists of one or more
414 .I primitives.
415 Primitives usually consist of an
416 .I id
417 (name or number) preceded by one or more qualifiers.
418 There are three
419 different kinds of qualifier:
420 .IP \fItype\fP
421 qualifiers say what kind of thing the id name or number refers to.
422 Possible types are
423 .BR host ,
424 .B net
425 and
426 .BR port .
427 E.g., `host foo', `net 128.3', `port 20'.
428 If there is no type
429 qualifier,
430 .B host
431 is assumed.
432 .IP \fIdir\fP
433 qualifiers specify a particular transfer direction to and/or from
434 .IR id .
435 Possible directions are
436 .BR src ,
437 .BR dst ,
438 .B "src or dst"
439 and
440 .B "src and"
441 .BR dst .
442 E.g., `src foo', `dst net 128.3', `src or dst port ftp-data'.
443 If
444 there is no dir qualifier,
445 .B "src or dst"
446 is assumed.
447 For `null' link layers (i.e. point to point protocols such as slip) the
448 .B inbound
449 and
450 .B outbound
451 qualifiers can be used to specify a desired direction.
452 .IP \fIproto\fP
453 qualifiers restrict the match to a particular protocol.
454 Possible
455 protos are:
456 .BR ether ,
457 .BR fddi ,
458 .BR tr ,
459 .BR ip ,
460 .BR ip6 ,
461 .BR arp ,
462 .BR rarp ,
463 .BR decnet ,
464 .BR lat ,
465 .BR sca ,
466 .BR moprc ,
467 .BR mopdl ,
468 .BR iso ,
469 .BR esis ,
470 .BR isis ,
471 .BR icmp ,
472 .BR icmp6 ,
473 .B tcp
474 and
475 .BR udp .
476 E.g., `ether src foo', `arp net 128.3', `tcp port 21'.
477 If there is
478 no proto qualifier, all protocols consistent with the type are
479 assumed.
480 E.g., `src foo' means `(ip or arp or rarp) src foo'
481 (except the latter is not legal syntax), `net bar' means `(ip or
482 arp or rarp) net bar' and `port 53' means `(tcp or udp) port 53'.
483 .LP
484 [`fddi' is actually an alias for `ether'; the parser treats them
485 identically as meaning ``the data link level used on the specified
486 network interface.''  FDDI headers contain Ethernet-like source
487 and destination addresses, and often contain Ethernet-like packet
488 types, so you can filter on these FDDI fields just as with the
489 analogous Ethernet fields.
490 FDDI headers also contain other fields,
491 but you cannot name them explicitly in a filter expression.
492 .LP
493 Similarly, `tr' is an alias for `ether'; the previous paragraph's
494 statements about FDDI headers also apply to Token Ring headers.]
495 .LP
496 In addition to the above, there are some special `primitive' keywords
497 that don't follow the pattern:
498 .BR gateway ,
499 .BR broadcast ,
500 .BR less ,
501 .B greater
502 and arithmetic expressions.
503 All of these are described below.
504 .LP
505 More complex filter expressions are built up by using the words
506 .BR and ,
507 .B or
508 and
509 .B not
510 to combine primitives.
511 E.g., `host foo and not port ftp and not port ftp-data'.
512 To save typing, identical qualifier lists can be omitted.
513 E.g.,
514 `tcp dst port ftp or ftp-data or domain' is exactly the same as
515 `tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain'.
516 .LP
517 Allowable primitives are:
518 .IP "\fBdst host \fIhost\fR"
519 True if the IPv4/v6 destination field of the packet is \fIhost\fP,
520 which may be either an address or a name.
521 .IP "\fBsrc host \fIhost\fR"
522 True if the IPv4/v6 source field of the packet is \fIhost\fP.
523 .IP "\fBhost \fIhost\fP
524 True if either the IPv4/v6 source or destination of the packet is \fIhost\fP.
525 Any of the above host expressions can be prepended with the keywords,
526 \fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
527 .in +.5i
528 .nf
529 \fBip host \fIhost\fR
530 .fi
531 .in -.5i
532 which is equivalent to:
533 .in +.5i
534 .nf
535 \fBether proto \fI\\ip\fB and host \fIhost\fR
536 .fi
537 .in -.5i
538 If \fIhost\fR is a name with multiple IP addresses, each address will
539 be checked for a match.
540 .IP "\fBether dst \fIehost\fP
541 True if the ethernet destination address is \fIehost\fP.
542 \fIEhost\fP
543 may be either a name from /etc/ethers or a number (see
544 .IR ethers (3N)
545 for numeric format).
546 .IP "\fBether src \fIehost\fP
547 True if the ethernet source address is \fIehost\fP.
548 .IP "\fBether host \fIehost\fP
549 True if either the ethernet source or destination address is \fIehost\fP.
550 .IP "\fBgateway\fP \fIhost\fP
551 True if the packet used \fIhost\fP as a gateway.
552 I.e., the ethernet
553 source or destination address was \fIhost\fP but neither the IP source
554 nor the IP destination was \fIhost\fP.
555 \fIHost\fP must be a name and
556 must be found both by the machine's host-name-to-IP-address resolution
557 mechanisms (host name file, DNS, NIS, etc.) and by the machine's
558 host-name-to-Ethernet-address resolution mechanism (/etc/ethers, etc.).
559 (An equivalent expression is
560 .in +.5i
561 .nf
562 \fBether host \fIehost \fBand not host \fIhost\fR
563 .fi
564 .in -.5i
565 which can be used with either names or numbers for \fIhost / ehost\fP.)
566 This syntax does not work in IPv6-enabled configuration at this moment.
567 .IP "\fBdst net \fInet\fR"
568 True if the IPv4/v6 destination address of the packet has a network
569 number of \fInet\fP.
570 \fINet\fP may be either a name from /etc/networks
571 or a network number (see \fInetworks(4)\fP for details).
572 .IP "\fBsrc net \fInet\fR"
573 True if the IPv4/v6 source address of the packet has a network
574 number of \fInet\fP.
575 .IP "\fBnet \fInet\fR"
576 True if either the IPv4/v6 source or destination address of the packet has a network
577 number of \fInet\fP.
578 .IP "\fBnet \fInet\fR \fBmask \fInetmask\fR"
579 True if the IP address matches \fInet\fR with the specific \fInetmask\fR.
580 May be qualified with \fBsrc\fR or \fBdst\fR.
581 Note that this syntax is not valid for IPv6 \fInet\fR.
582 .IP "\fBnet \fInet\fR/\fIlen\fR"
583 True if the IPv4/v6 address matches \fInet\fR with a netmask \fIlen\fR
584 bits wide.
585 May be qualified with \fBsrc\fR or \fBdst\fR.
586 .IP "\fBdst port \fIport\fR"
587 True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
588 destination port value of \fIport\fP.
589 The \fIport\fP can be a number or a name used in /etc/services (see
590 .IR tcp (4P)
591 and
592 .IR udp (4P)).
593 If a name is used, both the port
594 number and protocol are checked.
595 If a number or ambiguous name is used,
596 only the port number is checked (e.g., \fBdst port 513\fR will print both
597 tcp/login traffic and udp/who traffic, and \fBport domain\fR will print
598 both tcp/domain and udp/domain traffic).
599 .IP "\fBsrc port \fIport\fR"
600 True if the packet has a source port value of \fIport\fP.
601 .IP "\fBport \fIport\fR"
602 True if either the source or destination port of the packet is \fIport\fP.
603 Any of the above port expressions can be prepended with the keywords,
604 \fBtcp\fP or \fBudp\fP, as in:
605 .in +.5i
606 .nf
607 \fBtcp src port \fIport\fR
608 .fi
609 .in -.5i
610 which matches only tcp packets whose source port is \fIport\fP.
611 .IP "\fBless \fIlength\fR"
612 True if the packet has a length less than or equal to \fIlength\fP.
613 This is equivalent to:
614 .in +.5i
615 .nf
616 \fBlen <= \fIlength\fP.
617 .fi
618 .in -.5i
619 .IP "\fBgreater \fIlength\fR"
620 True if the packet has a length greater than or equal to \fIlength\fP.
621 This is equivalent to:
622 .in +.5i
623 .nf
624 \fBlen >= \fIlength\fP.
625 .fi
626 .in -.5i
627 .IP "\fBip proto \fIprotocol\fR"
628 True if the packet is an IP packet (see
629 .IR ip (4P))
630 of protocol type \fIprotocol\fP.
631 \fIProtocol\fP can be a number or one of the names
632 \fIicmp\fP, \fIicmp6\fP, \fIigmp\fP, \fIigrp\fP, \fIpim\fP, \fIah\fP,
633 \fIesp\fP, \fIvrrp\fP, \fIudp\fP, or \fItcp\fP.
634 Note that the identifiers \fItcp\fP, \fIudp\fP, and \fIicmp\fP are also
635 keywords and must be escaped via backslash (\\), which is \\\\ in the C-shell.
636 Note that this primitive does not chase the protocol header chain.
637 .IP "\fBip6 proto \fIprotocol\fR"
638 True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.
639 Note that this primitive does not chase the protocol header chain.
640 .IP "\fBip6 protochain \fIprotocol\fR"
641 True if the packet is IPv6 packet,
642 and contains protocol header with type \fIprotocol\fR
643 in its protocol header chain.
644 For example,
645 .in +.5i
646 .nf
647 \fBip6 protochain 6\fR
648 .fi
649 .in -.5i
650 matches any IPv6 packet with TCP protocol header in the protocol header chain.
651 The packet may contain, for example,
652 authentication header, routing header, or hop-by-hop option header,
653 between IPv6 header and TCP header.
654 The BPF code emitted by this primitive is complex and
655 cannot be optimized by BPF optimizer code in \fItcpdump\fP,
656 so this can be somewhat slow.
657 .IP "\fBip protochain \fIprotocol\fR"
658 Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
659 .IP "\fBether broadcast\fR"
660 True if the packet is an ethernet broadcast packet.
661 The \fIether\fP
662 keyword is optional.
663 .IP "\fBip broadcast\fR"
664 True if the packet is an IP broadcast packet.
665 It checks for both
666 the all-zeroes and all-ones broadcast conventions, and looks up
667 the local subnet mask.
668 .IP "\fBether multicast\fR"
669 True if the packet is an ethernet multicast packet.
670 The \fIether\fP
671 keyword is optional.
672 This is shorthand for `\fBether[0] & 1 != 0\fP'.
673 .IP "\fBip multicast\fR"
674 True if the packet is an IP multicast packet.
675 .IP "\fBip6 multicast\fR"
676 True if the packet is an IPv6 multicast packet.
677 .IP  "\fBether proto \fIprotocol\fR"
678 True if the packet is of ether type \fIprotocol\fR.
679 \fIProtocol\fP can be a number or one of the names
680 \fIip\fP, \fIip6\fP, \fIarp\fP, \fIrarp\fP, \fIatalk\fP, \fIaarp\fP,
681 \fIdecnet\fP, \fIsca\fP, \fIlat\fP, \fImopdl\fP, \fImoprc\fP,
682 \fIiso\fP, \fIstp\fP, \fIipx\fP, or \fInetbeui\fP.
683 Note these identifiers are also keywords
684 and must be escaped via backslash (\\).
685 .IP
686 [In the case of FDDI (e.g., `\fBfddi protocol arp\fR') and Token Ring
687 (e.g., `\fBtr protocol arp\fR'), for most of those protocols, the
688 protocol identification comes from the 802.2 Logical Link Control (LLC)
689 header, which is usually layered on top of the FDDI or Token Ring
690 header.
691 .IP
692 When filtering for most protocol identifiers on FDDI or Token Ring,
693 \fItcpdump\fR checks only the protocol ID field of an LLC header in
694 so-called SNAP format with an Organizational Unit Identifier (OUI) of
695 0x000000, for encapsulated Ethernet; it doesn't check whether the packet
696 is in SNAP format with an OUI of 0x000000.
697 .IP
698 The exceptions are \fIiso\fP, for which it checks the DSAP (Destination
699 Service Access Point) and SSAP (Source Service Access Point) fields of
700 the LLC header, \fIstp\fP and \fInetbeui\fP, where it checks the DSAP of
701 the LLC header, and \fIatalk\fP, where it checks for a SNAP-format
702 packet with an OUI of 0x080007 and the Appletalk etype.
703 .IP
704 In the case of Ethernet, \fItcpdump\fR checks the Ethernet type field
705 for most of those protocols; the exceptions are \fIiso\fP, \fIsap\fP,
706 and \fInetbeui\fP, for which it checks for an 802.3 frame and then
707 checks the LLC header as it does for FDDI and Token Ring, \fIatalk\fP,
708 where it checks both for the Appletalk etype in an Ethernet frame and
709 for a SNAP-format packet as it does for FDDI and Token Ring, \fIaarp\fP,
710 where it checks for the Appletalk ARP etype in either an Ethernet frame
711 or an 802.2 SNAP frame with an OUI of 0x000000, and \fIipx\fP, where it
712 checks for the IPX etype in an Ethernet frame, the IPX DSAP in the LLC
713 header, the 802.3 with no LLC header encapsulation of IPX, and the IPX
714 etype in a SNAP frame.]
715 .IP "\fBdecnet src \fIhost\fR"
716 True if the DECNET source address is
717 .IR host ,
718 which may be an address of the form ``10.123'', or a DECNET host
719 name.
720 [DECNET host name support is only available on Ultrix systems
721 that are configured to run DECNET.]
722 .IP "\fBdecnet dst \fIhost\fR"
723 True if the DECNET destination address is
724 .IR host .
725 .IP "\fBdecnet host \fIhost\fR"
726 True if either the DECNET source or destination address is
727 .IR host .
728 .IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fInetbeui\fP"
729 Abbreviations for:
730 .in +.5i
731 .nf
732 \fBether proto \fIp\fR
733 .fi
734 .in -.5i
735 where \fIp\fR is one of the above protocols.
736 .IP "\fBlat\fR, \fBmoprc\fR, \fBmopdl\fR"
737 Abbreviations for:
738 .in +.5i
739 .nf
740 \fBether proto \fIp\fR
741 .fi
742 .in -.5i
743 where \fIp\fR is one of the above protocols.
744 Note that
745 \fItcpdump\fP does not currently know how to parse these protocols.
746 .IP "\fBvlan \fI[vlan_id]\fR"
747 True if the packet is an IEEE 802.1Q VLAN packet.
748 If \fI[vlan_id]\fR is specified, only true is the packet has the specified
749 \fIvlan_id\fR.
750 Note that the first \fBvlan\fR keyword encountered in \fIexpression\fR
751 changes the decoding offsets for the remainder of \fIexpression\fR
752 on the assumption that the packet is a VLAN packet.
753 .IP  "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"
754 Abbreviations for:
755 .in +.5i
756 .nf
757 \fBip proto \fIp\fR\fB or ip6 proto \fIp\fR
758 .fi
759 .in -.5i
760 where \fIp\fR is one of the above protocols.
761 .IP "\fBiso proto \fIprotocol\fR"
762 True if the packet is an OSI packet of protocol type \fIprotocol\fP.
763 \fIProtocol\fP can be a number or one of the names
764 \fIclnp\fP, \fIesis\fP, or \fIisis\fP.
765 .IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"
766 Abbreviations for:
767 .in +.5i
768 .nf
769 \fBiso proto \fIp\fR
770 .fi
771 .in -.5i
772 where \fIp\fR is one of the above protocols.
773 Note that \fItcpdump\fR does an incomplete job of parsing these protocols.
774 .IP  "\fIexpr relop expr\fR"
775 True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =, !=,
776 and \fIexpr\fR is an arithmetic expression composed of integer constants
777 (expressed in standard C syntax), the normal binary operators
778 [+, -, *, /, &, |], a length operator, and special packet data accessors.
779 To access
780 data inside the packet, use the following syntax:
781 .in +.5i
782 .nf
783 \fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
784 .fi
785 .in -.5i
786 \fIProto\fR is one of \fBether, fddi, tr,
787 ip, arp, rarp, tcp, udp, icmp\fR or \fBip6\fR, and
788 indicates the protocol layer for the index operation.
789 Note that \fItcp, udp\fR and other upper-layer protocol types only
790 apply to IPv4, not IPv6 (this will be fixed in the future).
791 The byte offset, relative to the indicated protocol layer, is
792 given by \fIexpr\fR.
793 \fISize\fR is optional and indicates the number of bytes in the
794 field of interest; it can be either one, two, or four, and defaults to one.
795 The length operator, indicated by the keyword \fBlen\fP, gives the
796 length of the packet.
797
798 For example, `\fBether[0] & 1 != 0\fP' catches all multicast traffic.
799 The expression `\fBip[0] & 0xf != 5\fP'
800 catches all IP packets with options.
801 The expression
802 `\fBip[6:2] & 0x1fff = 0\fP'
803 catches only unfragmented datagrams and frag zero of fragmented datagrams.
804 This check is implicitly applied to the \fBtcp\fP and \fBudp\fP
805 index operations.
806 For instance, \fBtcp[0]\fP always means the first
807 byte of the TCP \fIheader\fP, and never means the first byte of an
808 intervening fragment.
809
810 Some offsets and field values may be expressed as names rather than
811 as numeric values.
812 The following protocol header field offsets are
813 available: \fBicmptype\fP (ICMP type field), \fBicmpcode\fP (ICMP
814 code field), and \fBtcpflags\fP (TCP flags field).
815
816 The following ICMP type field values are available: \fBicmp-echoreply\fP,
817 \fBicmp-unreach\fP, \fBicmp-sourcequench\fP, \fBicmp-redirect\fP,
818 \fBicmp-echo\fP, \fBicmp-routeradvert\fP, \fBicmp-routersolicit\fP,
819 \fBicmp-timxceed\fP, \fBicmp-paramprob\fP, \fBicmp-tstamp\fP,
820 \fBicmp-tstampreply\fP, \fBicmp-ireq\fP, \fBicmp-ireqreply\fP,
821 \fBicmp-maskreq\fP, \fBicmp-maskreply\fP.
822
823 The following TCP flags field values are available: \fBtcp-fin\fP,
824 \fBtcp-syn\fP, \fBtcp-rst\fP, \fBtcp-push\fP, \fBtcp-push\fP,
825 \fBtcp-ack\fP, \fBtcp-urg\fP.
826 .LP
827 Primitives may be combined using:
828 .IP
829 A parenthesized group of primitives and operators
830 (parentheses are special to the Shell and must be escaped).
831 .IP
832 Negation (`\fB!\fP' or `\fBnot\fP').
833 .IP
834 Concatenation (`\fB&&\fP' or `\fBand\fP').
835 .IP
836 Alternation (`\fB||\fP' or `\fBor\fP').
837 .LP
838 Negation has highest precedence.
839 Alternation and concatenation have equal precedence and associate
840 left to right.
841 Note that explicit \fBand\fR tokens, not juxtaposition,
842 are now required for concatenation.
843 .LP
844 If an identifier is given without a keyword, the most recent keyword
845 is assumed.
846 For example,
847 .in +.5i
848 .nf
849 \fBnot host vs and ace\fR
850 .fi
851 .in -.5i
852 is short for
853 .in +.5i
854 .nf
855 \fBnot host vs and host ace\fR
856 .fi
857 .in -.5i
858 which should not be confused with
859 .in +.5i
860 .nf
861 \fBnot ( host vs or ace )\fR
862 .fi
863 .in -.5i
864 .LP
865 Expression arguments can be passed to \fItcpdump\fP as either a single
866 argument or as multiple arguments, whichever is more convenient.
867 Generally, if the expression contains Shell metacharacters, it is
868 easier to pass it as a single, quoted argument.
869 Multiple arguments are concatenated with spaces before being parsed.
870 .SH EXAMPLES
871 .LP
872 To print all packets arriving at or departing from \fIsundown\fP:
873 .RS
874 .nf
875 \fBtcpdump host sundown\fP
876 .fi
877 .RE
878 .LP
879 To print traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR:
880 .RS
881 .nf
882 \fBtcpdump host helios and \\( hot or ace \\)\fP
883 .fi
884 .RE
885 .LP
886 To print all IP packets between \fIace\fR and any host except \fIhelios\fR:
887 .RS
888 .nf
889 \fBtcpdump ip host ace and not helios\fP
890 .fi
891 .RE
892 .LP
893 To print all traffic between local hosts and hosts at Berkeley:
894 .RS
895 .nf
896 .B
897 tcpdump net ucb-ether
898 .fi
899 .RE
900 .LP
901 To print all ftp traffic through internet gateway \fIsnup\fP:
902 (note that the expression is quoted to prevent the shell from
903 (mis-)interpreting the parentheses):
904 .RS
905 .nf
906 .B
907 tcpdump 'gateway snup and (port ftp or ftp-data)'
908 .fi
909 .RE
910 .LP
911 To print traffic neither sourced from nor destined for local hosts
912 (if you gateway to one other net, this stuff should never make it
913 onto your local net).
914 .RS
915 .nf
916 .B
917 tcpdump ip and not net \fIlocalnet\fP
918 .fi
919 .RE
920 .LP
921 To print the start and end packets (the SYN and FIN packets) of each
922 TCP conversation that involves a non-local host.
923 .RS
924 .nf
925 .B
926 tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocalnet\fP'
927 .fi
928 .RE
929 .LP
930 To print IP packets longer than 576 bytes sent through gateway \fIsnup\fP:
931 .RS
932 .nf
933 .B
934 tcpdump 'gateway snup and ip[2:2] > 576'
935 .fi
936 .RE
937 .LP
938 To print IP broadcast or multicast packets that were
939 .I not
940 sent via ethernet broadcast or multicast:
941 .RS
942 .nf
943 .B
944 tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'
945 .fi
946 .RE
947 .LP
948 To print all ICMP packets that are not echo requests/replies (i.e., not
949 ping packets):
950 .RS
951 .nf
952 .B
953 tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'
954 .fi
955 .RE
956 .SH OUTPUT FORMAT
957 .LP
958 The output of \fItcpdump\fP is protocol dependent.
959 The following
960 gives a brief description and examples of most of the formats.
961 .de HD
962 .sp 1.5
963 .B
964 ..
965 .HD
966 Link Level Headers
967 .LP
968 If the '-e' option is given, the link level header is printed out.
969 On ethernets, the source and destination addresses, protocol,
970 and packet length are printed.
971 .LP
972 On FDDI networks, the  '-e' option causes \fItcpdump\fP to print
973 the `frame control' field,  the source and destination addresses,
974 and the packet length.
975 (The `frame control' field governs the
976 interpretation of the rest of the packet.
977 Normal packets (such
978 as those containing IP datagrams) are `async' packets, with a priority
979 value between 0 and 7; for example, `\fBasync4\fR'.
980 Such packets
981 are assumed to contain an 802.2 Logical Link Control (LLC) packet;
982 the LLC header is printed if it is \fInot\fR an ISO datagram or a
983 so-called SNAP packet.
984 .LP
985 On Token Ring networks, the '-e' option causes \fItcpdump\fP to print
986 the `access control' and `frame control' fields, the source and
987 destination addresses, and the packet length.
988 As on FDDI networks,
989 packets are assumed to contain an LLC packet.
990 Regardless of whether
991 the '-e' option is specified or not, the source routing information is
992 printed for source-routed packets.
993 .LP
994 \fI(N.B.: The following description assumes familiarity with
995 the SLIP compression algorithm described in RFC-1144.)\fP
996 .LP
997 On SLIP links, a direction indicator (``I'' for inbound, ``O'' for outbound),
998 packet type, and compression information are printed out.
999 The packet type is printed first.
1000 The three types are \fIip\fP, \fIutcp\fP, and \fIctcp\fP.
1001 No further link information is printed for \fIip\fR packets.
1002 For TCP packets, the connection identifier is printed following the type.
1003 If the packet is compressed, its encoded header is printed out.
1004 The special cases are printed out as
1005 \fB*S+\fIn\fR and \fB*SA+\fIn\fR, where \fIn\fR is the amount by which
1006 the sequence number (or sequence number and ack) has changed.
1007 If it is not a special case,
1008 zero or more changes are printed.
1009 A change is indicated by U (urgent pointer), W (window), A (ack),
1010 S (sequence number), and I (packet ID), followed by a delta (+n or -n),
1011 or a new value (=n).
1012 Finally, the amount of data in the packet and compressed header length
1013 are printed.
1014 .LP
1015 For example, the following line shows an outbound compressed TCP packet,
1016 with an implicit connection identifier; the ack has changed by 6,
1017 the sequence number by 49, and the packet ID by 6; there are 3 bytes of
1018 data and 6 bytes of compressed header:
1019 .RS
1020 .nf
1021 \fBO ctcp * A+6 S+49 I+6 3 (6)\fP
1022 .fi
1023 .RE
1024 .HD
1025 ARP/RARP Packets
1026 .LP
1027 Arp/rarp output shows the type of request and its arguments.
1028 The
1029 format is intended to be self explanatory.
1030 Here is a short sample taken from the start of an `rlogin' from
1031 host \fIrtsg\fP to host \fIcsam\fP:
1032 .RS
1033 .nf
1034 .sp .5
1035 \f(CWarp who-has csam tell rtsg
1036 arp reply csam is-at CSAM\fR
1037 .sp .5
1038 .fi
1039 .RE
1040 The first line says that rtsg sent an arp packet asking
1041 for the ethernet address of internet host csam.
1042 Csam
1043 replies with its ethernet address (in this example, ethernet addresses
1044 are in caps and internet addresses in lower case).
1045 .LP
1046 This would look less redundant if we had done \fItcpdump \-n\fP:
1047 .RS
1048 .nf
1049 .sp .5
1050 \f(CWarp who-has 128.3.254.6 tell 128.3.254.68
1051 arp reply 128.3.254.6 is-at 02:07:01:00:01:c4\fP
1052 .fi
1053 .RE
1054 .LP
1055 If we had done \fItcpdump \-e\fP, the fact that the first packet is
1056 broadcast and the second is point-to-point would be visible:
1057 .RS
1058 .nf
1059 .sp .5
1060 \f(CWRTSG Broadcast 0806  64: arp who-has csam tell rtsg
1061 CSAM RTSG 0806  64: arp reply csam is-at CSAM\fR
1062 .sp .5
1063 .fi
1064 .RE
1065 For the first packet this says the ethernet source address is RTSG, the
1066 destination is the ethernet broadcast address, the type field
1067 contained hex 0806 (type ETHER_ARP) and the total length was 64 bytes.
1068 .HD
1069 TCP Packets
1070 .LP
1071 \fI(N.B.:The following description assumes familiarity with
1072 the TCP protocol described in RFC-793.
1073 If you are not familiar
1074 with the protocol, neither this description nor \fItcpdump\fP will
1075 be of much use to you.)\fP
1076 .LP
1077 The general format of a tcp protocol line is:
1078 .RS
1079 .nf
1080 .sp .5
1081 \fIsrc > dst: flags data-seqno ack window urgent options\fP
1082 .sp .5
1083 .fi
1084 .RE
1085 \fISrc\fP and \fIdst\fP are the source and destination IP
1086 addresses and ports.
1087 \fIFlags\fP are some combination of S (SYN),
1088 F (FIN), P (PUSH) or R (RST) or a single `.' (no flags).
1089 \fIData-seqno\fP describes the portion of sequence space covered
1090 by the data in this packet (see example below).
1091 \fIAck\fP is sequence number of the next data expected the other
1092 direction on this connection.
1093 \fIWindow\fP is the number of bytes of receive buffer space available
1094 the other direction on this connection.
1095 \fIUrg\fP indicates there is `urgent' data in the packet.
1096 \fIOptions\fP are tcp options enclosed in angle brackets (e.g., <mss 1024>).
1097 .LP
1098 \fISrc, dst\fP and \fIflags\fP are always present.
1099 The other fields
1100 depend on the contents of the packet's tcp protocol header and
1101 are output only if appropriate.
1102 .LP
1103 Here is the opening portion of an rlogin from host \fIrtsg\fP to
1104 host \fIcsam\fP.
1105 .RS
1106 .nf
1107 .sp .5
1108 \s-2\f(CWrtsg.1023 > csam.login: S 768512:768512(0) win 4096 <mss 1024>
1109 csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 <mss 1024>
1110 rtsg.1023 > csam.login: . ack 1 win 4096
1111 rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096
1112 csam.login > rtsg.1023: . ack 2 win 4096
1113 rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096
1114 csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077
1115 csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1
1116 csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1\fR\s+2
1117 .sp .5
1118 .fi
1119 .RE
1120 The first line says that tcp port 1023 on rtsg sent a packet
1121 to port \fIlogin\fP
1122 on csam.
1123 The \fBS\fP indicates that the \fISYN\fP flag was set.
1124 The packet sequence number was 768512 and it contained no data.
1125 (The notation is `first:last(nbytes)' which means `sequence
1126 numbers \fIfirst\fP
1127 up to but not including \fIlast\fP which is \fInbytes\fP bytes of user data'.)
1128 There was no piggy-backed ack, the available receive window was 4096
1129 bytes and there was a max-segment-size option requesting an mss of
1130 1024 bytes.
1131 .LP
1132 Csam replies with a similar packet except it includes a piggy-backed
1133 ack for rtsg's SYN.
1134 Rtsg then acks csam's SYN.
1135 The `.' means no
1136 flags were set.
1137 The packet contained no data so there is no data sequence number.
1138 Note that the ack sequence
1139 number is a small integer (1).
1140 The first time \fItcpdump\fP sees a
1141 tcp `conversation', it prints the sequence number from the packet.
1142 On subsequent packets of the conversation, the difference between
1143 the current packet's sequence number and this initial sequence number
1144 is printed.
1145 This means that sequence numbers after the
1146 first can be interpreted
1147 as relative byte positions in the conversation's data stream (with the
1148 first data byte each direction being `1').
1149 `-S' will override this
1150 feature, causing the original sequence numbers to be output.
1151 .LP
1152 On the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20
1153 in the rtsg \(-> csam side of the conversation).
1154 The PUSH flag is set in the packet.
1155 On the 7th line, csam says it's received data sent by rtsg up to
1156 but not including byte 21.
1157 Most of this data is apparently sitting in the
1158 socket buffer since csam's receive window has gotten 19 bytes smaller.
1159 Csam also sends one byte of data to rtsg in this packet.
1160 On the 8th and 9th lines,
1161 csam sends two bytes of urgent, pushed data to rtsg.
1162 .LP
1163 If the snapshot was small enough that \fItcpdump\fP didn't capture
1164 the full TCP header, it interprets as much of the header as it can
1165 and then reports ``[|\fItcp\fP]'' to indicate the remainder could not
1166 be interpreted.
1167 If the header contains a bogus option (one with a length
1168 that's either too small or beyond the end of the header), \fItcpdump\fP
1169 reports it as ``[\fIbad opt\fP]'' and does not interpret any further
1170 options (since it's impossible to tell where they start).
1171 If the header
1172 length indicates options are present but the IP datagram length is not
1173 long enough for the options to actually be there, \fItcpdump\fP reports
1174 it as ``[\fIbad hdr length\fP]''.
1175 .HD
1176 .B Capturing TCP packets with particular flag combinations (SYN-ACK, URG-ACK, etc.)
1177 .PP
1178 There are 8 bits in the control bits section of the TCP header:
1179 .IP
1180 .I CWR | ECE | URG | ACK | PSH | RST | SYN | FIN
1181 .PP
1182 Let's assume that we want to watch packets used in establishing
1183 a TCP connection.
1184 Recall that TCP uses a 3-way handshake protocol
1185 when it initializes a new connection; the connection sequence with
1186 regard to the TCP control bits is
1187 .PP
1188 .RS
1189 1) Caller sends SYN
1190 .RE
1191 .RS
1192 2) Recipient responds with SYN, ACK
1193 .RE
1194 .RS
1195 3) Caller sends ACK
1196 .RE
1197 .PP
1198 Now we're interested in capturing packets that have only the
1199 SYN bit set (Step 1).
1200 Note that we don't want packets from step 2
1201 (SYN-ACK), just a plain initial SYN.
1202 What we need is a correct filter
1203 expression for \fItcpdump\fP.
1204 .PP
1205 Recall the structure of a TCP header without options:
1206 .PP
1207 .nf
1208  0                            15                              31
1209 -----------------------------------------------------------------
1210 |          source port          |       destination port        |
1211 -----------------------------------------------------------------
1212 |                        sequence number                        |
1213 -----------------------------------------------------------------
1214 |                     acknowledgment number                     |
1215 -----------------------------------------------------------------
1216 |  HL   | rsvd  |C|E|U|A|P|R|S|F|        window size            |
1217 -----------------------------------------------------------------
1218 |         TCP checksum          |       urgent pointer          |
1219 -----------------------------------------------------------------
1220 .fi
1221 .PP
1222 A TCP header usually holds 20 octets of data, unless options are
1223 present.
1224 The first line of the graph contains octets 0 - 3, the
1225 second line shows octets 4 - 7 etc.
1226 .PP
1227 Starting to count with 0, the relevant TCP control bits are contained
1228 in octet 13:
1229 .PP
1230 .nf
1231  0             7|             15|             23|             31
1232 ----------------|---------------|---------------|----------------
1233 |  HL   | rsvd  |C|E|U|A|P|R|S|F|        window size            |
1234 ----------------|---------------|---------------|----------------
1235 |               |  13th octet   |               |               |
1236 .fi
1237 .PP
1238 Let's have a closer look at octet no. 13:
1239 .PP
1240 .nf
1241                 |               |
1242                 |---------------|
1243                 |C|E|U|A|P|R|S|F|
1244                 |---------------|
1245                 |7   5   3     0|
1246 .fi
1247 .PP
1248 These are the TCP control bits we are interested
1249 in.
1250 We have numbered the bits in this octet from 0 to 7, right to
1251 left, so the PSH bit is bit number 3, while the URG bit is number 5.
1252 .PP
1253 Recall that we want to capture packets with only SYN set.
1254 Let's see what happens to octet 13 if a TCP datagram arrives
1255 with the SYN bit set in its header:
1256 .PP
1257 .nf
1258                 |C|E|U|A|P|R|S|F|
1259                 |---------------|
1260                 |0 0 0 0 0 0 1 0|
1261                 |---------------|
1262                 |7 6 5 4 3 2 1 0|
1263 .fi
1264 .PP
1265 Looking at the
1266 control bits section we see that only bit number 1 (SYN) is set.
1267 .PP
1268 Assuming that octet number 13 is an 8-bit unsigned integer in
1269 network byte order, the binary value of this octet is
1270 .IP
1271 00000010
1272 .PP
1273 and its decimal representation is
1274 .PP
1275 .nf
1276    7     6     5     4     3     2     1     0
1277 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 1*2 + 0*2  =  2
1278 .fi
1279 .PP
1280 We're almost done, because now we know that if only SYN is set,
1281 the value of the 13th octet in the TCP header, when interpreted
1282 as a 8-bit unsigned integer in network byte order, must be exactly 2.
1283 .PP
1284 This relationship can be expressed as
1285 .RS
1286 .B
1287 tcp[13] == 2
1288 .RE
1289 .PP
1290 We can use this expression as the filter for \fItcpdump\fP in order
1291 to watch packets which have only SYN set:
1292 .RS
1293 .B
1294 tcpdump -i xl0 tcp[13] == 2
1295 .RE
1296 .PP
1297 The expression says "let the 13th octet of a TCP datagram have
1298 the decimal value 2", which is exactly what we want.
1299 .PP
1300 Now, let's assume that we need to capture SYN packets, but we
1301 don't care if ACK or any other TCP control bit is set at the
1302 same time.
1303 Let's see what happens to octet 13 when a TCP datagram
1304 with SYN-ACK set arrives:
1305 .PP
1306 .nf
1307      |C|E|U|A|P|R|S|F|
1308      |---------------|
1309      |0 0 0 1 0 0 1 0|
1310      |---------------|
1311      |7 6 5 4 3 2 1 0|
1312 .fi
1313 .PP
1314 Now bits 1 and 4 are set in the 13th octet.
1315 The binary value of
1316 octet 13 is
1317 .IP
1318      00010010
1319 .PP
1320 which translates to decimal
1321 .PP
1322 .nf
1323    7     6     5     4     3     2     1     0
1324 0*2 + 0*2 + 0*2 + 1*2 + 0*2 + 0*2 + 1*2 + 0*2   = 18
1325 .fi
1326 .PP
1327 Now we can't just use 'tcp[13] == 18' in the \fItcpdump\fP filter
1328 expression, because that would select only those packets that have
1329 SYN-ACK set, but not those with only SYN set.
1330 Remember that we don't care
1331 if ACK or any other control bit is set as long as SYN is set.
1332 .PP
1333 In order to achieve our goal, we need to logically AND the
1334 binary value of octet 13 with some other value to preserve
1335 the SYN bit.
1336 We know that we want SYN to be set in any case,
1337 so we'll logically AND the value in the 13th octet with
1338 the binary value of a SYN:
1339 .PP
1340 .nf
1341
1342           00010010 SYN-ACK              00000010 SYN
1343      AND  00000010 (we want SYN)   AND  00000010 (we want SYN)
1344           --------                      --------
1345      =    00000010                 =    00000010
1346 .fi
1347 .PP
1348 We see that this AND operation delivers the same result
1349 regardless whether ACK or another TCP control bit is set.
1350 The decimal representation of the AND value as well as
1351 the result of this operation is 2 (binary 00000010),
1352 so we know that for packets with SYN set the following
1353 relation must hold true:
1354 .IP
1355 ( ( value of octet 13 ) AND ( 2 ) ) == ( 2 )
1356 .PP
1357 This points us to the \fItcpdump\fP filter expression
1358 .RS
1359 .B
1360      tcpdump -i xl0 'tcp[13] & 2 == 2'
1361 .RE
1362 .PP
1363 Note that you should use single quotes or a backslash
1364 in the expression to hide the AND ('&') special character
1365 from the shell.
1366 .HD
1367 .B
1368 UDP Packets
1369 .LP
1370 UDP format is illustrated by this rwho packet:
1371 .RS
1372 .nf
1373 .sp .5
1374 \f(CWactinide.who > broadcast.who: udp 84\fP
1375 .sp .5
1376 .fi
1377 .RE
1378 This says that port \fIwho\fP on host \fIactinide\fP sent a udp
1379 datagram to port \fIwho\fP on host \fIbroadcast\fP, the Internet
1380 broadcast address.
1381 The packet contained 84 bytes of user data.
1382 .LP
1383 Some UDP services are recognized (from the source or destination
1384 port number) and the higher level protocol information printed.
1385 In particular, Domain Name service requests (RFC-1034/1035) and Sun
1386 RPC calls (RFC-1050) to NFS.
1387 .HD
1388 UDP Name Server Requests
1389 .LP
1390 \fI(N.B.:The following description assumes familiarity with
1391 the Domain Service protocol described in RFC-1035.
1392 If you are not familiar
1393 with the protocol, the following description will appear to be written
1394 in greek.)\fP
1395 .LP
1396 Name server requests are formatted as
1397 .RS
1398 .nf
1399 .sp .5
1400 \fIsrc > dst: id op? flags qtype qclass name (len)\fP
1401 .sp .5
1402 \f(CWh2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)\fR
1403 .sp .5
1404 .fi
1405 .RE
1406 Host \fIh2opolo\fP asked the domain server on \fIhelios\fP for an
1407 address record (qtype=A) associated with the name \fIucbvax.berkeley.edu.\fP
1408 The query id was `3'.
1409 The `+' indicates the \fIrecursion desired\fP flag
1410 was set.
1411 The query length was 37 bytes, not including the UDP and
1412 IP protocol headers.
1413 The query operation was the normal one, \fIQuery\fP,
1414 so the op field was omitted.
1415 If the op had been anything else, it would
1416 have been printed between the `3' and the `+'.
1417 Similarly, the qclass was the normal one,
1418 \fIC_IN\fP, and omitted.
1419 Any other qclass would have been printed
1420 immediately after the `A'.
1421 .LP
1422 A few anomalies are checked and may result in extra fields enclosed in
1423 square brackets:  If a query contains an answer, authority records or
1424 additional records section,
1425 .IR ancount ,
1426 .IR nscount ,
1427 or
1428 .I arcount
1429 are printed as `[\fIn\fPa]', `[\fIn\fPn]' or  `[\fIn\fPau]' where \fIn\fP
1430 is the appropriate count.
1431 If any of the response bits are set (AA, RA or rcode) or any of the
1432 `must be zero' bits are set in bytes two and three, `[b2&3=\fIx\fP]'
1433 is printed, where \fIx\fP is the hex value of header bytes two and three.
1434 .HD
1435 UDP Name Server Responses
1436 .LP
1437 Name server responses are formatted as
1438 .RS
1439 .nf
1440 .sp .5
1441 \fIsrc > dst:  id op rcode flags a/n/au type class data (len)\fP
1442 .sp .5
1443 \f(CWhelios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)
1444 helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)\fR
1445 .sp .5
1446 .fi
1447 .RE
1448 In the first example, \fIhelios\fP responds to query id 3 from \fIh2opolo\fP
1449 with 3 answer records, 3 name server records and 7 additional records.
1450 The first answer record is type A (address) and its data is internet
1451 address 128.32.137.3.
1452 The total size of the response was 273 bytes,
1453 excluding UDP and IP headers.
1454 The op (Query) and response code
1455 (NoError) were omitted, as was the class (C_IN) of the A record.
1456 .LP
1457 In the second example, \fIhelios\fP responds to query 2 with a
1458 response code of non-existent domain (NXDomain) with no answers,
1459 one name server and no authority records.
1460 The `*' indicates that
1461 the \fIauthoritative answer\fP bit was set.
1462 Since there were no
1463 answers, no type, class or data were printed.
1464 .LP
1465 Other flag characters that might appear are `\-' (recursion available,
1466 RA, \fInot\fP set) and `|' (truncated message, TC, set).
1467 If the
1468 `question' section doesn't contain exactly one entry, `[\fIn\fPq]'
1469 is printed.
1470 .LP
1471 Note that name server requests and responses tend to be large and the
1472 default \fIsnaplen\fP of 68 bytes may not capture enough of the packet
1473 to print.
1474 Use the \fB\-s\fP flag to increase the snaplen if you
1475 need to seriously investigate name server traffic.
1476 `\fB\-s 128\fP'
1477 has worked well for me.
1478
1479 .HD
1480 SMB/CIFS decoding
1481 .LP
1482 \fItcpdump\fP now includes fairly extensive SMB/CIFS/NBT decoding for data
1483 on UDP/137, UDP/138 and TCP/139.
1484 Some primitive decoding of IPX and
1485 NetBEUI SMB data is also done.
1486
1487 By default a fairly minimal decode is done, with a much more detailed
1488 decode done if -v is used.
1489 Be warned that with -v a single SMB packet
1490 may take up a page or more, so only use -v if you really want all the
1491 gory details.
1492
1493 If you are decoding SMB sessions containing unicode strings then you
1494 may wish to set the environment variable USE_UNICODE to 1.
1495 A patch to
1496 auto-detect unicode srings would be welcome.
1497
1498 For information on SMB packet formats and what all te fields mean see
1499 www.cifs.org or the pub/samba/specs/ directory on your favourite
1500 samba.org mirror site.
1501 The SMB patches were written by Andrew Tridgell
1502 (tridge@samba.org).
1503
1504 .HD
1505 NFS Requests and Replies
1506 .LP
1507 Sun NFS (Network File System) requests and replies are printed as:
1508 .RS
1509 .nf
1510 .sp .5
1511 \fIsrc.xid > dst.nfs: len op args\fP
1512 \fIsrc.nfs > dst.xid: reply stat len op results\fP
1513 .sp .5
1514 \f(CW
1515 sushi.6709 > wrl.nfs: 112 readlink fh 21,24/10.73165
1516 wrl.nfs > sushi.6709: reply ok 40 readlink "../var"
1517 sushi.201b > wrl.nfs:
1518         144 lookup fh 9,74/4096.6878 "xcolors"
1519 wrl.nfs > sushi.201b:
1520         reply ok 128 lookup fh 9,74/4134.3150
1521 \fR
1522 .sp .5
1523 .fi
1524 .RE
1525 In the first line, host \fIsushi\fP sends a transaction with id \fI6709\fP
1526 to \fIwrl\fP (note that the number following the src host is a
1527 transaction id, \fInot\fP the source port).
1528 The request was 112 bytes,
1529 excluding the UDP and IP headers.
1530 The operation was a \fIreadlink\fP
1531 (read symbolic link) on file handle (\fIfh\fP) 21,24/10.731657119.
1532 (If one is lucky, as in this case, the file handle can be interpreted
1533 as a major,minor device number pair, followed by the inode number and
1534 generation number.)
1535 \fIWrl\fP replies `ok' with the contents of the link.
1536 .LP
1537 In the third line, \fIsushi\fP asks \fIwrl\fP to lookup the name
1538 `\fIxcolors\fP' in directory file 9,74/4096.6878.
1539 Note that the data printed
1540 depends on the operation type.
1541 The format is intended to be self
1542 explanatory if read in conjunction with
1543 an NFS protocol spec.
1544 .LP
1545 If the \-v (verbose) flag is given, additional information is printed.
1546 For example:
1547 .RS
1548 .nf
1549 .sp .5
1550 \f(CW
1551 sushi.1372a > wrl.nfs:
1552         148 read fh 21,11/12.195 8192 bytes @ 24576
1553 wrl.nfs > sushi.1372a:
1554         reply ok 1472 read REG 100664 ids 417/0 sz 29388
1555 \fP
1556 .sp .5
1557 .fi
1558 .RE
1559 (\-v also prints the IP header TTL, ID, length, and fragmentation fields,
1560 which have been omitted from this example.)  In the first line,
1561 \fIsushi\fP asks \fIwrl\fP to read 8192 bytes from file 21,11/12.195,
1562 at byte offset 24576.
1563 \fIWrl\fP replies `ok'; the packet shown on the
1564 second line is the first fragment of the reply, and hence is only 1472
1565 bytes long (the other bytes will follow in subsequent fragments, but
1566 these fragments do not have NFS or even UDP headers and so might not be
1567 printed, depending on the filter expression used).
1568 Because the \-v flag
1569 is given, some of the file attributes (which are returned in addition
1570 to the file data) are printed: the file type (``REG'', for regular file),
1571 the file mode (in octal), the uid and gid, and the file size.
1572 .LP
1573 If the \-v flag is given more than once, even more details are printed.
1574 .LP
1575 Note that NFS requests are very large and much of the detail won't be printed
1576 unless \fIsnaplen\fP is increased.
1577 Try using `\fB\-s 192\fP' to watch
1578 NFS traffic.
1579 .LP
1580 NFS reply packets do not explicitly identify the RPC operation.
1581 Instead,
1582 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
1583 replies using the transaction ID.
1584 If a reply does not closely follow the
1585 corresponding request, it might not be parsable.
1586 .HD
1587 AFS Requests and Replies
1588 .LP
1589 Transarc AFS (Andrew File System) requests and replies are printed
1590 as:
1591 .HD
1592 .RS
1593 .nf
1594 .sp .5
1595 \fIsrc.sport > dst.dport: rx packet-type\fP
1596 \fIsrc.sport > dst.dport: rx packet-type service call call-name args\fP
1597 \fIsrc.sport > dst.dport: rx packet-type service reply call-name args\fP
1598 .sp .5
1599 \f(CW
1600 elvis.7001 > pike.afsfs:
1601         rx data fs call rename old fid 536876964/1/1 ".newsrc.new"
1602         new fid 536876964/1/1 ".newsrc"
1603 pike.afsfs > elvis.7001: rx data fs reply rename
1604 \fR
1605 .sp .5
1606 .fi
1607 .RE
1608 In the first line, host elvis sends a RX packet to pike.
1609 This was
1610 a RX data packet to the fs (fileserver) service, and is the start of
1611 an RPC call.
1612 The RPC call was a rename, with the old directory file id
1613 of 536876964/1/1 and an old filename of `.newsrc.new', and a new directory
1614 file id of 536876964/1/1 and a new filename of `.newsrc'.
1615 The host pike
1616 responds with a RPC reply to the rename call (which was successful, because
1617 it was a data packet and not an abort packet).
1618 .LP
1619 In general, all AFS RPCs are decoded at least by RPC call name.
1620 Most
1621 AFS RPCs have at least some of the arguments decoded (generally only
1622 the `interesting' arguments, for some definition of interesting).
1623 .LP
1624 The format is intended to be self-describing, but it will probably
1625 not be useful to people who are not familiar with the workings of
1626 AFS and RX.
1627 .LP
1628 If the -v (verbose) flag is given twice, acknowledgement packets and
1629 additional header information is printed, such as the the RX call ID,
1630 call number, sequence number, serial number, and the RX packet flags.
1631 .LP
1632 If the -v flag is given twice, additional information is printed,
1633 such as the the RX call ID, serial number, and the RX packet flags.
1634 The MTU negotiation information is also printed from RX ack packets.
1635 .LP
1636 If the -v flag is given three times, the security index and service id
1637 are printed.
1638 .LP
1639 Error codes are printed for abort packets, with the exception of Ubik
1640 beacon packets (because abort packets are used to signify a yes vote
1641 for the Ubik protocol).
1642 .LP
1643 Note that AFS requests are very large and many of the arguments won't
1644 be printed unless \fIsnaplen\fP is increased.
1645 Try using `\fB-s 256\fP'
1646 to watch AFS traffic.
1647 .LP
1648 AFS reply packets do not explicitly identify the RPC operation.
1649 Instead,
1650 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
1651 replies using the call number and service ID.
1652 If a reply does not closely
1653 follow the
1654 corresponding request, it might not be parsable.
1655
1656 .HD
1657 KIP Appletalk (DDP in UDP)
1658 .LP
1659 Appletalk DDP packets encapsulated in UDP datagrams are de-encapsulated
1660 and dumped as DDP packets (i.e., all the UDP header information is
1661 discarded).
1662 The file
1663 .I /etc/atalk.names
1664 is used to translate appletalk net and node numbers to names.
1665 Lines in this file have the form
1666 .RS
1667 .nf
1668 .sp .5
1669 \fInumber       name\fP
1670
1671 \f(CW1.254              ether
1672 16.1            icsd-net
1673 1.254.110       ace\fR
1674 .sp .5
1675 .fi
1676 .RE
1677 The first two lines give the names of appletalk networks.
1678 The third
1679 line gives the name of a particular host (a host is distinguished
1680 from a net by the 3rd octet in the number \-
1681 a net number \fImust\fP have two octets and a host number \fImust\fP
1682 have three octets.)  The number and name should be separated by
1683 whitespace (blanks or tabs).
1684 The
1685 .I /etc/atalk.names
1686 file may contain blank lines or comment lines (lines starting with
1687 a `#').
1688 .LP
1689 Appletalk addresses are printed in the form
1690 .RS
1691 .nf
1692 .sp .5
1693 \fInet.host.port\fP
1694
1695 \f(CW144.1.209.2 > icsd-net.112.220
1696 office.2 > icsd-net.112.220
1697 jssmag.149.235 > icsd-net.2\fR
1698 .sp .5
1699 .fi
1700 .RE
1701 (If the
1702 .I /etc/atalk.names
1703 doesn't exist or doesn't contain an entry for some appletalk
1704 host/net number, addresses are printed in numeric form.)
1705 In the first example, NBP (DDP port 2) on net 144.1 node 209
1706 is sending to whatever is listening on port 220 of net icsd node 112.
1707 The second line is the same except the full name of the source node
1708 is known (`office').
1709 The third line is a send from port 235 on
1710 net jssmag node 149 to broadcast on the icsd-net NBP port (note that
1711 the broadcast address (255) is indicated by a net name with no host
1712 number \- for this reason it's a good idea to keep node names and
1713 net names distinct in /etc/atalk.names).
1714 .LP
1715 NBP (name binding protocol) and ATP (Appletalk transaction protocol)
1716 packets have their contents interpreted.
1717 Other protocols just dump
1718 the protocol name (or number if no name is registered for the
1719 protocol) and packet size.
1720
1721 \fBNBP packets\fP are formatted like the following examples:
1722 .RS
1723 .nf
1724 .sp .5
1725 \s-2\f(CWicsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*"
1726 jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250
1727 techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186\fR\s+2
1728 .sp .5
1729 .fi
1730 .RE
1731 The first line is a name lookup request for laserwriters sent by net icsd host
1732 112 and broadcast on net jssmag.
1733 The nbp id for the lookup is 190.
1734 The second line shows a reply for this request (note that it has the
1735 same id) from host jssmag.209 saying that it has a laserwriter
1736 resource named "RM1140" registered on port 250.
1737 The third line is
1738 another reply to the same request saying host techpit has laserwriter
1739 "techpit" registered on port 186.
1740
1741 \fBATP packet\fP formatting is demonstrated by the following example:
1742 .RS
1743 .nf
1744 .sp .5
1745 \s-2\f(CWjssmag.209.165 > helios.132: atp-req  12266<0-7> 0xae030001
1746 helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000
1747 helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000
1748 helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000
1749 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
1750 helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000
1751 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
1752 helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000
1753 helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000
1754 jssmag.209.165 > helios.132: atp-req  12266<3,5> 0xae030001
1755 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
1756 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
1757 jssmag.209.165 > helios.132: atp-rel  12266<0-7> 0xae030001
1758 jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002\fR\s+2
1759 .sp .5
1760 .fi
1761 .RE
1762 Jssmag.209 initiates transaction id 12266 with host helios by requesting
1763 up to 8 packets (the `<0-7>').
1764 The hex number at the end of the line
1765 is the value of the `userdata' field in the request.
1766 .LP
1767 Helios responds with 8 512-byte packets.
1768 The `:digit' following the
1769 transaction id gives the packet sequence number in the transaction
1770 and the number in parens is the amount of data in the packet,
1771 excluding the atp header.
1772 The `*' on packet 7 indicates that the
1773 EOM bit was set.
1774 .LP
1775 Jssmag.209 then requests that packets 3 & 5 be retransmitted.
1776 Helios
1777 resends them then jssmag.209 releases the transaction.
1778 Finally,
1779 jssmag.209 initiates the next request.
1780 The `*' on the request
1781 indicates that XO (`exactly once') was \fInot\fP set.
1782
1783 .HD
1784 IP Fragmentation
1785 .LP
1786 Fragmented Internet datagrams are printed as
1787 .RS
1788 .nf
1789 .sp .5
1790 \fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB+)\fR
1791 \fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB)\fR
1792 .sp .5
1793 .fi
1794 .RE
1795 (The first form indicates there are more fragments.
1796 The second
1797 indicates this is the last fragment.)
1798 .LP
1799 \fIId\fP is the fragment id.
1800 \fISize\fP is the fragment
1801 size (in bytes) excluding the IP header.
1802 \fIOffset\fP is this
1803 fragment's offset (in bytes) in the original datagram.
1804 .LP
1805 The fragment information is output for each fragment.
1806 The first
1807 fragment contains the higher level protocol header and the frag
1808 info is printed after the protocol info.
1809 Fragments
1810 after the first contain no higher level protocol header and the
1811 frag info is printed after the source and destination addresses.
1812 For example, here is part of an ftp from arizona.edu to lbl-rtsg.arpa
1813 over a CSNET connection that doesn't appear to handle 576 byte datagrams:
1814 .RS
1815 .nf
1816 .sp .5
1817 \s-2\f(CWarizona.ftp-data > rtsg.1170: . 1024:1332(308) ack 1 win 4096 (frag 595a:328@0+)
1818 arizona > rtsg: (frag 595a:204@328)
1819 rtsg.1170 > arizona.ftp-data: . ack 1536 win 2560\fP\s+2
1820 .sp .5
1821 .fi
1822 .RE
1823 There are a couple of things to note here:  First, addresses in the
1824 2nd line don't include port numbers.
1825 This is because the TCP
1826 protocol information is all in the first fragment and we have no idea
1827 what the port or sequence numbers are when we print the later fragments.
1828 Second, the tcp sequence information in the first line is printed as if there
1829 were 308 bytes of user data when, in fact, there are 512 bytes (308 in
1830 the first frag and 204 in the second).
1831 If you are looking for holes
1832 in the sequence space or trying to match up acks
1833 with packets, this can fool you.
1834 .LP
1835 A packet with the IP \fIdon't fragment\fP flag is marked with a
1836 trailing \fB(DF)\fP.
1837 .HD
1838 Timestamps
1839 .LP
1840 By default, all output lines are preceded by a timestamp.
1841 The timestamp
1842 is the current clock time in the form
1843 .RS
1844 .nf
1845 \fIhh:mm:ss.frac\fP
1846 .fi
1847 .RE
1848 and is as accurate as the kernel's clock.
1849 The timestamp reflects the time the kernel first saw the packet.
1850 No attempt
1851 is made to account for the time lag between when the
1852 ethernet interface removed the packet from the wire and when the kernel
1853 serviced the `new packet' interrupt.
1854 .SH "SEE ALSO"
1855 bpf(4), pcap(3)
1856 .SH AUTHORS
1857 The original authors are:
1858 .LP
1859 Van Jacobson,
1860 Craig Leres and
1861 Steven McCanne, all of the
1862 Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
1863 .LP
1864 It is currently being maintained by tcpdump.org.
1865 .LP
1866 The current version is available via http:
1867 .LP
1868 .RS
1869 .I http://www.tcpdump.org/
1870 .RE
1871 .LP
1872 The original distribution is available via anonymous ftp:
1873 .LP
1874 .RS
1875 .I ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
1876 .RE
1877 .LP
1878 IPv6/IPsec support is added by WIDE/KAME project.
1879 This program uses Eric Young's SSLeay library, under specific configuration.
1880 .SH BUGS
1881 Please send problems, bugs, questions, desirable enhancements, etc. to:
1882 .LP
1883 .RS
1884 tcpdump-workers@tcpdump.org
1885 .RE
1886 .LP
1887 Please send source code contributions, etc. to:
1888 .LP
1889 .RS
1890 patches@tcpdump.org
1891 .RE
1892 .LP
1893 NIT doesn't let you watch your own outbound traffic, BPF will.
1894 We recommend that you use the latter.
1895 .LP
1896 On Linux systems with 2.0[.x] kernels:
1897 .IP
1898 packets on the loopback device will be seen twice;
1899 .IP
1900 packet filtering cannot be done in the kernel, so that all packets must
1901 be copied from the kernel in order to be filtered in user mode;
1902 .IP
1903 all of a packet, not just the part that's within the snapshot length,
1904 will be copied from the kernel (the 2.0[.x] packet capture mechanism, if
1905 asked to copy only part of a packet to userland, will not report the
1906 true length of the packet; this would cause most IP packets to get an
1907 error from
1908 .BR tcpdump ).
1909 .LP
1910 We recommend that you upgrade to a 2.2 or later kernel.
1911 .LP
1912 Some attempt should be made to reassemble IP fragments or, at least
1913 to compute the right length for the higher level protocol.
1914 .LP
1915 Name server inverse queries are not dumped correctly: the (empty)
1916 question section is printed rather than real query in the answer
1917 section.
1918 Some believe that inverse queries are themselves a bug and
1919 prefer to fix the program generating them rather than \fItcpdump\fP.
1920 .LP
1921 A packet trace that crosses a daylight savings time change will give
1922 skewed time stamps (the time change is ignored).
1923 .LP
1924 Filter expressions that manipulate FDDI or Token Ring headers assume
1925 that all FDDI and Token Ring packets are SNAP-encapsulated Ethernet
1926 packets.
1927 This is true for IP, ARP, and DECNET Phase IV, but is not true
1928 for protocols such as ISO CLNS.
1929 Therefore, the filter may inadvertently
1930 accept certain packets that do not properly match the filter expression.
1931 .LP
1932 Filter expressions on fields other than those that manipulate Token Ring
1933 headers will not correctly handle source-routed Token Ring packets.
1934 .LP
1935 .BR "ip6 proto"
1936 should chase header chain, but at this moment it does not.
1937 .BR "ip6 protochain"
1938 is supplied for this behavior.
1939 .LP
1940 Arithmetic expression against transport layer headers, like \fBtcp[0]\fP,
1941 does not work against IPv6 packets.
1942 It only looks at IPv4 packets.