[lkml]   [2001]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectChange in source IP to local machines
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.

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,
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:12    [W:0.144 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site