c - How to drop packet before full download -


I am creating a personal app for network filtering using C. I already know that the information you downloaded is using this code:

  tcpPacket = recvfrom (raw_socket, buffer, 65536, 0, and server address, and server address size );  

But it requires that the TCP packet be downloaded for the first time What do I need to do that filter will be done before it is downloaded, suppose that it checks the source IP And on the basis of that, it either accepts it or rejects it.

Note: Yes, I know Iptables, but I do not want to use it because I want to learn how to use raw sockets.

"post-text" itemprop = "text">

In a packet oriented network (such as TCP / IP), both address information and actual Payload happens.

So it is not right to say that you want to drop the packet before downloading, in packet depending on the data.

This would probably be imaginable if you have a real (hardware) receiver mid-pocket, but I do not think any "normal" networking hardware or API exposes such functionality.


Comments