Hi Bryan please try zero’ing hdr in order to make sure pfring_parse_pkt() does not skip packet headers as optimisation (it avoids parsing the packet twice in case hdr already contains valid parsing info)
Alfredo > On 14 Oct 2015, at 05:10, Bryan Fok <[email protected]> wrote: > > I am testing the ZC (without license, it print on screen) , it is receiving > the packets that I sent from the other host, but it always return 0 content > from the pfring_parse_pkt() . > > 1) This is how I capture the packet, and extract the ip in ZC: > > if (pfring_zc_recv_pkt(zq_, &buffers_array_[0], 0) > 0) > { > pfring_parse_pkt(pfring_zc_pkt_buff_data(buffers_array_[0], > zq_), &hdr, 5, 0, 1); > > std::cout << "ip_src:" << > print_ip(byte_swap(hdr.extended_hdr.parsed_pkt.ip_src.v4)) << " l4_src_port: " > << hdr.extended_hdr.parsed_pkt.l4_src_port << " > ip_dst:" << print_ip(byte_swap(hdr.extended_hdr.parsed_pkt.ip_dst.v4)) > << " l4_dst_port: " << > hdr.extended_hdr.parsed_pkt.l4_dst_port << std::endl; > } > > The output is always no matter where the message came from: > ip_src:0.0.0.0 l4_src_port: 0 ip_dst:0.0.0.0 l4_dst_port: 0 > > > 2) In Venilia PF_RING, it work very well which mean it actually print out the > src and dst IPs properly: > > if (pfring_recv(pd_, &buf, 0, &hdr, wait_for_packet_)) > { > pfring_parse_pkt(buf, &hdr, 5, 0, 1); > > std::cout << "ip_src:" << > print_ip(byte_swap(hdr.extended_hdr.parsed_pkt.ip_src.v4)) << > " l4_src_port: " << > hdr.extended_hdr.parsed_pkt.l4_src_port << > " ip_dst:" << > print_ip(byte_swap(hdr.extended_hdr.parsed_pkt.ip_dst.v4)) << > " l4_dst_port: " << > hdr.extended_hdr.parsed_pkt.l4_dst_port <<std::endl; > } > > > B.R > Bryan > _______________________________________________ > Ntop-misc mailing list > [email protected] <mailto:[email protected]> > http://listgateway.unipi.it/mailman/listinfo/ntop-misc > <http://listgateway.unipi.it/mailman/listinfo/ntop-misc>
_______________________________________________ Ntop-misc mailing list [email protected] http://listgateway.unipi.it/mailman/listinfo/ntop-misc
