[olsr-dev] Fetch the routing table from a plugin

Andreas T√łnnesen (spam-protected)
Tue Feb 22 07:52:04 CET 2005


Hi,

Just to make sure, you know how this table is structured?
Every element in the statically allocated array "table" is just a root
element and contains no routing info. So to traverse all routes you
must do:

for(i=0;i<hashsize;i++)
    for(tmp_rt=routes[i].next;tmp_rt!=&routes[i];tmp_rt=tmp_rt->next)

But you probably know this already :)

The error in your code is that you do not pass a pointer to table[]
as parameter to olsr_plugin_io. You should do:
olsr_plugin_io(GETD__ROUTINGTABLE, &table, sizeof(table));

Off topic: From 0.4.9 plugins will include headers directly from
olsrd source. No more data structre duplication and trouble when
olsrd datatstructures change :)

- Andreas

Andrea Sini wrote:
> Hello,
> 
> I'm trying to fetch the routing table from a plugin, using Unik OLSR 0.4.8.
> 
> I've in olsrd_plugin.h the routing table data structure (
> 
> /**
>  * A struct describing an entry in the OLSRD internal routing table
>  */
> struct rt_entry
> {
>    union olsr_ip_addr rt_dst;
>    union olsr_ip_addr rt_router;
>    union hna_netmask rt_mask;
>    olsr_u8_t rt_flags;
>    olsr_u16_t rt_metric;
>    struct interface* rt_if;
>    struct rt_entry* prev;
>    struct rt_entry* next;
> };
> 
> struct rt_entry table[HASHSIZE];
> 
> I try to fetch the routing table with:
> 
>                olsr_plugin_io(GETD__ROUTINGTABLE, table,sizeof(table))
> 
> but it always seems that there are no elements (while route -n gives the 
> right routing table on the node).
> 
> I mean, I can't use table as if it was the internal routing table.
> 
> What could I do ?
> 
> Thanks in advance for the answer
> 
> Andrea Sini
> 
> 
> _______________________________________________
> olsr-dev mailing list
> (spam-protected)
> https://www.olsr.org/mailman/listinfo/olsr-dev

-- 
Andreas T√łnnesen
http://www.olsr.org



More information about the Olsr-dev mailing list