[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netflow-tools
Subject:    [netflow-tools] [PATCH] Support softflowd listening on "any" interface
From:       netflow-tools.aguu () manchmal ! in-ulm ! de (Christoph Biedl)
Date:       2011-02-06 23:25:04
Message-ID: 1297032320 () msgid ! manchmal ! in-ulm ! de
[Download RAW message or body]

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>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic