[dsc] dsc listening on multiple interfaces

Duane Wessels wessels at measurement-factory.com
Tue Sep 14 15:44:42 UTC 2010




On Tue, 14 Sep 2010, Marc Haber wrote:

> I am by no means a programmer, but shouldn't dsc use a non-blocking
> syscall to read from the interface if it is listening on more than one
> interface? Am I doing something wrong?

Hi Marc,

I don't think you're doing anything wrong.  Probably nobody noticed
this bug before because anyone that used muiltiple interfaces probably
had "busy" interfaces.

Please try the attached patch.

DW
-------------- next part --------------
Index: collector/dsc/pcap.c
===================================================================
--- collector/dsc/pcap.c	(revision 12435)
+++ collector/dsc/pcap.c	(working copy)
@@ -997,6 +997,10 @@
 	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);
+    }
     memset(&fp, '\0', sizeof(fp));
     x = pcap_compile(i->pcap, &fp, bpf_program_str, 1, 0);
     if (x < 0) {


More information about the dsc mailing list