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