previous hop's IP address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

Can anyone suggest me a method to find the previous
hop router's outgoing IP address?

that is, given a packet forwarded by R1 to R2, 

R1<------>R2<-----> R3

how might R2 find out the IP address of the outgoing
interface of R1?

I have access to skb->dev, which points to the
packet's incoming net_device on R2. 

Obviously, there should be a way to do it though the
routing protocol, since each router keeps info about
its neighbours. ButI dont know about the
implementation in kernel 2.4.

I thougth of two other ways which arent that
convincing: 
1) R2 can do a reverse lookup in its arp cache (but is
there a guarantee that there will always be an entry
for R1?)
2) Use ip_route_output_slow() to find the next hop for
the packet's original destination. (but then routes
may be asymmetric..)

Is there a simple way to do this?

TIA
Akshay
 

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux