dumpcap: fix opening of pipes on Windows broken since gbed29af
Previous code was assuming that all local pipes were of extcap type. Let's explicitly check for extcap prefix now. Bug: 10803 Change-Id: If955e77a9ee2af11b553740269964c40273d5177 Reviewed-on: https://code.wireshark.org/review/8013 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
9ea521532e
commit
2e8d8e12cd
18
dumpcap.c
18
dumpcap.c
@ -163,6 +163,10 @@
|
|||||||
|
|
||||||
#include "caputils/ws80211_utils.h"
|
#include "caputils/ws80211_utils.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_EXTCAP
|
||||||
|
#include "extcap.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get information about libpcap format from "wiretap/libpcap.h".
|
* Get information about libpcap format from "wiretap/libpcap.h".
|
||||||
* XXX - can we just use pcap_open_offline() to read the pipe?
|
* XXX - can we just use pcap_open_offline() to read the pipe?
|
||||||
@ -2045,6 +2049,10 @@ cap_pipe_open_live(char *pipename,
|
|||||||
char *pncopy, *pos;
|
char *pncopy, *pos;
|
||||||
wchar_t *err_str;
|
wchar_t *err_str;
|
||||||
interface_options interface_opts;
|
interface_options interface_opts;
|
||||||
|
#ifdef HAVE_EXTCAP
|
||||||
|
char* extcap_pipe_name;
|
||||||
|
gboolean extcap_pipe;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
ssize_t b;
|
ssize_t b;
|
||||||
int fd = -1, sel_ret;
|
int fd = -1, sel_ret;
|
||||||
@ -2054,6 +2062,7 @@ cap_pipe_open_live(char *pipename,
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
pcap_opts->cap_pipe_h = INVALID_HANDLE_VALUE;
|
pcap_opts->cap_pipe_h = INVALID_HANDLE_VALUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: %s", pipename);
|
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: %s", pipename);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2181,13 +2190,20 @@ cap_pipe_open_live(char *pipename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, 0);
|
interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, 0);
|
||||||
|
#ifdef HAVE_EXTCAP
|
||||||
|
extcap_pipe_name = g_strconcat("\\\\.\\pipe\\", EXTCAP_PIPE_PREFIX, NULL);
|
||||||
|
extcap_pipe = strstr(interface_opts.name, extcap_pipe_name) ? TRUE : FALSE;
|
||||||
|
g_free(extcap_pipe_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Wait for the pipe to appear */
|
/* Wait for the pipe to appear */
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
if(strncmp(interface_opts.name,"\\\\.\\pipe\\",9)== 0)
|
#ifdef HAVE_EXTCAP
|
||||||
|
if(extcap_pipe)
|
||||||
pcap_opts->cap_pipe_h = GetStdHandle(STD_INPUT_HANDLE);
|
pcap_opts->cap_pipe_h = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
pcap_opts->cap_pipe_h = CreateFile(utf_8to16(pipename), GENERIC_READ, 0, NULL,
|
pcap_opts->cap_pipe_h = CreateFile(utf_8to16(pipename), GENERIC_READ, 0, NULL,
|
||||||
OPEN_EXISTING, 0, NULL);
|
OPEN_EXISTING, 0, NULL);
|
||||||
|
|
||||||
|
3
extcap.c
3
extcap.c
@ -62,9 +62,6 @@ static HANDLE pipe_h = NULL;
|
|||||||
*/
|
*/
|
||||||
static GHashTable *ifaces = NULL;
|
static GHashTable *ifaces = NULL;
|
||||||
|
|
||||||
/* Prefix for the pipe interfaces */
|
|
||||||
#define EXTCAP_PIPE_PREFIX "wireshark_extcap"
|
|
||||||
|
|
||||||
/* Callback definition for extcap_foreach */
|
/* Callback definition for extcap_foreach */
|
||||||
typedef gboolean (*extcap_cb_t)(const gchar *extcap, gchar *output, void *data,
|
typedef gboolean (*extcap_cb_t)(const gchar *extcap, gchar *output, void *data,
|
||||||
gchar **err_str);
|
gchar **err_str);
|
||||||
|
3
extcap.h
3
extcap.h
@ -37,6 +37,9 @@
|
|||||||
|
|
||||||
#ifdef HAVE_EXTCAP
|
#ifdef HAVE_EXTCAP
|
||||||
|
|
||||||
|
/* Prefix for the pipe interfaces */
|
||||||
|
#define EXTCAP_PIPE_PREFIX "wireshark_extcap"
|
||||||
|
|
||||||
#define EXTCAP_ARGUMENT_CONFIG "--extcap-config"
|
#define EXTCAP_ARGUMENT_CONFIG "--extcap-config"
|
||||||
#define EXTCAP_ARGUMENT_LIST_INTERFACES "--extcap-interfaces"
|
#define EXTCAP_ARGUMENT_LIST_INTERFACES "--extcap-interfaces"
|
||||||
#define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
|
#define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user