diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-06-30 15:58:22 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-06-30 22:59:04 +0000 |
commit | 03517b692b8b5cb934675da282d2452157b1aba3 (patch) | |
tree | c4679fa049a7f49099bd679865a47ffb99fcee98 /dumpcap.c | |
parent | 2a80a9b80a4dcbbb3ed0b48608f72f19f7659b2b (diff) |
Update a comment, and shuffle tests.
Linux isn't the only platform where libpcap may return "The interface
went down".
Put the test for "The interface went down" first.
Change-Id: I5241f0744bd12eb5e090b8e1717268bdf8392ea7
Reviewed-on: https://code.wireshark.org/review/33785
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -4047,24 +4047,29 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct pcap_src = g_array_index(global_ld.pcaps, capture_src *, i); if (pcap_src->pcap_err) { /* On Linux, if an interface goes down while you're capturing on it, - you'll get a "recvfrom: Network is down" or - "The interface went down" error (ENETDOWN). + you'll get "recvfrom: Network is down". (At least you will if g_strerror() doesn't show a local translation of the error.) On FreeBSD, DragonFly BSD, and macOS, if a network adapter - disappears while you're capturing on it, you'll get a + disappears while you're capturing on it, you'll get "read: Device not configured" error (ENXIO). (See previous parenthetical note.) On OpenBSD, you get "read: I/O error" (EIO) in the same case. + With WinPcap and Npcap, you'll get + "read error: PacketReceivePacket failed". + + Newer versions of libpcap map some or all of those to just + "The interface went down". + 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, "recvfrom: Network is down") == 0 || - strcmp(cap_err_str, "The interface went down") == 0 || + if (strcmp(cap_err_str, "The interface went down") == 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) { |