48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
From 8072538381d3f8f80c6ec643ce52a8355ac5fa65 Mon Sep 17 00:00:00 2001
|
|
From: Guy Harris <guy@alum.mit.edu>
|
|
Date: Sun, 30 Jun 2019 19:18:58 -0700
|
|
Subject: [PATCH 80/83] Change the error message for ENXIO/EIO to match
|
|
reality.
|
|
|
|
If an interface is configured down on one of the *BSDs or a Darwin-based
|
|
OS, capturing on that interface on a BPF device doesn't get an error;
|
|
ENXIO/EIO means "the interface went away completely" (e.g., unplugging a
|
|
hot-pluggable interface, shutting down a dynamically-created PPP link,
|
|
etc.).
|
|
---
|
|
pcap-bpf.c | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/pcap-bpf.c b/pcap-bpf.c
|
|
index 62e2ed0..3f9e9ad 100644
|
|
--- a/pcap-bpf.c
|
|
+++ b/pcap-bpf.c
|
|
@@ -1022,17 +1022,19 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|
|
|
case ENXIO: /* FreeBSD, DragonFly BSD, and Darwin */
|
|
case EIO: /* OpenBSD */
|
|
+ /* NetBSD appears not to return an error in this case */
|
|
/*
|
|
* The device on which we're capturing
|
|
* went away.
|
|
*
|
|
* XXX - we should really return
|
|
- * PCAP_ERROR_IFACE_NOT_UP, but
|
|
- * pcap_dispatch() etc. aren't
|
|
- * defined to retur that.
|
|
+ * an appropriate error for that,
|
|
+ * but pcap_dispatch() etc. aren't
|
|
+ * documented as having error returns
|
|
+ * other than PCAP_ERROR or PCAP_ERROR_BREAK.
|
|
*/
|
|
pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
|
- "The interface went down");
|
|
+ "The interface disappeared");
|
|
return (PCAP_ERROR);
|
|
|
|
#if defined(sun) && !defined(BSD) && !defined(__svr4__) && !defined(__SVR4)
|
|
--
|
|
1.8.3.1
|
|
|
|
|