]> The Tcpdump Group git mirrors - tcpdump/commit
Add --skip option to skip some packets before writing or printing
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 21 Oct 2024 08:43:38 +0000 (10:43 +0200)
committerfxlb <[email protected]>
Wed, 23 Oct 2024 07:23:47 +0000 (07:23 +0000)
commitd0c66a2c2aa40ee0289198086cf20e1f21b7bf9c
treea9f5d6e8295def36b5460aafe5d1c01b52a91ffe
parent07a730a6f5d7d92d34cd7b137fa7fc21505f8441
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
CHANGES
tcpdump.1.in
tcpdump.c
tests/TESTLIST
tests/dns_tcp-skip-3-c-1.out [new file with mode: 0644]
tests/dns_tcp-skip-3-c-4.out [new file with mode: 0644]
tests/dns_tcp-skip-3.out [new file with mode: 0644]