]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP now reports originating AS and origin type in get_route_info().
authorMartin Mares <mj@ucw.cz>
Fri, 19 May 2000 11:01:41 +0000 (11:01 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 19 May 2000 11:01:41 +0000 (11:01 +0000)
TODO
proto/bgp/attrs.c
proto/bgp/bgp.c
proto/bgp/bgp.h

diff --git a/TODO b/TODO
index ed32e6b0e3be09f52598feaae8eefeeb71ac06e2..6950365d0371cccef92e8d1cde5c53cb9791a1f8 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,8 +6,6 @@ Core
 
 - table: ocassional core dumps in rt_prune()
 
-- bgp: get_route_info
-
 Documentation
 ~~~~~~~~~~~~~
 - write doctool
index 4dda0ac0e0fdcb36713c75655248973581a11c43..b074eb21262e9d7c9860293d1b038ecb3832292c 100644 (file)
@@ -911,3 +911,18 @@ bgp_attr_init(struct bgp_proto *p)
   p->withdraw_bucket = NULL;
   fib_init(&p->prefix_fib, p->p.pool, sizeof(struct bgp_prefix), 0, bgp_init_prefix);
 }
+
+void
+bgp_get_route_info(rte *e, byte *buf, ea_list *attrs)
+{
+  eattr *p = ea_find(attrs, EA_CODE(EAP_BGP, BA_AS_PATH));
+  eattr *o = ea_find(attrs, EA_CODE(EAP_BGP, BA_ORIGIN));
+  int origas;
+
+  buf += bsprintf(buf, " (%d) [", e->pref);
+  if (p && (origas = as_path_get_first(p->u.ptr)) >= 0)
+    buf += bsprintf(buf, "AS%d", origas);
+  if (o)
+    buf += bsprintf(buf, "%c", "ie?"[o->u.data]);
+  strcpy(buf, "]");
+}
index c6dc4e907d79e18abb16822f5da5183c88c80cfb..610436f9f93835a0cea987c1bf4399f3b9792f9d 100644 (file)
@@ -531,8 +531,5 @@ struct protocol proto_bgp = {
   get_status:          bgp_get_status,
   get_attr:            bgp_get_attr,
   reconfigure:         bgp_reconfigure,
-#if 0
-  dump:                        bgp_dump,
   get_route_info:      bgp_get_route_info,
-#endif
 };
index 397928c4504a633fd577c5d8c1536a55f26b3fed..03f47f99af85a07187b273ba771b40029cd0a7e0 100644 (file)
@@ -123,6 +123,7 @@ int bgp_import_control(struct proto *, struct rte **, struct ea_list **, struct
 void bgp_attr_init(struct bgp_proto *);
 unsigned int bgp_encode_attrs(byte *w, struct ea_list *attrs, int remains);
 void bgp_free_bucket(struct bgp_proto *p, struct bgp_bucket *buck);
+void bgp_get_route_info(struct rte *, byte *buf, struct ea_list *attrs);
 
 /* packets.c */