LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Packet Capture Library (https://www.linuxquestions.org/questions/programming-9/packet-capture-library-790559/)

wxShayan 02-21-2010 10:12 AM

Packet Capture Library
 
Hi,
I want to port a VPN client from Windows to Linux. It consists of an arbitrary VPN protocol and a firewall. The VPN client uses a library named "WinpkFilter" from "ntkernels.com" which is not available in Linux. All that I need now is a neat library which can be replaced with "WinpkFilter". I found libpcab but it is just a packet sniffer. I worked with iptables and netfilter but it is unable to inject arbitrary packets (also i don't want to bind to an external application). I tried ndiswrapper but it is unable to load my driver in Linux. I reviewed the openvpn model (tap & tun) but it is not suitable for me. I tried raw sockets at the device driver, they are wonderful but I didn't find a way to drop unwanted packets! Please HHHEEELLLPPP me! Is there any packet sniffer and injector library with the ability of dropping unwanted packets in Linux (something like libnet, a kernel module, ...)?

Mara 02-21-2010 01:55 PM

Why don't you combine two methods: raw sockets for generating packets and netfilter hooks for filtering?

wxShayan 02-22-2010 12:46 AM

Hi Mara and thanks for your reply,
NetFilter hook? What do you mean? Do you mean NetFilter library which I mentioned above? According to my knowledge, NetFilter works above iptables and it has two weaknesses:
1. It is working in IP layer and I need DataLink header information.
2. If someone or some application change iptables rules, it affects my VPN behavior!


All times are GMT -5. The time now is 04:32 AM.