Commit Graph

140 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
d0c66a2c2a Add --skip option to skip some packets before writing or printing
With this change, we can write/print some contiguous packets from a file.
We can also skip some packets doing a live capture.

The '--skip 0' option is allowed to help some loop in a shell script.

Examples:

Skip 3 packets when printing:
tcpdump -#n --skip 3 -r in.pcap

Write the sixth packet, if any:
tcpdump --skip 5 -c 1 -r in.pcap -w out.pcap

Write up to 5 packets after skipping 3:
tcpdump --skip 3 -c 5 -r in.pcap -w out.pcap
2024-10-23 07:23:47 +00:00
Denis Ovsienko
70e4bc73c3 man: Clarify the "any" pseudo-interface further. [skip ci]
In the -f flag description just refer to the -i flag description to
deduplicate the prose.  In the -i flag description reword the "any" note
consistently with that in pcap_create(3PCAP) and pcap_open_live(3PCAP).
2024-09-07 11:03:56 +01:00
Denis Ovsienko
919a471db9 man: Document the minimum libpcap version too. [skip ci]
This should complete the changes in commit d5b1a16.
2024-08-19 17:43:22 +01:00
Guy Harris
d5b1a160a3 Get rid of support for libpcap prior to 1.0.
This lets us remove a bunch of configure-time and compile-time tests.

Update documentation to reflect this.

WinPcap 4.1.3 is based on libpcap 1.0, but doesn't export all of the new
APIs, so it won't work with code that uses any of the other APIs, which
tcpdump does, so don't test with WinPcap.
2024-05-19 12:43:23 -07:00
Richard Scheffenegger
55dc3206aa TCP: Add support for the AE (AccECN) flag.
Print the new flag using lowercase "e" to avoid confusion with the
existing uppercase flags and "." for ACK.  Add/update tests.  Document
it in the man page using "AE" as the shorthand.
2024-03-27 11:19:34 +00:00
Francois-Xavier Le Bail
dca4050493 man: Update the date
[skip ci]
2024-03-27 08:57:35 +01:00
Francois-Xavier Le Bail
9d2e0f1834 man: Update the -# (--number) option entry
Remove "optional". If we choose to print a packet number, it is not
optional.

[skip ci]
2024-03-26 14:42:07 +01:00
Denis Ovsienko
79db56cd7c man: Refine for better HTML output. [skip ci]
Format man page references, filter expressions, command-line options and
C names consistently with most other man pages.  Fixup capitalization
and wording in a few instances, among other things do not document NFS
as Sun-specific and AFS -- as Transarc-specific.  Remove the reference
to bpf(4), which belongs to libpcap only, and the description of bugs
that are entirely libpcap-specific and are documented in pcap-filter(7).
2024-03-25 21:07:57 +00:00
Denis Ovsienko
3eff1e0b41 man: ...and remove NIT-specific prose as well. [skip ci] 2024-03-23 17:01:41 +00:00
Denis Ovsienko
63341baa81 man: Do not refer to nit(4P) anymore. [skip ci]
This reference has been in this man page since tcpdump 2.0, which
included both libpcap and a man page with NIT particulars, which later
migrated to a libpcap man page and recently disappeared from there
as a part of SunOS 3.x support, so this reference no longer has any
purpose even remotely.
2024-03-22 18:54:16 +00:00
Denis Ovsienko
10c9f6fdaa Finish the pruning of unsupported OSes.
State the details in the change log and update the man page date stamp.
2024-02-03 10:30:26 +00:00
Denis Ovsienko
630f9bcaa8 Retire Tru64 UNIX support.
See also commit 6008cb8.
2024-01-28 11:35:15 +00:00
Francois-Xavier Le Bail
91b2aa5e25 man: Update the date
[skip ci]
2023-12-29 10:51:30 +01:00
Francois-Xavier Le Bail
4c5bef9603 Add --lengths option to print the captured and original packet lengths
The lengths will be printed at the beginning of the line or after the
packet number, if any.

'caplen' is the captured length.
'len' is the original (on wire) length.

Examples
1) With -#n
    1  caplen 80 len 98 14:41:53.503612 IP 192.168.1.11.43966 > [...]
2) With -n
caplen 80 len 98 14:43:38.185603 IP 192.168.1.11.43966 > [...]

Add a test file with one packet not truncated, the other truncated.

[skip ci]
2023-12-26 12:50:38 +00:00
Francois-Xavier Le Bail
c3d01cd946 man: Replace some command name 'Tcpdump' with 'tcpdump'
[skip ci]
2023-12-20 20:46:42 +01:00
Francois-Xavier Le Bail
5db1dbf206 man: Fix an example by quoting a filter expression
It's to prevent the shell from (mis-)interpreting the square brackets.

