Libipq performance issues

I am making a package filtering program running on Ubuntu 12.04 that uses libipq as a library to copy packages to user space. The libipq logic works fine for me, my problem is that I noticed significant success with using libipq to not use libipq. If I remove my iptable rules that I added for my program and let the kernel handle packets, the speed is 50MB / s. However, when using libipq and restoring the iptables rule, the speed drops to 1MB / s (if I'm lucky), that's usually half that.

I wonder if there is something wrong with my iptable rules? Could there be a more efficient use of the rules, or is libipq just inefficient (or my code, although I don't)? Here is the script I am using to set up my iptable rules:

#!/bin/sh
modprobe iptable_filter
modprobe ip_queue
iptables -A FORWARD -p icmp -j QUEUE
iptables -A FORWARD -p tcp -j QUEUE
iptables -A FORWARD -p udp-j QUEUE
iptables -A INPUT -p icmp -j QUEUE
iptables -A INPUT -p tcp -j QUEUE
iptables -A INPUT -p udp -j QUEUE

      

Other than that, my iptable rules are the default set that ships with Ubuntu.

NOTE. My setup is for a client and server VM on two different subnets, and using my Ubuntu VM to connect both using NAT and masking masquerading.

+3


source to share


1 answer


Libipq is deprecated in favor of the newer version libnetfilter_queue



+3


source







All Articles