The project I am working has the requirement of dropping captured packets. I am successfully captuing packets with the use of libpcap
like so,
pcap_loop(handle, num_packets, got_packet, NULL);
Where in the callback function I capture the given number of packets in the num_packets argument. My requirement is to drop the captured packets.
I tried checking for help and ended up empty handed. Any reference of code snippets to perform this requirement of dropping captured packets via libpcap
is much appreciated. :)
EDIT
Alternative suggestions are welcome if this is not possible via libpcap
.
NOTE that before dropping the packet I need to obtain the destination/ source ip address
and payload
of the packet to be dropped.