|
I must say that lua has certainly saved me development time on my project, which is to, in realtime, process enterprise netflow records from internal routers and create input records for our IDS, thus giving us an internal scanner detection mechanism, as well as a record of internal traffic. The alternative is to do it in C, which would have made the development take quite a bit longer. We seem to average ~20 netflow packets/sec. aggregate from the 5 sources, with an average of ~20 flows/packet, with the attendant slicing/dicing of records. Fixing the code as suggested by Diego causes CPU to run about 20%, which is in the acceptable range.
Thanks again for the assistance. Diego Nehab wrote:
Hi, There was a bug in the test submitted by the user: ... local readable,writable,e=socket.select(receive_sockets) for src, _ in ipairs(readable) do local udp=receive_sockets[src] ... The index 'src' is valid only for table 'readable'. Not for table 'receive_sockets'. In fact, there is no need to use the index. ... local readable,writable,e=socket.select(receive_sockets) for _, udp in ipairs(readable) do ... This is a simpler alternative. The reason the code worked in some systems is that when all sockets are readable simultaneously, the indices on both tables end up matching so the bug goes unnoticed. Regards, Diego.
-- Jim Mellander Incident Response Manager Computer Protection Program Lawrence Berkeley National Laboratory (510) 486-7204 Your fortune for today is: May the bluebird of happiness twiddle your bits.