Hi Thomas, Thanks for your response. I am trying out this method. Just curious if there is an API where I dont need the dev and skb parameters for ip_route_input(skb, daddr, saddr, tos, dev) For ip_route_output(&rt, dst, src, tos, oif), I dont need any of these parameters. Thanks, Santosh -----Original Message----- From: Thomas Graf [mailto:tgraf@xxxxxxx] Sent: Thursday, November 03, 2005 12:39 AM To: Santosh Gupta Cc: linux-net@xxxxxxxxxxxxxxx Subject: Re: Advanced Source Routing using "ip rule add from <x.x.x.x> lookup <table>" returns error * Santosh Gupta <Santosh.Gupta@xxxxxxxxxxxxx> 2005-11-02 21:37 > I am trying to do advanced source routing. My setup is as follows > tunnel-client tunnel-server > ()==============================() > eth0 10.3.30.115/16 10.3.30.93 > eth1 192.168.0.10/24 > relay 221.221.1.1/32 > > "relay" is virtual ppp interface, which encapsulates packets into tunnel > connecting the tunnel-server at 10.3.30.93. Both boxes are on 10.3/16 LAN. > > I have a kernel module (code below) which does route lookup using > ip_route_output(dst, src, 0, 0). > I have an "ip rule" to send all packets with src ip address 10.81.15.108 to > lookup into table "rlm". Table "rlm" has only a default route towards "relay" > device. > When I do ip_route_output(dst, 0, 0, 0) it succeeds returning next hop as the > default gw. If I do the lookup specifying the src ip address, the route lookup > fails. 10.81.15.108 is not a local address so ip_route_output() will fail because it cannot find the interface the packet is supposed to origin from. See ip_route_output_slow() for more details. You have to use ip_route_input() for the above to work. - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html