Subject: | Net::Pcap::loop() conflict with alarm() on linux 2.4 kernel |
[Module] Net::Pcap-0.05
[Perl] v5.8.1 built for i386-linux-thread-multi
[OS] Linux <cutted>.net 2.4.22-1.2174.nptl.asp #1 Fri Feb 20 06:26:58 EET 2004 i686 i686 i386 GNU/Linux (this is ASPLinux 9.2)
I am use libpcap-0.8.3 for build this module on some linux and solaris servers. On solaris and linux 2.2 my program work fine, but on linux 2.4 boxes not!
---[part of program]---
$SIG{ALRM} = \&alarm_handler;
#
# Start main loop
#
alarm(5);
Net::Pcap::loop($pcd, -1, \&process_packet, 0) || die;
#
# Handlers
#
sub alarm_handler
{
alarm(5);
<do some work>
}
sub process_packet
{
my($user_data, $hdr, $pkt) = @_;
<do some work>
}
---[part of program]---
sub process_packet() must be executed on every packet passed throutput filter, sub alarm_handler() must be executed every 5 seconds.
But on linux 2.4 boxes sub alarm_handler() executed every 5 seconds ONLY IF Net::Pcap::loop() hook packets, and if no packets acceptable by pcap filter - alarm_handler() NOT executed any time.