[Babel-users] Betweenness centrality: extend ROUTE UPDATE

Lorenzo Ghiro lorenzo.ghiro at studenti.unitn.it
Mon Nov 21 19:24:21 UTC 2016


Thank you Matthieu! Precise and super fast answer :)

2016-11-21 18:07 GMT+01:00 Matthieu Boutier <
boutier at pps.univ-paris-diderot.fr>:

> Hi Lorenzo,
>
> > Is this the right place where to ask?
>
> Yes.
>
> > how to get the routing table entry matching a given prefix...
>
> You must iterate over all the routing entries with "route streams" and
> search the one you want (or write your own function).  For example:
>
>     struct babel_route *rt = NULL;
>     struct route_stream *stream = NULL;
>     stream = route_stream(ROUTE_INSTALLED); /* or _ALL, or _SS_INSTALLED */
>     while(1) {
>         rt = route_stream_next(stream);
>         if(rt == NULL) break;
>         /* your code */
>         min = min_route(rt, min);
>     }
>     route_stream_done(stream);
>
> To compare prefixes, you can use prefix_cmp from util.h.  For your use
> case, it should be:
>
> if(prefix_cmp(rt->src->prefix, rt->src->plen, prefix, plen) ==
> PST_MORE_SPECIFIC)) {
>     /* the RIB entry is more specific than my <prefix,plen> prefix*/
> }
>
> Best regards,
> Matthieu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/babel-users/attachments/20161121/adfda830/attachment.html>


More information about the Babel-users mailing list