Thank you Matthieu! Precise and super fast answer :)

2016-11-21 18:07 GMT+01:00 Matthieu Boutier <
bout...@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
>
>
_______________________________________________
Babel-users mailing list
Babel-users@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/babel-users

Reply via email to