Capturing, modifying and injecting packets
I want to capture packets which are being sent by an application from my own machine and i want to capture them before they actually go to wire. What i want to do like ...i want to capture the Ipv4 packet sent by my applications to some special address ( like some subnet 10.0.0.1/24 ) and drop the packet from being sent on wire. Then modify that to Ipv6 packet ( by doing some map Ipv4 -> Ipv6) and Then put the modified Ipv6 packet into the kernel queue ...for routing stuff.
Currently, I tried with Raw-sockets with 'PF_PACKET' flag but that doesn't work out. By Raw-sockets, I am actually able to capture packets which are on the wire but not which i was intend to capture ?
Any help would be appreciated !
thanks in advance,