]> The Tcpdump Group git mirrors - libpcap/commit
Add an error for "you don't have permission to open that device", as
authorguy <guy>
Wed, 9 Apr 2008 19:58:02 +0000 (19:58 +0000)
committerguy <guy>
Wed, 9 Apr 2008 19:58:02 +0000 (19:58 +0000)
commit216c64a7ceaa12e96df1c45f90c943d2d958a9cc
treeb9cb66f808df898f5ffdb0e2d68da5a89f7bd9e3
parent745e497e4c79442396fa780f45be0381ea09d002
Add an error for "you don't have permission to open that device", as
that often means "sorry, this platform requires you to run as root or to
somehow tweak the system to give you capture privileges", and
applications might want to explain that in a way that does a better job
of letting the user know what they have to do.

Try to return or PCAP_ERROR_PERM_DENIED for open errors, rather than
just returning PCAP_ERROR, so that the application can, if it chooses,
try to explain the error better (as those two errors are the ones that
don't mean "there's probably some obscure OS or libpcap problem", but
mean, instead, "you made an error" or "you need to get permission to
capture").

Check for monitor mode *after* checking whether the device exists in the
first place; a non-existent device doesn't support monitor mode, but
that's because it doesn't, well, exist, and the latter would be a more
meaningful error.

Have pcap_open_live() supply an error message for return values other
than PCAP_ERROR, PCAP_ERROR_NO_SUCH_DEVICE, and PCAP_ERROR_PERM_DENIED -
those all supply error strings (PCAP_ERROR because it's for various OS
problems that might require debugging, and the other two because there
might be multiple causes).
pcap-bpf.c
pcap-dlpi.c
pcap-libdlpi.c
pcap-linux.c
pcap.c
pcap/pcap.h
pcap_activate.3pcap