[netflow-tools] [PATCH] Support softflowd listening on "any" interface

Christoph Biedl
Sun, 06 Feb 2011 23:25:04 -0000

Hello,

I tried to make softflowd listen on all interfaces, which is at least
possible on Linux kernels using "any" as the interface name. This,
however, caused softflowd to exit after a few seconds with a "Shutting
down after pcap EOF" message.

It seems poll (softflowd.c:1902) sometimes sets pl[0].revents without
actually packets available, thus causing pcap_dispatch to return zero.

That patch below tries to deal with this by not leaving the main loop
in that situation while reading from a live capture. Works for me, but
please review.

Regards,

    Christoph

--- a/softflowd.c
+++ b/softflowd.c
@@ -1924,7 +1924,7 @@ main(int argc, char **argv)
                                logit(LOG_ERR, "Exiting on pcap_dispatch:
%s",
                                    pcap_geterr(pcap));
                                break;
-                       } else if (r == 0) {
+                       } else if (r == 0 && capfile != NULL) {
                                logit(LOG_NOTICE, "Shutting down after
"
                                    "pcap EOF");
                                graceful_shutdown_request = 1;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL:
<http://lists.mindrot.org/pipermail/netflow-tools/attachments/20110207/e82553af/attachment-0001.bin>