netfilter hook forward packets
I'm writing a simple netfilter hook module to redirect the traffic thru a tunnel between 2 machines (B and C)
Assume that i dont want to config netfilter/iptable to do anything.
The path looks like:
Assume on A, i add a route to forward packet (from A<->D) to B
and on D, i add a route to forward packet (from A<->D) to C
My module will be running on machines B and C.
Here are the steps what i do in my module (running on B and C)
On machine B:
1. capture packet at NF_IP_PRE_ROUTING
2. receive packet from A->D
3. append one more ip/tcp headers from B->C to the packet
4. send it out
On machine C:
after i receive the packet, i will
5. remove the external ip/tcp headers
6. send it out to D
My question is at steps 3 and 5, after append/remove the packet and recalc the checksum, do i have to do something else relate to the socket/sock owner?
How to do steps 4 and 6 to send packet out?
Thank you very much for any help