raj
05-02-2003, 08:42 PM
Hi,
I would really appreciate if any one could help me sort this out.
I am trying to work with raw sockets as following:
I have three machines... machine(1) acting as a source, machine(3) acting as a destination, machine(2) acting as an intermediate default router so that all packets leaving machine(1) goes through machine(2).
I am sending UDP packets from machine(1) to machine(3) using raw sockets(I included UDP header and IP header in the packet using IPHDRINCL option). I also have some IP options set in the IP header. Now what I have to do is, I have to intercept that packet on machine(2), decrement its TTL value and re-send it to machine(3) after examining the IP header options.
what I am not able to achieve is that when I send the packet from machine(1) to machine(3) , I am not able to catch the packet on machine(2). I am able to copy the packet using sock(AF_INET,SOCK_PACKET) but that is what I need. I need to have the kernel give me the entire packet(and not just a copy) so that I can resend it myself to machine(3) without changing the source IP in the header fields.
I would greatly appreciate if any one could help on this.
Any sample code would be much better.
Thanks in advance,
-raj
I would really appreciate if any one could help me sort this out.
I am trying to work with raw sockets as following:
I have three machines... machine(1) acting as a source, machine(3) acting as a destination, machine(2) acting as an intermediate default router so that all packets leaving machine(1) goes through machine(2).
I am sending UDP packets from machine(1) to machine(3) using raw sockets(I included UDP header and IP header in the packet using IPHDRINCL option). I also have some IP options set in the IP header. Now what I have to do is, I have to intercept that packet on machine(2), decrement its TTL value and re-send it to machine(3) after examining the IP header options.
what I am not able to achieve is that when I send the packet from machine(1) to machine(3) , I am not able to catch the packet on machine(2). I am able to copy the packet using sock(AF_INET,SOCK_PACKET) but that is what I need. I need to have the kernel give me the entire packet(and not just a copy) so that I can resend it myself to machine(3) without changing the source IP in the header fields.
I would greatly appreciate if any one could help on this.
Any sample code would be much better.
Thanks in advance,
-raj