Thanks a lot !
I had tried the sending RTM_GETROUTE message using a NETLINK_ROUTE socket in a User Space program and it went OK. It gaves correct routing struct which I could parse. In fact it gave the rotuing table. But in sending that message I did not specify a certain dest IP. Consider the follwing simple scenario: I have 2 gateways (one on eth0,one on eth1), and I am sending a packet to some dest IP ; I want to know according to that ip on which interface (or gw) it will be out But where do I specify that certain dest IP ? Regards, John On 4/25/06, Andi Kleen <[EMAIL PROTECTED]> wrote: > On Tuesday 25 April 2006 09:31, John Que wrote: > > Hello, > > What is the right way to determine on which interface card > > (eth0 or eth1) will a packet be sent (according to the dest IP)? > > You can send a rtnetlink RTM_GETROUTE message to ask the kernel. > Result is the interface index in RTA_OIF, which can be converted > into a name. > > -Andi > > - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html