From: Ondrej Zajicek (work) Date: Sat, 1 Dec 2018 17:04:11 +0000 (+0100) Subject: BGP: Add I/C/E flag for BGP routes to show route output X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a3aba56779df88b8dcf7b564a4008c5296a74b2;p=thirdparty%2Fbird.git BGP: Add I/C/E flag for BGP routes to show route output The flag indicates whether the route is internal (IBGP), intra-confederation, or external (EBGP). --- diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index e53b09d81..fc2f862ef 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -2014,11 +2014,13 @@ bgp_get_attr(eattr *a, byte *buf, int buflen) void bgp_get_route_info(rte *e, byte *buf, ea_list *attrs) { + struct bgp_proto *bgp = (void *) e->attrs->src->proto; eattr *p = ea_find(attrs, EA_CODE(EAP_BGP, BA_AS_PATH)); eattr *o = ea_find(attrs, EA_CODE(EAP_BGP, BA_ORIGIN)); u32 origas; - buf += bsprintf(buf, " (%d", e->pref); + char c = bgp->is_internal ? 'I' : (bgp->is_interior ? 'C' : 'E'); + buf += bsprintf(buf, " %c (%d", c, e->pref); if (e->u.bgp.suppressed) buf += bsprintf(buf, "-");