Mailing List Archive

[PATCH 18/23] bgpd: add bgp_api_static_get() routine
This function is reserved for being used when capnp API will need to
retrieve information.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
---
bgpd/bgp_route.c | 17 +++++++++++++++++
bgpd/bgpd.h | 2 ++
2 files changed, 19 insertions(+)

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 652c47e6274a..c892fe690b28 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1596,6 +1596,23 @@ bool bgp_api_route_get (struct bgp_api_route *out, struct bgp_node *bn,
return true;
}

+bool bgp_api_static_get (struct bgp_api_route *out, struct bgp_node *bn)
+{
+ struct bgp_static *bgp_static;
+
+ memset(out, 0, sizeof (*out));
+ if (bn->p.family != AF_INET)
+ return false;
+ if (!bn->info)
+ return false;
+ bgp_static = bn->info;
+
+ prefix_copy ((struct prefix *)&out->prefix, &bn->p);
+ out->nexthop = bgp_static->igpnexthop;
+ out->label = bgp_static->nlabels ? (bgp_static->labels[0] >> 4) : 0;
+ return true;
+}
+
static bool rd_same (const struct prefix_rd *a, const struct prefix_rd *b)
{
return !memcmp(&a->val, &b->val, sizeof(a->val));
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 4c79071abe2f..ad6a6652784e 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1129,4 +1129,6 @@ extern bool bgp_api_route_get (struct bgp_api_route *out,
struct bgp_node *bn,
int iter_on_multipath,
void **next);
+extern bool bgp_api_static_get (struct bgp_api_route *out, struct bgp_node *bn);
+
#endif /* _QUAGGA_BGPD_H */
--
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev