Hi, Since no one replied to my post on the various groups like linux-net , netdev etc . I ultimately found out a solution to it myself. And I would like to share it with you. According to the ip_route_output_slow code, if the fib_lookup fails to find a route and the oif is specified, a route with gateway = destination is created. However in the case that fib_lookup succeeds (the question I asked), even if you had specified a valid oif, the dev_out suggested by the fib is used instead. What I had asked for was a way to by pass this. I discovered this trick , but I am not clear on how it works. set the oif to the device you want it to be routed to and the tos = tos|RTO_ONLINK, the skb is routed to the device that you specified again with the next hop (gateway) being equal to the destination. I would be grateful if someone could look at the ip_route_output_slow code and explain me how this actually works. Sincerely, On Sun, 27 Mar 2005 22:17:26 +0530, Devesh Agrawal <devesh.agrawal@xxxxxxxxx> wrote: > Hi, > I am trying to develop a source routed mobile IP solution, and I am > encountering the following problem: > I have to route a packet (skb) thru a particular output interface > (=wlan0), which I know will take me to destination, However my routing > table suggests a route through another interface (=eth0). I am using > ip_route_output_key, with fl->oif = index of device I want this > packet to go to(=wlan0). > However, in the ip_route_output_slow I found that even when oif is not > 0, you get a valid dev_out, however when the fib_lookup succeeds, you > merely free this old dev_out, and assign dev_out to the res.dev (ie > the one found out by the fib_lookup == eth0), > So this means that even if I specify the oif of wlan0, the packet will > still still > get routed thru eth0. Correct ? > Am I missing something?. I am also setting > tos bit RTO_ONLINK , as is done when MSG_DONTROUTE is given for udp > and raw sockets, hoping that it would make a difference, by having the > scope set to the RT_SCOPE_LINK. > Please help me. I am quite hung up on this one. > Sincerely, > -- > Devesh Agrawal > -- Devesh Agrawal ============== The program is absolutely right; therefore the computer must be wrong. ----------------- How an engineer writes a program: Start by debugging an empty file... ---------------------- Systems programmers are the high priests of a low cult. - R. S. Barton -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/