in reply to Re^6: Sniffer::HTTP problem with timeout
in thread Sniffer::HTTP problem with timeout
to feeding Sniffer from my own extremely simple Net::Pcap loop.$sniffer->run(); # uses the "best" default device
to try bypassing the grabber in Sniffer::HTTP. I found that I could go for hours without dropping a single packet. I then started looking at the code in sub run in Sniffer/HTTP.pm and the only difference I could see (read understand) was that I had set snaplen to 4096 in the creation of my capture device. I happen to know that what I am looking at is going to be smaller than that. I then changed only that in the Sniffer/HTTP.pm code and now I can use the use the run method and not get dropped packets.my $err = ''; my $dev = Net::Pcap::pcap_lookupdev(\$err); # find a device # open the device for live listening my $pcap = Net::Pcap::pcap_open_live( $dev, 4096, 0, 0, \$err); Net::Pcap::pcap_loop( $pcap, -1, \&process_pkt, "user data"); my %stats; $stats{ps_drop}=0; sub process_pkt { my ($user_data,$hdr,$pkt)=@_; Net::Pcap::stats( $pcap,\%stats ) ; print "$stats{ps_drop} pkts drpd, $stats{ps_recv} pkts rcvd.\n"; $sniffer->handle_eth_packet($pkt); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Sniffer::HTTP problem with timeout
by Corion (Patriarch) on Mar 22, 2011 at 08:05 UTC | |
by ponley (Novice) on Mar 22, 2011 at 23:27 UTC | |
by Corion (Patriarch) on Mar 23, 2011 at 07:47 UTC | |
by ponley (Novice) on Mar 23, 2011 at 20:19 UTC | |
by Corion (Patriarch) on Mar 23, 2011 at 20:57 UTC | |
|