iptables redirecting to different port
I am trying to figure out a method to redirect UDP traffic to a single socket to userspace app using iptables. My system runs on 2.4 kernel and currently NAT is not used.
After some analysis i figured out iptables can be used to redirect traffic based on matching rules to a different port. my assumption is that i can add a rule in input chain of filter table to divert udp traffic within source port ranges to a new port.
when i tried to use the follwing command
iptables -t filter -A INPUT -i eth0 -p udp --sport 9000:9010 -j REDIRECT --to-ports 9050
it returns as Invalid argument
Please help me with the above rule - is my assumption correct?
will any other method or rule will be required?