[dsc] dsc-201203250530 crash reading savefiles
John Dickinson
jad at sinodun.com
Fri Aug 23 13:44:13 UTC 2013
Hi,
The following patch fixes a problem with pcap_setnonblock giving an error if dsc-201203250530 is set to read a previously saved pcap file instead of a real interface. Tested on Ubuntu 13.04.
--- pcap.c~orig 2013-08-23 13:27:45.268811000 +0000
+++ pcap.c 2013-08-23 13:31:01.480811000 +0000
@@ -952,6 +952,7 @@
struct bpf_program fp;
char errbuf[PCAP_ERRBUF_SIZE];
int x;
+ int savefile=0;
struct _interface *i;
if (interfaces == NULL) {
@@ -969,6 +970,7 @@
if (0 == stat(device, &sb)) {
i->pcap = pcap_open_offline(device, errbuf);
+ savefile=1;
} else {
/*
* NOTE: the to_ms argument here used to be 50, which seems to make
@@ -984,9 +986,11 @@
syslog(LOG_ERR, "pcap_open_*: %s", errbuf);
exit(1);
}
- if (pcap_setnonblock(i->pcap, 1, errbuf) < 0) {
- syslog(LOG_ERR, "pcap_setnonblock(%s): %s", device, errbuf);
- exit(1);
+ if (0 == savefile) {
+ if (pcap_setnonblock(i->pcap, 1, errbuf) < 0) {
+ syslog(LOG_ERR, "pcap_setnonblock(%s): %s", device, errbuf);
+ exit(1);
+ }
}
memset(&fp, '\0', sizeof(fp));
x = pcap_compile(i->pcap, &fp, bpf_program_str, 1, 0);
---
jad at sinodun.com
http://sinodun.com
Sinodun Internet Technologies Ltd.
Stables 4, Suite 11,
Howbery Park,
Wallingford,
Oxfordshire,
OX10 8BA,
U.K.
+44 (0)1491 834957
More information about the dsc
mailing list