If we have pcap_open, call it instead of pcap_open_live, otherwise we might

crash. The changes to trigcap.c haven't been tested, but _should_ work.

svn path=/trunk/; revision=25279
This commit is contained in:
Gerald Combs 2008-05-12 19:41:32 +00:00
parent 27ccd63ce7
commit 20186d4947
2 changed files with 38 additions and 26 deletions

View File

@ -735,7 +735,11 @@ capture_opts_print_statistics(gboolean machine_readable)
for (if_entry = g_list_first(if_list); if_entry != NULL; if_entry = g_list_next(if_entry)) {
if_info = if_entry->data;
#ifdef HAVE_PCAP_OPEN
pch = pcap_open(if_info->name, MIN_PACKET_SIZE, 0, 0, NULL, errbuf);
#else
pch = pcap_open_live(if_info->name, MIN_PACKET_SIZE, 0, 0, errbuf);
#endif
if (pch) {
if_stat = g_malloc(sizeof(if_stat_t));

View File

@ -192,7 +192,11 @@ int main(int argc, char** argv) {
}
}
if ( ! ( listener = pcap_open_live(interface, snaplen, promisc, 1, errbuf) )) {
#ifdef HAVE_PCAP_OPEN
if ( ! ( capturer = pcap_open(interface, snaplen, promisc, 1, NULL, errbuf) )) {
#else
if ( ! ( capturer = pcap_open_live(interface, snaplen, promisc, 1, errbuf) )) {
#endif
panic(12,"could not open interface '%s' for listener: %s\n",interface,errbuf);
}
@ -210,7 +214,11 @@ int main(int argc, char** argv) {
dprintf(2,"compiled stop filter %s\n",stop_filter_str);
#ifdef HAVE_PCAP_OPEN
if ( ! ( capturer = pcap_open(interface, snaplen, promisc, 1, NULL, errbuf) )) {
#else
if ( ! ( capturer = pcap_open_live(interface, snaplen, promisc, 1, errbuf) )) {
#endif
panic(15,"could not open interface '%s' for capturer: %s\n",interface, errbuf);
}