]> The Tcpdump Group git mirrors - libpcap/commit
Fix "tcpdump -i <n>" for something-only libpcap builds.
authorDenis Ovsienko <[email protected]>
Thu, 14 Nov 2024 08:15:02 +0000 (08:15 +0000)
committerDenis Ovsienko <[email protected]>
Thu, 14 Nov 2024 08:24:27 +0000 (08:24 +0000)
commit8a5dcc8840bfbdc3256f4d50d9924b3234342fba
tree79a15f8202137b9bc754ff9b5bb27c128a489636
parentc6ea3652f55b9d1ab1c0c94f5f8ba0c0bca64a9d
Fix "tcpdump -i <n>" for something-only libpcap builds.

pcap_create() returns NULL for all errors, so tcpdump tries to find
evidence of ENODEV in the error buffer in order to retry using a
different device name.  That does not work when the error string is
"This version of libpcap only supports...", so use a format string that
works and place it in pcap-int.h.

# tcpdump --version
tcpdump version 5.0.0-PRE-GIT
libpcap version 1.11.0-PRE-GIT (DAG-only)

# tcpdump -D
1.dag0 (alias for dag0:0) [none]
2.dag0:0 (Rx stream 0, 64 MiB, DAG 7.5G2 rev A at 0000:01:00.0) [none]
3.dag1 (alias for dag1:0) [none]
4.dag1:0 (Rx stream 0, 64 MiB, DAG 9.2X2 rev D at 0000:02:00.0) [none]
5.dag16 (alias for dag16:0) [none]
6.dag16:0 (Rx stream 0, 64 MiB, vDAG) [none]

Before:

# tcpdump -ni 1
tcpdump: This version of libpcap only supports DAG cards

After:

# tcpdump -ni abcde
tcpdump: No such device (this build of libpcap supports DAG devices only).

# tcpdump -ni 1
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on dag0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
CHANGES
pcap-dag.c
pcap-dpdk.c
pcap-int.h
pcap-septel.c
pcap-snf.c