e.g. if there is a file named tcp1 in the current directory,
with tcp[13] == 2, the executed command will be:
tcpdump -i xl0 tcp1 == 2
Result: tcpdump: can't parse filter expression: syntax error

[skip ci]
2023-10-21 09:39:17 +02:00
Francois-Xavier Le Bail
3465ec4a0c IP: Enable TSO (TCP Segmentation Offload) support
It's a follow-up to c8623960f0.

The support is now enabled by default. No more "#ifdef GUESS_TSO".

Output example:
  length 2016 [was 0, presumed TSO]

Add a test file with presumed TSO.
(From http://cloudshark.org/captures/25e40f73bc1c, found via
https://osqa-ask.wireshark.org/questions/16279/)

Use ND_ICHECKMSG_U() to test an invalid total length < header length.

Output example:
  [total length 19 < 20] (invalid)

Add a test file for this case.

Move ND_TCHECK_SIZE(ip) after the new tests.

Add a const qualifier for the ip_print() parameter 'length'.

Update the man page.
2023-10-06 14:26:19 +00:00
Janne Heß
f259b0e0d6 man: Document interface and packet type
The packet types are not really obvious and I didn't find them to be
documented yet.

[skip ci]
2023-10-04 13:25:02 +00:00
Josh Soref
38050da48e Fix spelling
* account
* address
* adjacency
* alignment
* anymore
* ascii
* assumption
* blithely
* canonical
* compound
* consecutive
* control
* diagnostics
* disassociation
* fairly
* fallthrough
* greatest
* identification
* multihop
* multiplexed
* nonexistent
* notifiable
* notwithstanding
* number
* polynomial
* preexisting
* proprietary
* quenches
* reassociation
* redefinition
* refresh
* solicitation
* specifying
* support
* the
* unacceptable

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-08-20 07:19:40 +00:00
Jesse Rosenstock
97fd59b025
tcpdump.1.in: Delete Linux 2.0 references
Delete Linux 2.0 bugs from bug list.

Linux 2.0.x releases are from 1996-2004. The man page recommended upgrading to Linux 2.2, released in 1999.

https://en.wikipedia.org/wiki/Linux_kernel_version_history#Releases_up_to_2.6.0

I'm assuming these >20 year old bug references aren't that useful now.
2023-05-07 17:21:23 +02:00
Denis Ovsienko
658778cc02 man: Format "output format" subsections properly. [skip ci] 2023-03-18 16:24:26 +00:00
Denis Ovsienko
eb2f8839ac man: Spell TCP header flags names. [skip ci]
In the prose use the names from respective registry [1], which says:

* "PSH", not "PUSH",
* "CWR", not "ECN CWR", and
* "ECE", not "ECN-Echo".

This does not resolve all known inconsistencies related to TCP flags,
but at least makes the problem smaller.

1: https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml
2023-03-12 20:25:22 +00:00
Francois-Xavier Le Bail
ded255a178 man: Add the TCP flag names tcp-ece and tcp-cwr
State that these flag names became available when linking with libpcap
1.9.0 or later.
2023-02-26 15:16:11 +01:00
Denis Ovsienko
7047194eaf man: Lose an excess newline in tcpdump(1).
This improves the derived HTML version and has no effect on the plain
text version, as far as I can tell.

[skip ci]
2022-10-19 21:40:50 +01:00
Denis Ovsienko
de27d59e78 man: Update tcpdump(1) about "-i any". [skip ci]
Call it consistently a "pseudo-interface" and mention other OSes that
seem to support it, as far as reports on the interwebs go.
2022-07-30 15:46:44 +01:00
Francois-Xavier Le Bail
7d2bc7fcb5 Fix some typos
[skip ci]
2022-07-04 14:03:15 +02:00
Denis Ovsienko
af98bb4776 Convert CONTRIBUTING to Markdown. [skip ci] 2022-06-09 10:16:26 +01:00
Denis Ovsienko
d65f3f14d4 man: Put commit 4a904f4 right. [skip ci] 2022-02-13 10:39:46 +00:00
Denis Ovsienko
4a904f4362 man: Refer to pcap-filter(7) early. [skip ci] 2022-01-20 15:23:09 +00:00
Nathan O'Sullivan
63b104dc5b Add --print-sampling option to print every Nth packet
New option `--print-sampling=NTH` will parse and print every NTH packet,
with all other packets producing no output. This option enables
`--print` and `-S` flags.

Print sampling is useful for real-time inspection of an interface with
a high packet rate, or initial inspection of large capture files.
2022-01-17 19:43:59 +00:00
Denis Ovsienko
cf1b9455e7 Reword the current maintainer in README.md. [skip ci]
Use the correct tense and subject (see tcpdump-htdocs commit feaf9ff).
2021-12-25 23:31:37 +00:00
Denis Ovsienko
b99f16cd33 man: Punctuate "RFC" properly. [skip ci]
As far as I know, the nominal format is "RFC n", not "RFC-n" or "RFCn".
2021-12-06 19:15:40 +00:00
Francois-Xavier Le Bail
69c0a4b0cc man: Update the date 2021-11-29 13:59:51 +01:00
Francois-Xavier Le Bail
b27c4e43a2 man: Update the print interface for the packet count to stdout
This is a follow-up to commit a0e19c0cae.
2021-11-29 12:13:54 +01:00
Francois-Xavier Le Bail
17cd0305d4 Document "-T quic" 2021-11-09 10:15:23 +01:00
Denis Ovsienko
42ae99dd6c man: Fixup some formatting. [skip ci]
Use BSD style references and protect some refs from hyphenation.
2021-10-20 13:47:59 +01:00
Denis Ovsienko
95483a4c7b Update the man page timestamp. [skip ci] 2021-07-18 23:56:46 +01:00
Guy Harris
5ff873f0d2 Improve the handling of size suffixes for -C.
Support upper-case suffixes (K/M/G) as well as lower-case suffixes.

Make sure nothing *follows* the suffix.

We don't need to check for the suffix before parsing the number; the
parsing routines stop if they see a non-digit character.
2021-07-10 14:01:18 -07:00
Steve Kay
81e2588d2b optional unit suffix on -C 2021-05-08 14:32:24 -04:00
Francois-Xavier Le Bail
eac90e30d2 man: Update DNS sections
The DNS transactions also take place over TCP.

Harmonize text: s/not including/excluding/ like in Name Server Responses
section.

[skip ci]
2021-04-25 20:35:18 +02:00
Denis Ovsienko
76e6b9c658 man: Update a reference as www.cifs.org is gone. [skip ci] 2021-01-28 23:29:57 +00:00
Denis Ovsienko
1462b6133b man: Note the -x/-X quirk for truncated packets [skip ci]
Accurate skipping of the link level header was working before the
conversion started, it will hopefully work after the conversion is
complete, but meanwhile be clear about what it is now.
2020-12-21 02:46:37 +00:00
Denis Ovsienko
a039d03bc2 man: Make more editorial improvements.
Improve some punctuation, spell some acronyms in upper case, fix a term.
2020-10-17 17:55:37 +01:00
Denis Ovsienko
afb355923c Add more "-v" detail to tcpdump(1) for GH #380. [skip ci]
Capture what Guy has figured out so far.
2020-09-15 12:15:47 +01:00
Denis Ovsienko
870eeabe89 Report periodic stats only when safe to do so. [skip ci]
As explained in GH #155, when tcpdump is given -r, -w and -v and it
takes long enough to read from the input file (because it is stdin
connected through network or a pipe to stdout of another tcpdump doing
a live capture), pcap_loop() will error before long. One of the ways to
reproduce the fault is as follows:

$ tcpdump -i eno1 -w - | tcpdump -r - -w /tmp/tmp.pcap -v
tcpdump: listening on eno1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
reading from file -, link-type EN10MB (Ethernet), snapshot length 262144
tcpdump: pcap_loop: error reading dump file: Interrupted system call

Skip the verbose_stats_dump() timer setup in this specific corner case
for the time being and document it.
2020-08-29 02:48:07 +01:00
Denis Ovsienko
d5bb7824e1 Fixup some letter case in the man page. [skip ci] 2020-08-22 01:52:02 +01:00
Denis Ovsienko
9d69766c33 Update the man page for "-d", "-i" and "-y".
Describe the changes in behaviour after commit 74e6075, which implements
the discussion made in GH #804.

[skip ci]
2020-08-10 12:04:51 +01:00
Denis Ovsienko
f72070a7e0 Use more BSD style references in the man page.
[skip ci]
2020-07-28 16:10:59 +01:00
Francois-Xavier Le Bail
8a33158e88 man: Add an example for printing TCP with RST+ACK both set
Partially based on a Guy's comment in issue #860.

[skip ci]
2020-06-25 09:52:55 +02:00
Guy Harris
f025901fd2 -i affects more than just capture.
Expand the description of the -i flag.
2020-05-06 16:36:59 -07:00