How to reinject the packet in the Iptables?
Pergunta
I have a packet inside a packet a.k.a tunneling. So it's of the form [IP HEADER 1][IP HEADER 2][PAYLOAD]. After reading the first header(done by a library) I will get the packet with [ IP HEADER 2] at the INPUT chain of the iptables. I want to re-inject the packet to the starting of the iptables i.e. in the PREROUTING chain. Ultimate aim is to forward the packet to a remote host (that's why I want the packet to be in the PREROUTING chain). I have read something about the libipq but I am not really sure that it is the best way to do it.
Solução
Although there may be some add-on target to do this. My gut feeling is that you would use the MARK
target to mark this packet then use iproute2
to set up the routing of where you want it to go.
Something like:
iptables -t mangle -A INPUT -s 192.168.1.2 -j MARK --set-mark 0xAA
ip rule add fwmark 0xAA table Reroute_Tunnel
Then it's up to you to add and decide what the Reroute_Tunnel
table does