aboutsummaryrefslogtreecommitdiff
path: root/pcap.c
diff options
context:
space:
mode:
authorguy <guy>2008-07-01 08:02:33 +0000
committerguy <guy>2008-07-01 08:02:33 +0000
commit34624f128f2e6f937c04317fdd2c0ae6d8883ad5 (patch)
treedf708730b36c2a96e7ee94c7b926d4d5bf4d6e64 /pcap.c
parenta8e63c60ed4d25d27c890ecab14e1a831dbeb198 (diff)
When activating a device, return PCAP_ERROR_IFACE_NOT_UP if the device
isn't up, so applications can report that differently from a generic error (the latter could mean there's a bug somewhere in libpcap). When capturing on a device without mmap on Linux, ignore ENETDOWN, so that we can continue to capture traffic if the interface goes down and comes back up again; comments in the kernel indicate that we'll just block waiting for packets if we try to receive from a socket that delivered ENETDOWN, and, if we're using a memory-mapped buffer, we won't even get notified of "network down" events.
Diffstat (limited to 'pcap.c')
-rw-r--r--pcap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pcap.c b/pcap.c
index 01d12d90..3f9fa09e 100644
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.122 2008-05-26 19:58:06 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.123 2008-07-01 08:02:33 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -951,6 +951,9 @@ pcap_statustostr(int errnum)
case PCAP_ERROR_PERM_DENIED:
return ("You don't have permission to capture on that device");
+
+ case PCAP_ERROR_IFACE_NOT_UP:
+ return ("That device is not up");
}
(void)snprintf(ebuf, sizeof ebuf, "Unknown error: %d", errnum);
return(ebuf);