C: How to drop packet before full download
Hi,
I'm creating a personal app for network filtering using C. I already know that you can log and analyze a downloaded packet's info using this code: Code:
tcpPacket = recvfrom(raw_socket , buffer , 65536 , 0 , &serverAddress , &serverAddressSize); Note: Yes I am aware of iptables, but I do not want to use it because I want to learn how to do it using raw sockets. Thanks |
getpeername() http://man7.org/linux/man-pages/man2/getpeername.2.html will tell you the source IP and can be called on the socket after you've accepted a connection before looking at application data.
|
Thanks, that helped
|
All times are GMT -5. The time now is 12:47 AM. |