diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-07-01 00:12:40 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-07-01 07:13:17 +0000 |
commit | 37ff9dacb9e27bdf7b6b296bebad11694c6ba167 (patch) | |
tree | c0d487ef1c1a815164fbebb19203c41880a344ba /dumpcap.c | |
parent | 9ad5dc26dd1e0400d209e0024cff44af3c90031c (diff) |
Distinguish "Interface went down" from "Interface disappeared".
Have separate errors for "the interface went down" on Linux and "the
interface no longer exists" on *BSD/Darwin/Windows.
Change-Id: I1951c647e88eb7ebeb20a72d9e03a2072168c8e5
Reviewed-on: https://code.wireshark.org/review/33794
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -4051,6 +4051,9 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct (At least you will if g_strerror() doesn't show a local translation of the error.) + Newer versions of libpcap maps that to just + "The interface went down". + On FreeBSD, DragonFly BSD, and macOS, if a network adapter disappears while you're capturing on it, you'll get "read: Device not configured" error (ENXIO). (See previous @@ -4062,21 +4065,24 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct "read error: PacketReceivePacket failed". Newer versions of libpcap map some or all of those to just - "The interface went down" or "The interface disappeared". + "The interface disappeared". These should *not* be reported to the Wireshark developers. */ char *cap_err_str; cap_err_str = pcap_geterr(pcap_src->pcap_h); if (strcmp(cap_err_str, "The interface went down") == 0 || - strcmp(cap_err_str, "The interface disappeared") == 0 || - strcmp(cap_err_str, "recvfrom: Network is down") == 0 || - strcmp(cap_err_str, "read: Device not configured") == 0 || - strcmp(cap_err_str, "read: I/O error") == 0 || - strcmp(cap_err_str, "read error: PacketReceivePacket failed") == 0) { + strcmp(cap_err_str, "recvfrom: Network is down") == 0) { report_capture_error("The network adapter on which the capture was being done " "is no longer running; the capture has stopped.", ""); + } else if (strcmp(cap_err_str, "The interface disappeared") == 0 || + strcmp(cap_err_str, "read: Device not configured") == 0 || + strcmp(cap_err_str, "read: I/O error") == 0 || + strcmp(cap_err_str, "read error: PacketReceivePacket failed") == 0) { + report_capture_error("The network adapter on which the capture was being done " + "is no longer attached; the capture has stopped.", + ""); } else { g_snprintf(errmsg, sizeof(errmsg), "Error while capturing packets: %s", cap_err_str); |