]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Add I/C/E flag for BGP routes to show route output
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Sat, 1 Dec 2018 17:04:11 +0000 (18:04 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Sat, 1 Dec 2018 17:04:11 +0000 (18:04 +0100)
The flag indicates whether the route is internal (IBGP),
intra-confederation, or external (EBGP).

proto/bgp/attrs.c

index e53b09d81b780d034a54f52f170490d32f3cf07e..fc2f862ef658f5077a6cb0bd83be7ce32c2b2420 100644 (file)
@@ -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, "-");