forked from osmocom/wireshark
dumpcap: Fix a TODO for Npcap test
This commit is contained in:
parent
ac6cbbcda3
commit
8cd49b2da0
|
@ -160,25 +160,6 @@ gather_caplibs_compile_info(feature_list l)
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Append the version of libpcap with which we're running to a GString.
|
|
||||||
* Used in dumpcap when reporting a pcap bug.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
get_runtime_caplibs_version(GString *str)
|
|
||||||
{
|
|
||||||
const char *vstr = pcap_lib_version();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove the substring "version" from the output of pcap_lib_version()
|
|
||||||
* to be consistent with our format.
|
|
||||||
*/
|
|
||||||
if (g_str_has_prefix(vstr, "libpcap version ")) /* Sanity check */
|
|
||||||
g_string_append_printf(str, "libpcap %s", vstr + strlen("libpcap version "));
|
|
||||||
else
|
|
||||||
g_string_append(str, vstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gather_caplibs_runtime_info(feature_list l)
|
gather_caplibs_runtime_info(feature_list l)
|
||||||
{
|
{
|
||||||
|
@ -207,14 +188,6 @@ gather_caplibs_compile_info(feature_list l)
|
||||||
without_feature(l, "libpcap");
|
without_feature(l, "libpcap");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Don't append anything, as we weren't even compiled to use libpcap.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
get_runtime_caplibs_version(GString *str _U_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gather_caplibs_runtime_info(feature_list l _U_)
|
gather_caplibs_runtime_info(feature_list l _U_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,9 +88,12 @@ extern void gather_caplibs_compile_info(feature_list l);
|
||||||
* WinPcap/Npcap wasn't loaded, or nothing, if we weren't compiled with
|
* WinPcap/Npcap wasn't loaded, or nothing, if we weren't compiled with
|
||||||
* libpcap/WinPcap/Npcap.
|
* libpcap/WinPcap/Npcap.
|
||||||
*/
|
*/
|
||||||
extern void get_runtime_caplibs_version(GString *str);
|
|
||||||
extern void gather_caplibs_runtime_info(feature_list l);
|
extern void gather_caplibs_runtime_info(feature_list l);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
extern gboolean caplibs_have_npcap(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -221,6 +221,12 @@ load_wpcap(void)
|
||||||
has_wpcap = TRUE;
|
has_wpcap = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
caplibs_have_npcap(void)
|
||||||
|
{
|
||||||
|
return has_wpcap && g_str_has_prefix(p_pcap_lib_version(), "Npcap");
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
local_code_page_str_to_utf8(char *str)
|
local_code_page_str_to_utf8(char *str)
|
||||||
{
|
{
|
||||||
|
@ -819,24 +825,6 @@ gather_caplibs_compile_info(feature_list l)
|
||||||
with_feature(l, "libpcap");
|
with_feature(l, "libpcap");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Append the version of Npcap with which we're running to a GString.
|
|
||||||
* Used in dumpcap when reporting a pcap bug.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
get_runtime_caplibs_version(GString *str)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* On Windows, we might have been compiled with WinPcap/Npcap but
|
|
||||||
* might not have it loaded; indicate whether we have it or
|
|
||||||
* not and, if we have it, what version we have.
|
|
||||||
*/
|
|
||||||
if (has_wpcap) {
|
|
||||||
g_string_append(str, p_pcap_lib_version());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gather_caplibs_runtime_info(feature_list l)
|
gather_caplibs_runtime_info(feature_list l)
|
||||||
{
|
{
|
||||||
|
@ -903,20 +891,17 @@ gather_caplibs_compile_info(feature_list l)
|
||||||
without_feature(l, "libpcap");
|
without_feature(l, "libpcap");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Don't append anything, as we weren't even compiled to use WinPcap/Npcap.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
get_runtime_caplibs_version(GString *str _U_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gather_caplibs_runtime_info(feature_list l _U_)
|
gather_caplibs_runtime_info(feature_list l _U_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
caplibs_have_npcap(void)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LIBPCAP */
|
#endif /* HAVE_LIBPCAP */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
23
dumpcap.c
23
dumpcap.c
|
@ -3863,33 +3863,26 @@ capture_loop_dequeue_packet(void) {
|
||||||
static char *
|
static char *
|
||||||
handle_npcap_bug(char *adapter_name _U_, char *cap_err_str _U_)
|
handle_npcap_bug(char *adapter_name _U_, char *cap_err_str _U_)
|
||||||
{
|
{
|
||||||
GString *pcap_info_str;
|
gboolean have_npcap = FALSE;
|
||||||
GString *windows_info_str;
|
|
||||||
char *msg;
|
|
||||||
|
|
||||||
pcap_info_str = g_string_new("");
|
#ifdef _WIN32
|
||||||
// TODO: test directly for Npcap here, so we can remove
|
have_npcap = caplibs_have_npcap();
|
||||||
// get_runtime_caplibs_version()
|
#endif
|
||||||
get_runtime_caplibs_version(pcap_info_str);
|
|
||||||
if (!g_str_has_prefix(pcap_info_str->str, "Npcap")) {
|
if (!have_npcap) {
|
||||||
/*
|
/*
|
||||||
* We're not using Npcap, so don't recomment a user
|
* We're not using Npcap, so don't recomment a user
|
||||||
* file a bug against Npcap.
|
* file a bug against Npcap.
|
||||||
*/
|
*/
|
||||||
g_string_free(pcap_info_str, TRUE);
|
|
||||||
return g_strdup("");
|
return g_strdup("");
|
||||||
}
|
}
|
||||||
windows_info_str = g_string_new("");
|
|
||||||
get_os_version_info(windows_info_str);
|
return ws_strdup_printf("If you have not removed that adapter, this "
|
||||||
msg = ws_strdup_printf("If you have not removed that adapter, this "
|
|
||||||
"is probably a known issue in Npcap resulting from "
|
"is probably a known issue in Npcap resulting from "
|
||||||
"the behavior of the Windows networking stack. "
|
"the behavior of the Windows networking stack. "
|
||||||
"Work is being done in Npcap to improve the "
|
"Work is being done in Npcap to improve the "
|
||||||
"handling of this issue; it does not need to "
|
"handling of this issue; it does not need to "
|
||||||
"be reported as a Wireshark or Npcap bug.");
|
"be reported as a Wireshark or Npcap bug.");
|
||||||
g_string_free(windows_info_str, TRUE);
|
|
||||||
g_string_free(pcap_info_str, TRUE);
|
|
||||||
return msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the low-level work of a capture.
|
/* Do the low-level work of a capture.
|
||||||
|
|
Loading…
Reference in New Issue