diff options
author | guy <guy> | 2008-04-09 19:58:02 +0000 |
---|---|---|
committer | guy <guy> | 2008-04-09 19:58:02 +0000 |
commit | 216c64a7ceaa12e96df1c45f90c943d2d958a9cc (patch) | |
tree | b9cb66f808df898f5ffdb0e2d68da5a89f7bd9e3 /pcap_activate.3pcap | |
parent | 745e497e4c79442396fa780f45be0381ea09d002 (diff) |
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).
Diffstat (limited to 'pcap_activate.3pcap')
-rw-r--r-- | pcap_activate.3pcap | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pcap_activate.3pcap b/pcap_activate.3pcap index 94d7330b..43bad033 100644 --- a/pcap_activate.3pcap +++ b/pcap_activate.3pcap @@ -1,4 +1,4 @@ -.\" @(#) $Header: /tcpdump/master/libpcap/pcap_activate.3pcap,v 1.1 2008-04-06 02:53:21 guy Exp $ +.\" @(#) $Header: /tcpdump/master/libpcap/pcap_activate.3pcap,v 1.2 2008-04-09 19:58:02 guy Exp $ .\" .\" Copyright (c) 1994, 1996, 1997 .\" The Regents of the University of California. All rights reserved. @@ -43,7 +43,10 @@ returns 0 on success, .B PCAP_ERROR_ACTIVATED if the handle has already been activated, .B PCAP_ERROR_NO_SUCH_DEVICE -if the capture source specified when the handle was created doesn't exist, +if the capture source specified when the handle was created doesn't +exist, +.B PCAP_ERROR_PERM_DENIED +if the process doesn't have permission to open the capture source, .B PCAP_ERROR_RFMON_NOTSUP if monitor mode was specified but the capture source doesn't support monitor mode, and |