forked from osmocom/wireshark
Behave more gracefully if WinPcap isn't installed. Don't assert if
we call pcap_open or pcap_open_live when WinPcap isn't loaded - just return NULL. Don't display the "NPF driver isn't running" dialog if we're capturing from stdin or a file. Fix a cut-and-paste error in capture_pcap_linktype_list. svn path=/trunk/; revision=31275
This commit is contained in:
parent
ae2b555a96
commit
7871c54e99
|
@ -295,15 +295,19 @@ pcap_lookupnet(const char *a, bpf_u_int32 *b, bpf_u_int32 *c, char *d)
|
||||||
pcap_t*
|
pcap_t*
|
||||||
pcap_open_live(const char *a, int b, int c, int d, char *e)
|
pcap_open_live(const char *a, int b, int c, int d, char *e)
|
||||||
{
|
{
|
||||||
g_assert(has_wpcap);
|
if (!has_wpcap) {
|
||||||
return p_pcap_open_live(a, b, c, d, e);
|
return NULL;
|
||||||
|
}
|
||||||
|
return p_pcap_open_live(a, b, c, d, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PCAP_REMOTE
|
#ifdef HAVE_PCAP_REMOTE
|
||||||
pcap_t*
|
pcap_t*
|
||||||
pcap_open(const char *a, int b, int c, int d, struct pcap_rmtauth *e, char *f)
|
pcap_open(const char *a, int b, int c, int d, struct pcap_rmtauth *e, char *f)
|
||||||
{
|
{
|
||||||
g_assert(has_wpcap);
|
if (!has_wpcap) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return p_pcap_open(a, b, c, d, e, f);
|
return p_pcap_open(a, b, c, d, e, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -759,12 +759,12 @@ capture_pcap_linktype_list(const gchar *ifname, char **err_str)
|
||||||
gchar **raw_list, **lt_parts;
|
gchar **raw_list, **lt_parts;
|
||||||
data_link_info_t *data_link_info;
|
data_link_info_t *data_link_info;
|
||||||
|
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List ...");
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Linktype List ...");
|
||||||
|
|
||||||
/* Try to get our interface list */
|
/* Try to get our interface list */
|
||||||
err = sync_linktype_list_open(ifname, &msg);
|
err = sync_linktype_list_open(ifname, &msg);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List failed!");
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Linktype List failed!");
|
||||||
if (err_str) {
|
if (err_str) {
|
||||||
*err_str = msg;
|
*err_str = msg;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2665,7 +2665,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* Warn the user if npf.sys isn't loaded. */
|
/* Warn the user if npf.sys isn't loaded. */
|
||||||
if (!npf_sys_is_running() && recent.privs_warn_if_no_npf && get_os_major_version() >= 6) {
|
if (!stdin_capture && !cf_name && !npf_sys_is_running() && recent.privs_warn_if_no_npf && get_os_major_version() >= 6) {
|
||||||
priv_warning_dialog = simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
|
priv_warning_dialog = simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
|
||||||
"The NPF driver isn't running. You may have trouble\n"
|
"The NPF driver isn't running. You may have trouble\n"
|
||||||
"capturing or listing interfaces.");
|
"capturing or listing interfaces.");
|
||||||
|
|
Loading…
Reference in New Issue