From 7e95c05d889f22be44aef5051eb07d35a4a8f579 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 7 Dec 2010 23:33:55 +0100 Subject: Core multipath support. --- proto/bgp/attrs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'proto') diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index ef5d024..ff231b1 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1015,6 +1015,13 @@ bgp_get_neighbor(rte *r) return ((struct bgp_proto *) r->attrs->proto)->remote_as; } +static inline int +rte_resolvable(rte *rt) +{ + int rd = rt->attrs->dest; + return (rd == RTD_ROUTER) || (rd == RTD_DEVICE) || (rd == RTD_MULTIPATH); +} + int bgp_rte_better(rte *new, rte *old) { @@ -1024,9 +1031,8 @@ bgp_rte_better(rte *new, rte *old) u32 n, o; /* RFC 4271 9.1.2.1. Route resolvability test */ - /* non-NULL iface means it is either RTD_ROUTER or RTD_DEVICE route */ - n = new->attrs->iface != NULL; - o = old->attrs->iface != NULL; + n = rte_resolvable(new); + o = rte_resolvable(old); if (n > o) return 1; if (n < o) @@ -1502,7 +1508,7 @@ bgp_get_route_info(rte *e, byte *buf, ea_list *attrs) buf += bsprintf(buf, " (%d", e->pref); if (e->attrs->hostentry) { - if (!e->attrs->iface) + if (!rte_resolvable(e)) buf += bsprintf(buf, "/-"); else if (e->attrs->igp_metric >= IGP_METRIC_UNKNOWN) buf += bsprintf(buf, "/?"); -- cgit v1.2.3