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

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