Does libpcap get a copy of the package?
2 answers
The kernel will receive the packet, then pass it through a list of filters (for example, usually a filter for IPsec, firewall, etc.), and once it passes through all those filters, it passes the packet to the application. libpcap is another filter, but it just adds the package to the internal database for processing, instead of checking the package, modifying, or whatever other filters will do.
For what you want to do, the simplest solution would be to use a firewall.
+3
a source to share