dumpcap: give details on how to fix Npcap bugs.

Give a whole bunch of details to put into the bug, in the (vain?) hope
that the user will put them in the bug, to try to help Daniel and
possibly Microsoft networking stack folk figure out what's happening.

(Remove an extra report_capture_error() left over from the previous
commit.)


(cherry picked from commit 37f5e0f7fd)
This commit is contained in:
Guy Harris 2021-02-08 21:10:54 +00:00
parent 34dbb3bc32
commit ab6fb92ba3
1 changed files with 69 additions and 11 deletions

View File

@ -4025,12 +4025,17 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
"PacketReceivePacket error: The device has been removed. (1617)". "PacketReceivePacket error: The device has been removed. (1617)".
Newer versions of libpcap map some or all of those to just Newer versions of libpcap map some or all of those to just
"The interface disappeared" or something beginning with
"The interface disappeared". "The interface disappeared".
These should *not* be reported to the Wireshark developers. */ These should *not* be reported to the Wireshark developers,
although, with Npcap, "The interface disappeared" messages
should perhaps be reported to the Npcap developers, at least
until errors of that sort that shouldn't happen are fixed,
if that's possible. */
char *cap_err_str; char *cap_err_str;
char *primary_msg; char *primary_msg;
const char *secondary_msg; char *secondary_msg;
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i); interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
cap_err_str = pcap_geterr(pcap_src->pcap_h); cap_err_str = pcap_geterr(pcap_src->pcap_h);
@ -4040,7 +4045,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
"is no longer running; the " "is no longer running; the "
"capture has stopped.", "capture has stopped.",
interface_opts->name); interface_opts->name);
secondary_msg = ""; secondary_msg = g_strdup("");
} else if (strcmp(cap_err_str, "The interface disappeared") == 0 || } else if (strcmp(cap_err_str, "The interface disappeared") == 0 ||
strcmp(cap_err_str, "read: Device not configured") == 0 || strcmp(cap_err_str, "read: Device not configured") == 0 ||
strcmp(cap_err_str, "read: I/O error") == 0 || strcmp(cap_err_str, "read: I/O error") == 0 ||
@ -4049,8 +4054,41 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
"is no longer attached; the " "is no longer attached; the "
"capture has stopped.", "capture has stopped.",
interface_opts->name); interface_opts->name);
secondary_msg = ""; secondary_msg = g_strdup("");
report_capture_error(primary_msg, secondary_msg); } else if (g_str_has_prefix(cap_err_str, "The interface disappeared ")) {
/*
* Npcap, if it picks up a recent commit to libpcap, will
* report an error *beginning* with "The interface
* disappeared", with the name of the Windows status code,
* and the corresponding NT status code, after it.
*
* Those should be reported as Npcap issues.
*/
primary_msg = g_strdup_printf("The network adapter \"%s\" "
"is no longer attached; the "
"capture has stopped.",
interface_opts->name);
secondary_msg = g_strdup_printf("If you have not removed that "
"adapter, this may be a bug "
"in Npcap: please report it "
"as an issue at https://github.com/nmap/npcap/issues\n\n"
"Give all details, such as "
"the name of the adapter on "
"which the error occurred, "
"the error message \"%s\", "
"the full version of Windows "
"on which this occurred, "
"the version of Npcap with "
"which this occurred, any "
"indication of whether the "
"machine went to sleep "
"during the capture, "
"and any indication of "
"whether any other interfaces "
"were added to or removed "
"from the machine while the "
"capture was taking place.",
cap_err_str);
} else if (g_str_has_prefix(cap_err_str, "PacketReceivePacket error:") && } else if (g_str_has_prefix(cap_err_str, "PacketReceivePacket error:") &&
g_str_has_suffix(cap_err_str, "(1617)")) { g_str_has_suffix(cap_err_str, "(1617)")) {
/* /*
@ -4074,20 +4112,40 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
"is no longer attached; the " "is no longer attached; the "
"capture has stopped.", "capture has stopped.",
interface_opts->name); interface_opts->name);
secondary_msg = "If you have not removed that adapter, " secondary_msg = g_strdup_printf("If you have not removed that "
"this may be a bug in Npcap: please report it " "adapter, this may be a bug "
"as an issue at https://github.com/nmap/npcap/issues"; "in Npcap: please report it "
"as an issue at https://github.com/nmap/npcap/issues\n\n"
"Give all details, such as "
"the name of the adapter on "
"which the error occurred, "
"the error message \"%s\", "
"the full version of Windows "
"on which this occurred, "
"the version of Npcap with "
"which this occurred, any "
"indication of whether the "
"machine went to sleep "
"during the capture, "
"and any indication of "
"whether any other interfaces "
"were added to or removed "
"from the machine while the "
"capture was taking place.",
"(ERROR_DEVICE_REMOVED/STATUS_DEVICE_REMOVED)");
} else if (strcmp(cap_err_str, "The other host terminated the connection") == 0) { } else if (strcmp(cap_err_str, "The other host terminated the connection") == 0) {
primary_msg = g_strdup(cap_err_str); primary_msg = g_strdup(cap_err_str);
secondary_msg = "This may be a problem with the remote host " secondary_msg = g_strdup("This may be a problem with the "
"on which you are capturing packets."; "remote host on which you are "
"capturing packets.");
} else { } else {
primary_msg = g_strdup_printf("Error while capturing packets: %s", primary_msg = g_strdup_printf("Error while capturing packets: %s",
cap_err_str); cap_err_str);
secondary_msg = please_report_bug(); secondary_msg = g_strdup(please_report_bug());
} }
report_capture_error(primary_msg, secondary_msg); report_capture_error(primary_msg, secondary_msg);
g_free(primary_msg); g_free(primary_msg);
g_free(secondary_msg);
break; break;
} else if (pcap_src->from_cap_pipe && pcap_src->cap_pipe_err == PIPERR) { } else if (pcap_src->from_cap_pipe && pcap_src->cap_pipe_err == PIPERR) {
report_capture_error(errmsg, ""); report_capture_error(errmsg, "");