Messages in this thread | | | Subject | Change in source IP to local machines | Date | Mon, 5 Nov 2001 18:00:25 +0530 | From | "Roma Bajpai" <> |
| |
Hi, I am working on a Network Address Translator and am trying out a few sample programs to change the source and destination IPs of packets, at kernel level. When I receive a packet I change the src IP to my machine's IP and destination IP to another machine's. The destination machine doesnt receive the packet. On the other hand when the src IP is changed to that of some other machine (besides mine) the code works fine and the destination machine receives the packets. Please not that ip_forward has been enabled.
CONTROL FLOW AT KERNEL LEVEL : Whenever a packet is received the function ip_rcv() gets called (present in file /net/ipv4/ip_input.c). At the end of this function I change the source and destination IPs. Next ip_route_input() is called. This function tires to route the the packet and in course calls a function fib_lookup() to see if the routing table has the entry. The fib_lookup returns a result, the type of which not being RTN_UNICAST. Since its not a unicast packet, control goes to a label martian_source and the destination machine does not receive the packet. I wanted to know if it is possible to forward a packet with the src IP changed to the local IP. Please do let me know if anyone can help me with this one.
Thanks & Regards, Roma - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |