xref: /openbsd-src/usr.sbin/tcpdump/tcpdump.8 (revision 5e3c7963eb248119b7dfd4b0defad58a7d9cd306)
1.\"	$OpenBSD: tcpdump.8,v 1.99 2018/07/06 09:59:12 jmc Exp $
2.\"
3.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that: (1) source code distributions
8.\" retain the above copyright notice and this paragraph in its entirety, (2)
9.\" distributions including binary code include the above copyright notice and
10.\" this paragraph in its entirety in the documentation or other materials
11.\" provided with the distribution, and (3) all advertising materials mentioning
12.\" features or use of this software display the following acknowledgement:
13.\" ``This product includes software developed by the University of California,
14.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15.\" the University nor the names of its contributors may be used to endorse
16.\" or promote products derived from this software without specific prior
17.\" written permission.
18.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21.\"
22.Dd $Mdocdate: July 6 2018 $
23.Dt TCPDUMP 8
24.Os
25.Sh NAME
26.Nm tcpdump
27.Nd dump traffic on a network
28.Sh SYNOPSIS
29.Nm tcpdump
30.Op Fl AadefILlNnOopqStvXx
31.Op Fl c Ar count
32.Op Fl D Ar direction
33.Op Fl E Oo Ar espalg : Oc Ns Ar espkey
34.Op Fl F Ar file
35.Op Fl i Ar interface
36.Op Fl r Ar file
37.Op Fl s Ar snaplen
38.Op Fl T Ar type
39.Op Fl w Ar file
40.Op Fl y Ar datalinktype
41.Op Ar expression
42.Sh DESCRIPTION
43.Nm
44prints out the headers of packets on a network interface that match the boolean
45.Ar expression .
46You must have read access to
47.Pa /dev/bpf .
48.Pp
49The options are as follows:
50.Bl -tag -width "-c count"
51.It Fl A
52Print each packet in ASCII.
53If the
54.Fl e
55option is also specified, the link-level header will be included.
56The smaller of the entire packet or
57.Ar snaplen
58bytes will be printed.
59.It Fl a
60Attempt to convert network and broadcast addresses to names.
61.It Fl c Ar count
62Exit after receiving
63.Ar count
64packets.
65.It Fl D Ar direction
66Select packets flowing in the specified
67.Ar direction .
68Valid directions are:
69.Cm in
70and
71.Cm out .
72The default is to accept packets flowing in any direction.
73.It Fl d
74Dump the compiled packet-matching code in a human readable form to
75standard output and stop.
76.It Fl dd
77Dump packet-matching code as a C program fragment.
78.It Fl ddd
79Dump packet-matching code as decimal numbers
80preceded with a count.
81.It Fl E Oo Ar espalg : Oc Ns Ar espkey
82Try to decrypt RFC 4835 ESP
83.Pq Encapsulating Security Payload
84traffic using the specified hex key
85.Ar espkey .
86Supported algorithms for
87.Ar espalg
88are:
89.Cm aes128 ,
90.Cm aes128-hmac96 ,
91.Cm blowfish ,
92.Cm blowfish-hmac96 ,
93.Cm cast ,
94.Cm cast-hmac96 ,
95.Cm des3 ,
96.Cm des3-hmac96 ,
97.Cm des
98and
99.Cm des-hmac96 .
100The algorithm defaults to
101.Cm aes128-hmac96 .
102This option should be used for debugging only, since the key will show up in
103.Xr ps 1
104output.
105.It Fl e
106Print the link-level header on each dump line.
107.It Fl F Ar file
108Use
109.Ar file
110as input for the filter expression.
111Any additional expressions given on the command line are ignored.
112.It Fl f
113Print
114.Dq foreign
115internet addresses numerically rather than symbolically.
116This option is intended to get around serious brain damage in
117Sun's yp server \(em usually it hangs forever translating non-local
118internet numbers.
119.It Fl I
120Print the interface on each dump line.
121.It Fl i Ar interface
122Listen on
123.Ar interface .
124If unspecified,
125.Nm
126searches the system interface list for the lowest numbered, configured
127.Dq up
128interface
129.Pq excluding loopback .
130Ties are broken by choosing the earliest match.
131.It Fl L
132List the supported data link types for the interface and exit.
133.It Fl l
134Make stdout line buffered.
135Useful if you want to see the data while capturing it.
136For example:
137.Pp
138.Dl # tcpdump -l | tee dat
139or
140.Dl # tcpdump -l > dat & tail -f dat
141.It Fl N
142Do not print domain name qualification of host names.
143For example, if you specify this flag then
144.Nm
145will print
146.Dq nic
147instead of
148.Dq nic.ddn.mil .
149.It Fl n
150Do not convert addresses
151.Pq host addresses, port numbers, etc.
152to names.
153.It Fl O
154Do not run the packet-matching code optimizer.
155This is useful only if you suspect a bug in the optimizer.
156.It Fl o
157Print a guess of the possible operating system(s) of hosts that sent
158TCP SYN packets.
159See
160.Xr pf.os 5
161for a description of the passive operating system fingerprints.
162.It Fl p
163Do not put the interface into promiscuous mode.
164The interface might be in promiscuous mode for some other reason; hence,
165.Fl p
166cannot be used as an abbreviation for
167.Dq ether host \&"{local-hw-addr}\&"
168or
169.Dq ether broadcast .
170.It Fl q
171Quick
172.Pq quiet?
173output.
174Print less protocol information so output lines are shorter.
175.It Fl r Ar file
176Read packets from a
177.Ar file
178which was created with the
179.Fl w
180option.
181Standard input is used if
182.Ar file
183is
184.Ql - .
185.It Fl S
186Print absolute, rather than relative, TCP sequence numbers.
187.It Fl s Ar snaplen
188Analyze at most the first
189.Ar snaplen
190bytes of data from each packet rather than the default of 116.
191116 bytes is adequate for IPv6, ICMP, TCP, and UDP,
192but may truncate protocol information from name server and NFS packets
193.Pq see below .
194Packets truncated because of a limited
195.Ar snaplen
196are indicated in the output with
197.Dq Op | Ns Em proto ,
198where
199.Em proto
200is the name of the protocol level at which the truncation has occurred.
201Taking larger snapshots both increases the amount of time it takes
202to process packets and, effectively, decreases the amount of packet buffering.
203This may cause packets to be lost.
204You should limit
205.Ar snaplen
206to the smallest number that will capture the protocol information
207you're interested in.
208.It Fl T Ar type
209Force packets selected by
210.Ar expression
211to be interpreted as the specified
212.Ar type .
213Currently known types are:
214.Pp
215.Bl -tag -width "vxlan" -offset indent -compact
216.It Cm cnfp
217Cisco NetFlow protocol
218.It Cm gre
219Generic Routing Encapsulation over UDP
220.It Cm mpls
221Multiprocol Label Switching over UDP
222.It Cm rpc
223Remote Procedure Call
224.It Cm rtcp
225Real-Time Applications control protocol
226.It Cm rtp
227Real-Time Applications protocol
228.It Cm sack
229RFC 2018 TCP Selective Acknowledgements Options
230.It Cm tcp
231Transmission Control Protocol
232.It Cm tftp
233Trivial File Transfer Protocol
234.It Cm vat
235Visual Audio Tool
236.It Cm vrrp
237Virtual Router Redundancy protocol
238.It Cm vxlan
239Virtual eXtensible Local Area Network
240.It Cm wb
241distributed White Board
242.El
243.It Fl t
244Do not print a timestamp on each dump line.
245.It Fl tt
246Print an unformatted timestamp on each dump line.
247.It Fl ttt
248Print day and month in timestamp.
249.It Fl tttt
250Print timestamp difference between packets.
251.It Fl ttttt
252Print timestamp difference since the first packet.
253.It Fl v
254.Pq Slightly more
255verbose output.
256For example, the time to live
257.Pq TTL
258and type of service
259.Pq ToS
260information in an IP packet are printed.
261.It Fl vv
262Even more verbose output.
263For example, additional fields are printed from NFS reply packets.
264.It Fl w Ar file
265Write the raw packets to
266.Ar file
267rather than parsing and printing them out.
268They can be analyzed later with the
269.Fl r
270option.
271Standard output is used if
272.Ar file
273is
274.Ql - .
275.It Fl X
276Print each packet in hex and ASCII.
277If the
278.Fl e
279option is also specified, the link-level header will be included.
280The smaller of the entire packet or
281.Ar snaplen
282bytes will be printed.
283.It Fl x
284Print each packet in hex.
285If the
286.Fl e
287option is also specified, the link-level header will be included.
288The smaller of the entire packet or
289.Ar snaplen
290bytes will be printed.
291.It Fl y Ar datalinktype
292Set the data link type to use while capturing to
293.Ar datalinktype .
294Commonly used types include
295.Cm EN10MB ,
296.Cm IEEE802_11 ,
297and
298.Cm IEEE802_11_RADIO .
299The choices applicable to a particular device can be listed using
300.Fl L .
301.El
302.Pp
303.Ar expression
304selects which packets will be dumped.
305If no
306.Ar expression
307is given, all packets on the net will be dumped.
308Otherwise, only packets satisfying
309.Ar expression
310will be dumped.
311.Pp
312The
313.Ar expression
314consists of one or more primitives.
315Primitives usually consist of an
316.Ar id
317.Pq name or number
318preceded by one or more qualifiers.
319There are three different kinds of qualifiers:
320.Bl -tag -width "proto"
321.It Ar type
322Specify which kind of address component the
323.Ar id
324name or number refers to.
325Possible types are
326.Cm host ,
327.Cm net
328and
329.Cm port .
330E.g.,
331.Dq host foo ,
332.Dq net 128.3 ,
333.Dq port 20 .
334If there is no type qualifier,
335.Cm host
336is assumed.
337.It Ar dir
338Specify a particular transfer direction to and/or from
339.Ar id .
340Possible directions are
341.Cm src ,
342.Cm dst ,
343.Cm src or dst ,
344.Cm src and dst ,
345.Cm addr1 ,
346.Cm addr2 ,
347.Cm addr3 ,
348and
349.Cm addr4 .
350E.g.,
351.Dq src foo ,
352.Dq dst net 128.3 ,
353.Dq src or dst port ftp-data .
354If there is no
355.Ar dir
356qualifier,
357.Cm src or dst
358is assumed.
359The
360.Cm addr1 ,
361.Cm addr2 ,
362.Cm addr3 ,
363and
364.Cm addr4
365qualifiers are only valid for IEEE 802.11 Wireless LAN link layers.
366For null link layers (i.e., point-to-point protocols such as SLIP
367.Pq Serial Line Internet Protocol
368or the
369.Xr pflog 4
370header), the
371.Cm inbound
372and
373.Cm outbound
374qualifiers can be used to specify a desired direction.
375.It Ar proto
376Restrict the match to a particular protocol.
377Possible protocols are:
378.Cm ah ,
379.Cm arp ,
380.Cm atalk ,
381.Cm decnet ,
382.Cm esp ,
383.Cm ether ,
384.Cm fddi ,
385.Cm icmp ,
386.Cm icmp6 ,
387.Cm igmp ,
388.Cm igrp ,
389.Cm ip ,
390.Cm ip6 ,
391.Cm lat ,
392.Cm mopdl ,
393.Cm moprc ,
394.Cm pim ,
395.Cm rarp ,
396.Cm sca ,
397.Cm stp ,
398.Cm tcp ,
399.Cm udp ,
400and
401.Cm wlan .
402E.g.,
403.Dq ether src foo ,
404.Dq arp net 128.3 ,
405.Dq tcp port 21 ,
406.Dq wlan addr1 0:2:3:4:5:6 .
407If there is no protocol qualifier,
408all protocols consistent with the type are assumed.
409E.g.,
410.Dq src foo
411means
412.Do
413.Pq ip or arp or rarp
414src foo
415.Dc
416.Pq except the latter is not legal syntax ;
417.Dq net bar
418means
419.Do
420.Pq ip or arp or rarp
421net bar
422.Dc ;
423and
424.Dq port 53
425means
426.Do
427.Pq TCP or UDP
428port 53
429.Dc .
430.Pp
431.Cm fddi
432is actually an alias for
433.Cm ether ;
434the parser treats them identically as meaning
435.Qo
436the data link level used on the specified network interface
437.Qc .
438FDDI
439.Pq Fiber Distributed Data Interface
440headers contain Ethernet-like source and destination addresses,
441and often contain Ethernet-like packet types,
442so you can filter on these FDDI fields just as with the analogous
443Ethernet fields.
444FDDI headers also contain other fields,
445but you cannot name them explicitly in a filter expression.
446.El
447.Pp
448In addition to the above, there are some special primitive
449keywords that don't follow the pattern:
450.Cm gateway ,
451.Cm broadcast ,
452.Cm less ,
453.Cm greater ,
454and arithmetic expressions.
455All of these are described below.
456.Pp
457More complex filter expressions are built up by using the words
458.Cm and ,
459.Cm or ,
460and
461.Cm not
462to combine primitives
463e.g.,
464.Do
465host foo and not port ftp and not port ftp-data
466.Dc .
467To save typing, identical qualifier lists can be omitted
468e.g.,
469.Dq tcp dst port ftp or ftp-data or domain
470is exactly the same as
471.Do
472tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain
473.Dc .
474.Pp
475Allowable primitives are:
476.Bl -tag -width "ether proto proto"
477.It Cm dst host Ar host
478True if the IP destination field of the packet is
479.Ar host ,
480which may be either an address or a name.
481.It Cm src host Ar host
482True if the IP source field of the packet is
483.Ar host .
484.It Cm host Ar host
485True if either the IP source or destination of the packet is
486.Ar host .
487.Pp
488Any of the above
489.Ar host
490expressions can be prepended with the keywords,
491.Cm ip ,
492.Cm arp ,
493or
494.Cm rarp
495as in:
496.Pp
497.D1 Cm ip host Ar host
498.Pp
499which is equivalent to:
500.Bd -ragged -offset indent
501.Cm ether proto
502.Ar ip
503.Cm and host
504.Ar host
505.Ed
506.Pp
507If
508.Ar host
509is a name with multiple IP addresses, each address will be checked for a match.
510.It Cm ether dst Ar ehost
511True if the Ethernet destination address is
512.Ar ehost .
513.Ar ehost
514may be either a name from
515.Pa /etc/ethers
516or a number (see
517.Xr ethers 3
518for a numeric format).
519.It Cm ether src Ar ehost
520True if the Ethernet source address is
521.Ar ehost .
522.It Cm ether host Ar ehost
523True if either the Ethernet source or destination address is
524.Ar ehost .
525.It Cm gateway Ar host
526True if the packet used
527.Ar host
528as a gateway; i.e., the Ethernet source or destination address was
529.Ar host
530but neither the IP source nor the IP destination was
531.Ar host .
532.Ar host
533must be a name and must be found in both
534.Pa /etc/hosts
535and
536.Pa /etc/ethers .
537An equivalent expression is
538.Bd -ragged -offset indent
539.Cm ether host
540.Ar ehost
541.Cm and not host
542.Ar host
543.Ed
544.Pp
545which can be used with either names or numbers for
546.Ar host Ns / Ns Ar ehost .
547.It Cm dst net Ar net
548True if the IP destination address of the packet has a network number of
549.Ar net .
550.Ar net
551may be either a name from
552.Pa /etc/hosts
553or a network number (see
554.Xr hosts 5
555for details).
556.It Cm src net Ar net
557True if the IP source address of the packet has a network number of
558.Ar net .
559.It Cm net Ar net
560True if either the IP source or destination address of the packet
561has a network number of
562.Ar net .
563.It Cm dst port Ar port
564True if the packet is IP/TCP or IP/UDP and has a destination port value of
565.Ar port .
566The
567.Ar port
568can be a number or name from
569.Xr services 5
570(see
571.Xr tcp 4
572and
573.Xr udp 4 ) .
574If a name is used, both the port number and protocol are checked.
575If a number or ambiguous name is used, only the port number is checked;
576e.g.,
577.Dq Cm dst port No 513
578will print both TCP/login traffic and UDP/who traffic, and
579.Dq Cm dst port No domain
580will print both TCP/domain and UDP/domain traffic.
581.It Cm src port Ar port
582True if the packet has a source port value of
583.Ar port .
584.It Cm port Ar port
585True if either the source or destination port of the packet is
586.Ar port .
587.Pp
588Any of the above port expressions can be prepended with the keywords
589.Cm tcp
590or
591.Cm udp ,
592as in:
593.Pp
594.D1 Cm tcp src port Ar port
595.Pp
596which matches only TCP packets whose source port is
597.Ar port .
598.It Cm less Ar length
599True if the packet has a length less than or equal to
600.Ar length .
601This is equivalent to:
602.Pp
603.D1 Cm len <= Ar length
604.It Cm greater Ar length
605True if the packet has a length greater than or equal to
606.Ar length .
607This is equivalent to:
608.Pp
609.D1 Cm len >= Ar length
610.It Cm ip proto Ar proto
611True if the packet is an IP packet (see
612.Xr ip 4 )
613of protocol type
614.Ar proto .
615.Ar proto
616can be a number or name from
617.Xr protocols 5 ,
618such as
619.Cm icmp ,
620.Cm udp ,
621or
622.Cm tcp .
623These identifiers are also keywords and must be escaped
624using a backslash character
625.Pq Sq \e .
626.It Cm ether broadcast
627True if the packet is an Ethernet broadcast packet.
628The
629.Cm ether
630keyword is optional.
631.It Cm ip broadcast
632True if the packet is an IP broadcast packet.
633It checks for both the all-zeroes and all-ones broadcast conventions
634and looks up the local subnet mask.
635.It Cm ether multicast
636True if the packet is an Ethernet multicast packet.
637The
638.Cm ether
639keyword is optional.
640This is shorthand for
641.Do
642.Cm ether Ns [0] & 1 != 0
643.Dc .
644.It Cm ip multicast
645True if the packet is an IP multicast packet.
646.It Cm ether proto Ar proto
647True if the packet is of ether type
648.Ar proto .
649.Ar proto
650can be a number or one of the names
651.Cm ip ,
652.Cm ip6 ,
653.Cm arp ,
654.Cm rarp ,
655.Cm atalk ,
656.Cm atalkarp ,
657.Cm decnet ,
658.Cm decdts ,
659.Cm decdns ,
660.Cm lanbridge ,
661.Cm lat ,
662.Cm mopdl ,
663.Cm moprc ,
664.Cm pup ,
665.Cm sca ,
666.Cm sprite ,
667.Cm stp ,
668.Cm vexp ,
669.Cm vprod ,
670or
671.Cm xns .
672These identifiers are also keywords and must be escaped
673using a backslash character
674.Pq Sq \e .
675In the case of FDDI (e.g.,
676.Dq Cm fddi protocol arp ) ,
677the protocol identification comes from the 802.2 Logical Link Control
678.Pq LLC
679header, which is usually layered on top of the FDDI header.
680.Nm
681assumes, when filtering on the protocol identifier, that all FDDI packets
682include an LLC header, and that the LLC header is in so-called SNAP format.
683.It Cm decnet src Ar host
684True if the DECNET source address is
685.Ar host ,
686which may be an address of the form
687.Dq 10.123 ,
688or a DECNET host name.
689DECNET host name support is only available on systems that are
690configured to run DECNET.
691.It Cm decnet dst Ar host
692True if the DECNET destination address is
693.Ar host .
694.It Cm decnet host Ar host
695True if either the DECNET source or destination address is
696.Ar host .
697.It Cm ifname Ar interface
698True if the packet was logged as coming from the specified interface
699(applies only to packets logged by
700.Xr pf 4 ) .
701.It Cm on Ar interface
702Synonymous with the
703.Ar ifname
704modifier.
705.It Cm rnr Ar num
706True if the packet was logged as matching the specified PF rule number
707in the main ruleset (applies only to packets logged by
708.Xr pf 4 ) .
709.It Cm rulenum Ar num
710Synonymous with the
711.Ar rnr
712modifier.
713.It Cm reason Ar code
714True if the packet was logged with the specified PF reason code.
715The known codes are:
716.Ar match ,
717.Ar bad-offset ,
718.Ar fragment ,
719.Ar short ,
720.Ar normalize ,
721.Ar memory ,
722.Ar bad-timestamp ,
723.Ar congestion ,
724.Ar ip-option ,
725.Ar proto-cksum ,
726.Ar state-mismatch ,
727.Ar state-insert ,
728.Ar state-limit ,
729.Ar src-limit ,
730and
731.Ar synproxy
732(applies only to packets logged by
733.Xr pf 4 ) .
734.It Cm rset Ar name
735True if the packet was logged as matching the specified PF ruleset
736name of an anchored ruleset (applies only to packets logged by
737.Xr pf 4 ) .
738.It Cm ruleset Ar name
739Synonymous with the
740.Ar rset
741modifier.
742.It Cm srnr Ar num
743True if the packet was logged as matching the specified PF rule number
744of an anchored ruleset (applies only to packets logged by
745.Xr pf 4 ) .
746.It Cm subrulenum Ar num
747Synonymous with the
748.Ar srnr
749modifier.
750.It Cm action Ar act
751True if PF took the specified action when the packet was logged.
752Valid actions are:
753.Ar pass ,
754.Ar block ,
755and
756.Ar match
757(applies only to packets logged by
758.Xr pf 4 ) .
759.It Cm wlan addr1 Ar ehost
760True if the first IEEE 802.11 address is
761.Ar ehost .
762.It Cm wlan addr2 Ar ehost
763True if the second IEEE 802.11 address is
764.Ar ehost .
765.It Cm wlan addr3 Ar ehost
766True if the third IEEE 802.11 address is
767.Ar ehost .
768.It Cm wlan addr4 Ar ehost
769True if the fourth IEEE 802.11 address is
770.Ar ehost .
771The fourth address field is only used for
772WDS (Wireless Distribution System) frames.
773.It Cm wlan host Ar ehost
774True if either the first, second, third, or fourth
775IEEE 802.11 address is
776.Ar ehost .
777.It Cm type Ar type
778True if the IEEE 802.11 frame type matches the specified
779.Ar type .
780Valid types are:
781.Ar data ,
782.Ar mgt ,
783.Ar ctl ,
784or a numeric value.
785.It Cm subtype Ar subtype
786True if the IEEE 802.11 frame subtype matches the specified
787.Ar subtype .
788Valid subtypes are:
789.Ar assocreq ,
790.Ar assocresp ,
791.Ar reassocreq ,
792.Ar reassocresp ,
793.Ar probereq ,
794.Ar proberesp ,
795.Ar beacon ,
796.Ar atim ,
797.Ar disassoc ,
798.Ar auth ,
799.Ar deauth ,
800.Ar data ,
801or a numeric value.
802.It Cm dir Ar dir
803True if the IEEE 802.11 frame direction matches the specified
804.Ar dir .
805Valid directions are:
806.Ar nods ,
807.Ar tods ,
808.Ar fromds ,
809.Ar dstods ,
810or a numeric value.
811.It Xo
812.Cm atalk ,
813.Cm ip ,
814.Cm ip6 ,
815.Cm arp ,
816.Cm decnet ,
817.Cm lat ,
818.Cm moprc ,
819.Cm mopdl ,
820.Cm rarp ,
821.Cm sca
822.Xc
823Abbreviations for:
824.Cm ether proto Ar p
825where
826.Ar p
827is one of the above protocols.
828.Nm
829does not currently know how to parse
830.Cm lat ,
831.Cm moprc ,
832or
833.Cm mopdl .
834.It Xo
835.Cm ah ,
836.Cm esp ,
837.Cm icmp ,
838.Cm icmp6 ,
839.Cm igmp ,
840.Cm igrp ,
841.Cm pim ,
842.Cm tcp ,
843.Cm udp
844.Xc
845Abbreviations for:
846.Cm ip proto Ar p
847where
848.Ar p
849is one of the above protocols.
850.It Ar expr relop expr
851True if the relation holds, where
852.Ar relop
853is one of
854.Ql > ,
855.Ql < ,
856.Ql >= ,
857.Ql <= ,
858.Ql = ,
859.Ql != ,
860and
861.Ar expr
862is an arithmetic expression composed of integer constants
863.Pq expressed in standard C syntax ,
864the normal binary operators
865.Ql ( + ,
866.Ql - ,
867.Ql * ,
868.Ql / ,
869.Ql & ,
870.Ql | ) ,
871a length operator, and special packet data accessors.
872To access data inside the packet, use the following syntax:
873.Sm off
874.Bd -ragged -offset indent
875.Ar proto Op Ar expr : Ar size
876.Ed
877.Sm on
878.Pp
879.Ar proto
880is one of
881.Cm ether ,
882.Cm fddi ,
883.Cm ip ,
884.Cm arp ,
885.Cm rarp ,
886.Cm tcp ,
887.Cm udp ,
888or
889.Cm icmp ,
890and indicates the protocol layer for the index operation.
891The byte offset, relative to the indicated protocol layer, is given by
892.Ar expr .
893.Ar size
894is optional and indicates the number of bytes in the field of interest;
895it can be either one, two, or four, and defaults to one.
896The length operator, indicated by the keyword
897.Cm len ,
898gives the length of the packet.
899.Pp
900For example,
901.Dq Cm ether Ns [0] & 1 != 0
902catches all multicast traffic.
903The expression
904.Dq Cm ip Ns [0] & 0xf != 5
905catches all IP packets with options.
906The expression
907.Dq Cm ip Ns [6:2] & 0x1fff = 0
908catches only unfragmented datagrams and frag zero of fragmented datagrams.
909This check is implicitly applied to the
910.Cm tcp
911and
912.Cm udp
913index operations.
914For instance,
915.Dq Cm tcp Ns [0]
916always means the first byte of the TCP header,
917and never means the first byte of an intervening fragment.
918.El
919.Pp
920Primitives may be combined using a parenthesized group of primitives and
921operators.
922Parentheses are special to the shell and must be escaped.
923Allowable primitives and operators are:
924.Bd -ragged -offset indent
925Negation
926.Po
927.Dq Cm \&!
928or
929.Dq Cm not
930.Pc
931.Pp
932Concatenation
933.Po
934.Dq Cm &&
935or
936.Dq Cm and
937.Pc
938.Pp
939Alternation
940.Po
941.Dq Cm ||
942or
943.Dq Cm or
944.Pc
945.Ed
946.Pp
947Negation has highest precedence.
948Alternation and concatenation have equal precedence and associate left to right.
949Explicit
950.Cm and
951tokens, not juxtaposition,
952are now required for concatenation.
953.Pp
954If an identifier is given without a keyword, the most recent keyword is assumed.
955For example,
956.Bd -ragged -offset indent
957.Cm not host
958vs
959.Cm and
960ace
961.Ed
962.Pp
963is short for
964.Bd -ragged -offset indent
965.Cm not host
966vs
967.Cm and host
968ace
969.Ed
970.Pp
971which should not be confused with
972.Bd -ragged -offset indent
973.Cm not
974.Pq Cm host No vs Cm or No ace
975.Ed
976.Pp
977Expression arguments can be passed to
978.Nm
979as either a single argument or as multiple arguments,
980whichever is more convenient.
981Generally, if the expression contains shell metacharacters,
982it is easier to pass it as a single, quoted argument.
983Multiple arguments are concatenated with spaces before being parsed.
984.Sh EXAMPLES
985To print all packets arriving at or departing from sundown:
986.Pp
987.Dl # tcpdump host sundown
988.Pp
989To print traffic between helios and either hot or ace
990(the expression is quoted to prevent the shell from misinterpreting
991the parentheses):
992.Pp
993.Dl # tcpdump 'host helios and (hot or ace)'
994.Pp
995To print all IP packets between ace and any host except helios:
996.Pp
997.Dl # tcpdump ip host ace and not helios
998.Pp
999To print all traffic between local hosts and hosts at Berkeley:
1000.Pp
1001.Dl # tcpdump net ucb-ether
1002.Pp
1003To print all FTP traffic through internet gateway snup:
1004.Pp
1005.Dl # tcpdump 'gateway snup and (port ftp or ftp-data)'
1006.Pp
1007To print traffic neither sourced from nor destined for local network
1008192.168.7.0/24 (if you gateway to one other net, this stuff should
1009never make it onto your local network):
1010.Pp
1011.Dl # tcpdump ip and not net 192.168.7.0/24
1012.Pp
1013To print the start and end packets
1014.Pq the SYN and FIN packets
1015of each TCP connection that involves a host that is not in local
1016network 192.168.7.0/24:
1017.Bd -literal -offset indent
1018# tcpdump 'tcp[13] & 3 != 0 and not src and dst net 192.168.7.0/24'
1019.Ed
1020.Pp
1021To print only the SYN packets of HTTP connections:
1022.Pp
1023.Dl # tcpdump 'tcp[tcpflags] = tcp-syn and port http'
1024.Pp
1025To print IP packets longer than 576 bytes sent through gateway snup:
1026.Pp
1027.Dl # tcpdump 'gateway snup and ip[2:2] > 576'
1028.Pp
1029To print IP broadcast or multicast packets that were
1030.Em not
1031sent via Ethernet broadcast or multicast:
1032.Bd -literal -offset indent
1033# tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'
1034.Ed
1035.Pp
1036To print all ICMP packets that are not echo requests/replies
1037.Pq i.e., not ping packets :
1038.Pp
1039.Dl # tcpdump 'icmp[0] != 8 and icmp[0] != 0'
1040.Pp
1041To print only echo request ICMP packets:
1042.Pp
1043.Dl # tcpdump 'icmp[icmptype] = icmp-echo'
1044.Pp
1045To print and decrypt all ESP packets with SPI 0x00001234:
1046.Pp
1047.Dl # tcpdump -E des3-hmac96:ab...def 'ip[20:4] = 0x00001234'
1048.Pp
1049To print raw wireless frames passing the iwn0 interface:
1050.Dl # tcpdump -i iwn0 -y IEEE802_11_RADIO -v
1051.Sh OUTPUT FORMAT
1052The output of
1053.Nm
1054is protocol dependent.
1055The following gives a brief description and examples of most of the formats.
1056.Ss Link Level Headers
1057If the
1058.Fl e
1059option is given, the link level header is printed out.
1060On Ethernets, the source and destination addresses, protocol,
1061and packet length are printed.
1062.Pp
1063On the packet filter logging interface
1064.Xr pflog 4 ,
1065logging reason
1066.Pq rule match, bad-offset, fragment, bad-timestamp, short, normalize, memory ,
1067action taken
1068.Pq pass/block ,
1069direction
1070.Pq in/out
1071and interface information are printed out for each packet.
1072.Pp
1073On FDDI networks, the
1074.Fl e
1075option causes
1076.Nm
1077to print the frame control field, the source and destination addresses,
1078and the packet length.
1079The frame control field governs the interpretation of the rest of the packet.
1080Normal packets
1081.Pq such as those containing IP datagrams
1082are
1083.Dq async
1084packets, with a priority value between 0 and 7; for example,
1085.Sy async4 .
1086Such packets are assumed to contain an 802.2 Logical Link Control
1087.Pq LLC
1088packet; the LLC header is printed if it is
1089.Em not
1090an ISO datagram or a so-called SNAP packet.
1091.Pp
1092The following description assumes familiarity with the
1093SLIP compression algorithm described in RFC 1144.
1094.Pp
1095On SLIP links, a direction indicator
1096.Po
1097.Ql I
1098for inbound,
1099.Ql O
1100for outbound
1101.Pc ,
1102packet type, and compression information are printed out.
1103The packet type is printed first.
1104The three types are
1105.Cm ip ,
1106.Cm utcp ,
1107and
1108.Cm ctcp .
1109No further link information is printed for IP packets.
1110For TCP packets, the connection identifier is printed following the type.
1111If the packet is compressed, its encoded header is printed out.
1112The special cases are printed out as
1113.Cm *S+ Ns Ar n
1114and
1115.Cm *SA+ Ns Ar n ,
1116where
1117.Ar n
1118is the amount by which the sequence number
1119.Pq or sequence number and ack
1120has changed.
1121If it is not a special case, zero or more changes are printed.
1122A change is indicated by
1123.Sq U
1124.Pq urgent pointer ,
1125.Sq W
1126.Pq window ,
1127.Sq A
1128.Pq ack ,
1129.Sq S
1130.Pq sequence number ,
1131and
1132.Sq I
1133.Pq packet ID ,
1134followed by a delta
1135.Pq +n or -n ,
1136or a new value
1137.Pq =n .
1138Finally, the amount of data in the packet and compressed header length
1139are printed.
1140.Pp
1141For example, the following line shows an outbound compressed TCP packet,
1142with an implicit connection identifier; the ack has changed by 6,
1143the sequence number by 49, and the packet ID by 6;
1144there are 3 bytes of data and 6 bytes of compressed header:
1145.Bd -ragged -offset indent
1146O
1147.Cm ctcp No *
1148.Cm A No +6
1149.Cm S No +49
1150.Cm I No +6 3
1151.Pq 6
1152.Ed
1153.Ss ARP/RARP Packets
1154arp/rarp output shows the type of request and its arguments.
1155The format is intended to be self-explanatory.
1156Here is a short sample taken from the start of an rlogin
1157from host rtsg to host csam:
1158.Bd -literal -offset indent
1159arp who-has csam tell rtsg
1160arp reply csam is-at CSAM
1161.Ed
1162.Pp
1163In this example, Ethernet addresses are in caps and internet addresses
1164in lower case.
1165The first line says that rtsg sent an arp packet asking for
1166the Ethernet address of internet host csam.
1167csam replies with its Ethernet address CSAM.
1168.Pp
1169This would look less redundant if we had done
1170.Nm
1171.Fl n :
1172.Bd -literal -offset indent
1173arp who-has 128.3.254.6 tell 128.3.254.68
1174arp reply 128.3.254.6 is-at 02:07:01:00:01:c4
1175.Ed
1176.Pp
1177If we had done
1178.Nm
1179.Fl e ,
1180the fact that the first packet is
1181broadcast and the second is point-to-point would be visible:
1182.Bd -literal -offset indent
1183RTSG Broadcast 0806 64: arp who-has csam tell rtsg
1184CSAM RTSG 0806 64: arp reply csam is-at CSAM
1185.Ed
1186.Pp
1187For the first packet this says the Ethernet source address is RTSG,
1188the destination is the Ethernet broadcast address,
1189the type field contained hex 0806 (type
1190.Dv ETHER_ARP )
1191and the total length was 64 bytes.
1192.Ss TCP Packets
1193The following description assumes familiarity with the TCP protocol
1194described in RFC 793.
1195If you are not familiar with the protocol, neither this description nor
1196.Nm
1197will be of much use to you.
1198.Pp
1199The general format of a TCP protocol line is:
1200.Bd -ragged -offset indent
1201.Ar src No > Ar dst :
1202.Ar flags src-os data-seqno ack window urgent options
1203.Ed
1204.Pp
1205.Ar src
1206and
1207.Ar dst
1208are the source and destination IP addresses and ports.
1209.Ar flags
1210is some combination of
1211.Sq S
1212.Pq SYN ,
1213.Sq F
1214.Pq FIN ,
1215.Sq P
1216.Pq PUSH ,
1217or
1218.Sq R
1219.Pq RST ,
1220.Sq W
1221.Pq congestion Window reduced ,
1222.Sq E
1223.Pq ecn ECHO
1224or a single
1225.Ql \&.
1226.Pq no flags .
1227.Ar src-os
1228will list a guess of the source host's operating system if the
1229.Fl o
1230command line flag was passed to
1231.Nm tcpdump .
1232.Ar data-seqno
1233describes the portion of sequence space covered
1234by the data in this packet
1235.Pq see example below .
1236.Ar ack
1237is the sequence number of the next data expected by the other
1238end of this connection.
1239.Ar window
1240is the number of bytes of receive buffer space available
1241at the other end of this connection.
1242.Ar urg
1243indicates there is urgent data in the packet.
1244.Ar options
1245are TCP options enclosed in angle brackets e.g.,
1246<mss 1024>.
1247.Pp
1248.Ar src , dst
1249and
1250.Ar flags
1251are always present.
1252The other fields depend on the contents of the packet's TCP protocol header and
1253are output only if appropriate.
1254.Pp
1255Here is the opening portion of an rlogin from host rtsg to host csam.
1256.Bd -unfilled -offset 2n
1257rtsg.1023 > csam.login: S 768512:768512(0) win 4096 <mss 1024>
1258csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 <mss 1024>
1259rtsg.1023 > csam.login: . ack 1 win 4096
1260rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096
1261csam.login > rtsg.1023: . ack 2 win 4096
1262rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096
1263csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077
1264csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1
1265csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1
1266.Ed
1267.Pp
1268The first line says that TCP port 1023 on rtsg sent a packet
1269to port login on host csam.
1270The
1271.Ql S
1272indicates that the SYN flag was set.
1273The packet sequence number was 768512 and it contained no data.
1274The notation is
1275.Sm off
1276.So
1277.Ar first : last
1278.Po Ar nbytes
1279.Pc
1280.Sc
1281.Sm on
1282which means sequence numbers
1283.Ar first
1284up to but not including
1285.Ar last
1286which is
1287.Ar nbytes
1288bytes of user data.
1289There was no piggy-backed ack, the available receive window was 4096
1290bytes and there was a max-segment-size option requesting an mss of 1024 bytes.
1291.Pp
1292Csam replies with a similar packet except it includes a piggy-backed
1293ack for rtsg's SYN.
1294Rtsg then acks csam's SYN.
1295The
1296.Ql \&.
1297means no flags were set.
1298The packet contained no data so there is no data sequence number.
1299The ack sequence number is a 32-bit integer.
1300The first time
1301.Nm
1302sees a TCP connection, it prints the sequence number from the packet.
1303On subsequent packets of the connection, the difference between
1304the current packet's sequence number and this initial sequence number
1305is printed.
1306This means that sequence numbers after the first can be interpreted
1307as relative byte positions in the connection's data stream
1308.Po
1309with the first data byte each direction being 1
1310.Pc .
1311.Fl S
1312will override this
1313feature, causing the original sequence numbers to be output.
1314.Pp
1315On the 6th line, rtsg sends csam 19 bytes of data
1316.Po
1317bytes 2 through 20
1318in the rtsg -> csam side of the connection
1319.Pc .
1320The PUSH flag is set in the packet.
1321On the 7th line, csam says it's received data sent by rtsg up to
1322but not including byte 21.
1323Most of this data is apparently sitting in the socket buffer
1324since csam's receive window has gotten 19 bytes smaller.
1325Csam also sends one byte of data to rtsg in this packet.
1326On the 8th and 9th lines,
1327csam sends two bytes of urgent, pushed data to rtsg.
1328.Ss UDP Packets
1329UDP format is illustrated by this rwho packet:
1330.Pp
1331.D1 actinide.who > broadcast.who: udp 84
1332.Pp
1333This says that port who on host actinide sent a UDP datagram to port
1334who on host broadcast, the Internet broadcast address.
1335The packet contained 84 bytes of user data.
1336.Pp
1337Some UDP services are recognized
1338.Pq from the source or destination port number
1339and the higher level protocol information printed.
1340In particular, Domain Name service requests
1341.Pq RFC 1034/1035
1342and Sun RPC calls
1343.Pq RFC 1050
1344to NFS.
1345.Ss UDP Name Server Requests
1346The following description assumes familiarity with
1347the Domain Service protocol described in RFC 1035.
1348If you are not familiar with the protocol,
1349the following description will appear to be written in Greek.
1350.Pp
1351Name server requests are formatted as
1352.Bd -ragged -offset indent
1353.Ar src
1354>
1355.Ar dst :
1356.Ar id op Ns ?\&
1357.Ar flags qtype qclass name
1358.Pq Ar len
1359.Ed
1360.Pp
1361For example:
1362.Pp
1363.D1 h2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)
1364.Pp
1365Host h2opolo asked the domain server on helios for an address record
1366.Pq Ar qtype Ns =A
1367associated with the name
1368ucbvax.berkeley.edu.
1369The query
1370.Ar id
1371was 3.
1372The
1373.Ql +
1374indicates the recursion desired flag was set.
1375The query length was 37 bytes, not including the UDP and IP protocol headers.
1376The query operation was the normal one
1377.Pq Query
1378so the
1379.Ar op
1380field was omitted.
1381If
1382.Ar op
1383had been anything else, it would have been printed between the 3 and the
1384.Ql + .
1385Similarly, the
1386.Ar qclass
1387was the normal one
1388.Pq C_IN
1389and was omitted.
1390Any other
1391.Ar qclass
1392would have been printed immediately after the A.
1393.Pp
1394A few anomalies are checked and may result in extra fields enclosed in
1395square brackets: if a query contains an answer, name server or
1396authority section,
1397.Ar ancount ,
1398.Ar nscount ,
1399or
1400.Ar arcount
1401are printed as
1402.Dq Bq Ar n Ns a ,
1403.Dq Bq Ar n Ns n ,
1404or
1405.Dq Bq Ar n Ns au
1406where
1407.Ar n
1408is the appropriate count.
1409If any of the response bits are set
1410.Po
1411AA, RA or rcode
1412.Pc
1413or any of the
1414.Dq must be zero
1415bits are set in bytes two and three,
1416.Dq Bq b2&3= Ns Ar x
1417is printed, where
1418.Ar x
1419is the hex value of header bytes two and three.
1420.Ss UDP Name Server Responses
1421Name server responses are formatted as
1422.Bd -ragged -offset indent
1423.Ar src No > Ar dst :
1424.Ar id op rcode flags
1425.Ar a
1426/
1427.Ar n
1428/
1429.Ar au
1430.Ar type class data
1431.Pq Ar len
1432.Ed
1433.Pp
1434For example:
1435.Bd -unfilled -offset indent
1436helios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)
1437helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)
1438.Ed
1439.Pp
1440In the first example, helios responds to query
1441.Ar id
14423 from h2opolo
1443with 3 answer records, 3 name server records and 7 authority records.
1444The first answer record is type A
1445.Pq address and its data is internet
1446address 128.32.137.3.
1447The total size of the response was 273 bytes, excluding UDP and IP headers.
1448The
1449.Ar op
1450.Pq Query
1451and
1452.Ar rcode
1453.Pq NoError
1454were omitted, as was the
1455.Ar class
1456.Pq C_IN
1457of the A record.
1458.Pp
1459In the second example, helios responds to query
1460.Ar op
14612 with an
1462.Ar rcode
1463of non-existent domain
1464.Pq NXDomain
1465with no answers,
1466one name server and no authority records.
1467The
1468.Ql *
1469indicates that the authoritative answer bit was set.
1470Since there were no answers, no
1471.Ar type ,
1472.Ar class
1473or
1474.Ar data
1475were printed.
1476.Pp
1477Other flag characters that might appear are
1478.Sq -
1479(recursion available, RA,
1480.Em not
1481set)
1482and
1483.Sq |
1484.Pq truncated message, TC, set .
1485If the question section doesn't contain exactly one entry,
1486.Dq Bq Ar n Ns q
1487is printed.
1488.Pp
1489Name server requests and responses tend to be large and the default
1490.Ar snaplen
1491of 96 bytes may not capture enough of the packet to print.
1492Use the
1493.Fl s
1494flag to increase the
1495.Ar snaplen
1496if you need to seriously investigate name server traffic.
1497.Dq Fl s No 128
1498has worked well for me.
1499.Ss NFS Requests and Replies
1500Sun NFS
1501.Pq Network File System
1502requests and replies are printed as:
1503.Bd -ragged -offset indent
1504.Ar src . Ns Ar xid
1505>
1506.Ar dst . Ns nfs :
1507.Ar len op args
1508.Pp
1509.Ar src . Ns nfs
1510>
1511.Ar dst . Ns Ar xid :
1512reply
1513.Ar stat len op results
1514.Ed
1515.Bd -unfilled -offset indent
1516sushi.6709 > wrl.nfs: 112 readlink fh 21,24/10.73165
1517wrl.nfs > sushi.6709: reply ok 40 readlink "../var"
1518sushi.201b > wrl.nfs:
1519	144 lookup fh 9,74/4096.6878 "xcolors"
1520wrl.nfs > sushi.201b:
1521	reply ok 128 lookup fh 9,74/4134.3150
1522.Ed
1523.Pp
1524In the first line, host sushi sends a transaction with ID 6709 to wrl.
1525The number following the src host is a transaction ID,
1526.Em not
1527the source port.
1528The request was 112 bytes, excluding the UDP and IP headers.
1529The
1530.Ar op
1531was a readlink
1532.Pq read symbolic link
1533on fh
1534.Pq Dq file handle
153521,24/10.731657119.
1536If one is lucky, as in this case, the file handle can be interpreted
1537as a major,minor device number pair, followed by the inode number and
1538generation number.
1539Wrl replies with a
1540.Ar stat
1541of ok and the contents of the link.
1542.Pp
1543In the third line, sushi asks wrl to look up the name
1544.Dq xcolors
1545in directory file 9,74/4096.6878.
1546The data printed depends on the operation type.
1547The format is intended to be self-explanatory
1548if read in conjunction with an NFS protocol spec.
1549.Pp
1550If the
1551.Fl v
1552.Pq verbose
1553flag is given, additional information is printed.
1554For example:
1555.Bd -unfilled -offset indent
1556sushi.1372a > wrl.nfs:
1557	148 read fh 21,11/12.195 8192 bytes @ 24576
1558wrl.nfs > sushi.1372a:
1559	reply ok 1472 read REG 100664 ids 417/0 sz 29388
1560.Ed
1561.Pp
1562.Fl v
1563also prints the IP header TTL, ID, and fragmentation fields,
1564which have been omitted from this example.
1565In the first line, sushi asks wrl to read 8192 bytes from file 21,11/12.195,
1566at byte offset 24576.
1567Wrl replies with a
1568.Ar stat of
1569ok;
1570the packet shown on the second line is the first fragment of the reply,
1571and hence is only 1472 bytes long.
1572The other bytes will follow in subsequent fragments,
1573but these fragments do not have NFS or even UDP headers and so might not be
1574printed, depending on the filter expression used.
1575Because the
1576.Fl v
1577flag is given, some of the file attributes
1578.Po
1579which are returned in addition to the file data
1580.Pc
1581are printed: the file type
1582.Pq So REG Sc , No for regular file ,
1583the file mode
1584.Pq in octal ,
1585the UID and GID, and the file size.
1586.Pp
1587If the
1588.Fl v
1589flag is given more than once, even more details are printed.
1590.Pp
1591NFS requests are very large and much of the detail won't be printed unless
1592.Ar snaplen
1593is increased.
1594Try using
1595.Dq Fl s No 192
1596to watch NFS traffic.
1597.Pp
1598NFS reply packets do not explicitly identify the RPC operation.
1599Instead,
1600.Nm
1601keeps track of
1602.Dq recent
1603requests, and matches them to the replies using the
1604.Ar xid
1605.Pq transaction ID .
1606If a reply does not closely follow the corresponding request,
1607it might not be parsable.
1608.Ss IP Fragmentation
1609Fragmented Internet datagrams are printed as
1610.Bd -ragged -offset indent
1611.Po
1612.Cm frag Ar id
1613:
1614.Ar size
1615@
1616.Ar offset
1617.Op +
1618.Pc
1619.Ed
1620.Pp
1621A
1622.Ql +
1623indicates there are more fragments.
1624The last fragment will have no
1625.Ql + .
1626.Pp
1627.Ar id
1628is the fragment ID.
1629.Ar size
1630is the fragment size
1631.Pq in bytes
1632excluding the IP header.
1633.Ar offset
1634is this fragment's offset
1635.Pq in bytes
1636in the original datagram.
1637.Pp
1638The fragment information is output for each fragment.
1639The first fragment contains the higher level protocol header and the fragment
1640info is printed after the protocol info.
1641Fragments after the first contain no higher level protocol header and the
1642fragment info is printed after the source and destination addresses.
1643For example, here is part of an FTP from arizona.edu to lbl-rtsg.arpa
1644over a CSNET connection that doesn't appear to handle 576 byte datagrams:
1645.Bd -unfilled -offset indent
1646arizona.ftp-data > rtsg.1170: . 1024:1332(308) ack 1 win 4096 (frag 595a:328@0+)
1647arizona > rtsg: (frag 595a:204@328)
1648rtsg.1170 > arizona.ftp-data: . ack 1536 win 2560
1649.Ed
1650.Pp
1651There are a couple of things to note here: first, addresses in the
16522nd line don't include port numbers.
1653This is because the TCP protocol information is all in the first fragment
1654and we have no idea what the port or sequence numbers are when we print
1655the later fragments.
1656Second, the TCP sequence information in the first line is printed as if there
1657were 308 bytes of user data when, in fact, there are 512 bytes
1658.Po
1659308 in the first frag and 204 in the second
1660.Pc .
1661If you are looking for holes in the sequence space or trying to match up acks
1662with packets, this can fool you.
1663.Pp
1664A packet with the IP
1665.Sy don't fragment
1666flag is marked with a trailing
1667.Dq Pq DF .
1668.Ss Timestamps
1669By default, all output lines are preceded by a timestamp.
1670The timestamp is the current clock time in the form
1671.Sm off
1672.Ar hh : mm : ss . frac
1673.Sm on
1674and is as accurate as the kernel's clock.
1675The timestamp reflects the time the kernel first saw the packet.
1676No attempt is made to account for the time lag between when the
1677Ethernet interface removed the packet from the wire and when the kernel
1678serviced the
1679.Dq new packet
1680interrupt.
1681.Ss IP and Protocol Checksum Offload
1682Some network cards support IP and/or protocol checksum offload.
1683Packet headers for such interfaces erroneously indicate a bad checksum,
1684since the checksum is not calculated until after
1685.Nm
1686sees the packet.
1687.Sh SEE ALSO
1688.\" traffic(1C), nit(4P),
1689.Xr ethers 3 ,
1690.Xr pcap 3 ,
1691.Xr pcap-filter 3 ,
1692.Xr bpf 4 ,
1693.Xr ip 4 ,
1694.Xr pf 4 ,
1695.Xr pflog 4 ,
1696.Xr tcp 4 ,
1697.Xr udp 4 ,
1698.Xr hosts 5 ,
1699.Xr pf.os 5 ,
1700.Xr protocols 5 ,
1701.Xr services 5
1702.Sh STANDARDS
1703.Rs
1704.%D September 1981
1705.%R RFC 793
1706.%T Transmission Control Protocol
1707.Re
1708.Pp
1709.Rs
1710.%A P. Mockapetris
1711.%D November 1987
1712.%R RFC 1034
1713.%T Domain Names \(en Concepts and Facilities
1714.Re
1715.Pp
1716.Rs
1717.%A P. Mockapetris
1718.%D November 1987
1719.%R RFC 1035
1720.%T Domain Names \(en Implementation and Specification
1721.Re
1722.Pp
1723.Rs
1724.%D April 1988
1725.%R RFC 1050
1726.%T RPC: Remote Procedure Call Protocol Specification
1727.Re
1728.Pp
1729.Rs
1730.%A V. Jacobson
1731.%D February 1990
1732.%R RFC 1144
1733.%T Compressing TCP/IP Headers for Low-Speed Serial Links
1734.Re
1735.Pp
1736.Rs
1737.%A M. Mathis
1738.%A J. Mahdavi
1739.%A S. Floyd
1740.%A A. Romanow
1741.%D October 1996
1742.%R RFC 2018
1743.%T TCP Selective Acknowledgement Options
1744.Re
1745.Pp
1746.Rs
1747.%A V. Manral
1748.%D April 2007
1749.%R RFC 4835
1750.%T Cryptographic Algorithm Implementation Requirements for Encapsulating Security Payload (ESP) and Authentication Header (AH)
1751.Re
1752.Sh AUTHORS
1753.An -nosplit
1754.An Van Jacobson Aq Mt van@ee.lbl.gov ,
1755.An Craig Leres Aq Mt leres@ee.lbl.gov ,
1756and
1757.An Steven McCanne Aq Mt mccanne@ee.lbl.gov ,
1758all of the Lawrence Berkeley Laboratory, University of California, Berkeley, CA.
1759.Sh BUGS
1760Some attempt should be made to reassemble IP fragments,
1761or at least to compute the right length for the higher level protocol.
1762.Pp
1763Name server inverse queries are not dumped correctly: The
1764.Pq empty
1765question section is printed rather than the real query in the answer section.
1766Some believe that inverse queries are themselves a bug and
1767prefer to fix the program generating them rather than
1768.Nm tcpdump .
1769.Pp
1770A packet trace that crosses a daylight saving time change will give
1771skewed time stamps
1772.Pq the time change is ignored .
1773.Pp
1774Filter expressions that manipulate FDDI headers assume that all FDDI packets
1775are encapsulated Ethernet packets.
1776This is true for IP, ARP, and DECNET Phase IV,
1777but is not true for protocols such as ISO CLNS.
1778Therefore, the filter may inadvertently accept certain packets that
1779do not properly match the filter expression.
1780