[Babel-users] Betweenness centrality: extend ROUTE UPDATE
Matthieu Boutier
boutier at pps.univ-paris-diderot.fr
Mon Nov 21 17:07:48 UTC 2016
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
More information about the Babel-users
mailing list