Christoph Biedl
2011-Feb-06 23:25 UTC
[netflow-tools] [PATCH] Support softflowd listening on "any" interface
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>
Hitoshi Irino
2011-Oct-10 08:45 UTC
[netflow-tools] [PATCH] Support softflowd listening on "any" interface
Hello Christoph, I committed (hg commit & push) this patch to google code on September 21th. thanks, Hitoshi Irino (2011?02?07? 08:25), Christoph Biedl wrote:> 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; > > > > > _______________________________________________ > netflow-tools mailing list > netflow-tools at mindrot.org > https://lists.mindrot.org/mailman/listinfo/netflow-tools