A couple of questions about flnl_lookup() function.

Someone Strange zhenya48.80 at mail.ru
Wed Mar 21 03:14:09 EDT 2012


 
A couple of questions about flnl_lookup() function.

Hi, all! 

My task is to get next-hop interface index(name) for arbitrary IP addresses programmatically.
I`m trying to use 'libnl' library to perform FIB lookup with flnl_lookup() function.

I have 2 physical network cards: eth0 192.168.1.1/24, eth1 10.10.5.53/8.
ip_forwarding for each interfaces is 1.
There is my 'main' routing table:
>ip route list table main
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 
169.254.0.0/16 dev eth0 scope link metric 1000 
10.0.0.0/8 dev eth0 proto kernel scope link src 10.10.5.53 metric 1 
default via 10.100.1.3 dev eth0 proto static

I'm using 'nl-fib-lookup.c' example from libnl sources.
But function flnl_lookup() always returns zero next-hop selector!

>./nl-fib-lookup 192.168.1.3
table main prefixlen 24 next-hop-selector 0
type unicast scope link error Success (0)

>./nl-fib-lookup 10.10.5.54
table main prefixlen 8 next-hop-selector 0
type unicast scope link error Success (0)

I also passed 192.168.1.0 and 10.0.0.0 as program argument, but the result is the same: 'next-hop-selector 0'.

My questions.
1. What is the meaning of 'next-hop-selector'? 
I can't find any descriptions or references to it in libnl documentation. I think it is a interface index for the next-hop interface. Is it right?

2. Which function(s) I need to use for translating 'next-hop-selector' in next-hop interface index (name)? 

3. And main question. Why 'next-hop-selector' is always zero in my system?!

Thanks!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20120321/f49fa1a7/attachment.html>


More information about the libnl mailing list