LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Capturing, modifying and injecting packets (https://www.linuxquestions.org/questions/linux-networking-3/capturing-modifying-and-injecting-packets-564522/)

flukebox 06-26-2007 02:21 AM

Capturing, modifying and injecting packets
 
Hi all,
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,
flukebox

flukebox 07-03-2007 07:27 AM

okk, i am able to capture packet by libpcap interface. but the problem i am facing now is that i am only able to send packet directly on the wire. but i want the packet to be send such that it goes through kernel. any idea, how can put modified packet to kernel networking stack queue ???
-- flukebox

jopu 07-03-2007 08:07 AM

hmm... I think iptables can come in handy for your problem, though I don't know the exact filters/mangle you may need to write.

ip6tables will capture packets and modify them and put them back to the kernel Q.


All times are GMT -5. The time now is 06:24 AM.