tarball has asked for the wisdom of the Perl Monks concerning the following question:

I have successfully used Net::Pcap to dynamically filter and capture packets of interest.

I would like to try directly messing with the bpf virtual machine language program.

When I do

DB<67> Net::Pcap::compile($bpf,\$filter,"tcp",0,4294967040) || print "hi"

hi

DB<68> p $filter

pcap_bpf_program_tPtr=SCALAR(0xa4d748)

DB<69> p $$filter

12644816

How I do get to the bpf_program itself (per /usr/include/pcap-bpf.h)?

Many thanks

  • Comment on Get bpf program from Net::Pcap::compile