summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-19 13:01:41 +0200
committerMartin Mares <mj@ucw.cz>2000-05-19 13:01:41 +0200
commit5e88d7302599b7ac521624c77adf0b3c72601670 (patch)
treef2b45af33fde31c5d519f28a524e3d95c1321934
parentf49528a3dfa034415527824cbbd0762f3829f0cd (diff)
downloadbird-5e88d7302599b7ac521624c77adf0b3c72601670.tar
bird-5e88d7302599b7ac521624c77adf0b3c72601670.zip
BGP now reports originating AS and origin type in get_route_info().
-rw-r--r--TODO2
-rw-r--r--proto/bgp/attrs.c15
-rw-r--r--proto/bgp/bgp.c3
-rw-r--r--proto/bgp/bgp.h1
4 files changed, 16 insertions, 5 deletions
diff --git a/TODO b/TODO
index ed32e6b..6950365 100644
--- a/TODO
+++ b/TODO
@@ -6,8 +6,6 @@ Core
- table: ocassional core dumps in rt_prune()
-- bgp: get_route_info
-
Documentation
~~~~~~~~~~~~~
- write doctool
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 4dda0ac..b074eb2 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -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, "]");
+}
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index c6dc4e9..610436f 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -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
};
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 397928c..03f47f9 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -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 */