|Don't ask to ask, just ask|
Hello again Monks! :) I have a dilemma with Net::Pcap filters. I need to listen on a *very* busy device for specific packets using Net::Pcap::setfilter/compile. (I loop over a few IP addresses and listen for about 5 seconds for each one)
If I do so, the packet handler in Net::Pcap::loop($pcap, -1, \&pcap_handler, ''); never runs (until it sees the specific packet (e.g. I induce one with ping in another terminal and it works)), so I cannot seem to use alarm()! I also cannot use the Net::Pcap TimeoutOnNext, because, the network device is so incredibly busy, that it would constantly be resetting the timer, or never reset from my filters.
Have any of you Monks ever done this? I have spent about 3 days testing in Perl, searching Google and this site and found lots of resources, but none that work for my strange situation.
Here is some code that works until a filter is placed onto $pcap, I just tried it:
Say I set the filter "src net 10.0.0.1" the alarm times out, but Net::Pcap::breakloop can't be called because Net::Pcap::loop never returns making the program hang. (until in another terminal I ping 10.0.0.1!)
Thanks in advance, you guys are awesome! :D
Edit-Edit: I just found out this is a BUG: https://rt.cpan.org/Public/Bug/Display.html?id=6320 Supposedly fixed too..(in 2005) I am still testing stuff and update frequently :(