summaryrefslogtreecommitdiff
path: root/sharpd/sharp_zebra.c
diff options
context:
space:
mode:
Diffstat (limited to 'sharpd/sharp_zebra.c')
-rw-r--r--sharpd/sharp_zebra.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 0095aed547..0f2c634049 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -30,6 +30,7 @@
#include "zclient.h"
#include "nexthop.h"
#include "nexthop_group.h"
+#include "link_state.h"
#include "sharp_globals.h"
#include "sharp_nht.h"
@@ -685,7 +686,8 @@ static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
return 0;
}
- zlog_debug("Received update for %pFX", &nhr.prefix);
+ zlog_debug("Received update for %pFX metric: %u", &nhr.prefix,
+ nhr.metric);
nht = sharp_nh_tracker_get(&nhr.prefix);
nht->nhop_num = nhr.nexthop_num;
@@ -768,11 +770,15 @@ int sharp_zclient_delete(uint32_t session_id)
return 0;
}
+static const char *const type2txt[] = { "Generic", "Vertex", "Edge", "Subnet" };
+static const char *const status2txt[] = { "Unknown", "New", "Update",
+ "Delete", "Sync", "Orphan"};
/* Handler for opaque messages */
static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS)
{
struct stream *s;
struct zapi_opaque_msg info;
+ struct ls_element *lse;
s = zclient->ibuf;
@@ -782,6 +788,18 @@ static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS)
zlog_debug("%s: [%u] received opaque type %u", __func__,
zclient->session_id, info.type);
+ if (info.type == LINK_STATE_UPDATE) {
+ lse = ls_stream2ted(sg.ted, s, false);
+ if (lse)
+ zlog_debug(" |- Got %s %s from Link State Database",
+ status2txt[lse->status],
+ type2txt[lse->type]);
+ else
+ zlog_debug(
+ "%s: Error to convert Stream into Link State",
+ __func__);
+ }
+
return 0;
}
@@ -852,6 +870,16 @@ void sharp_opaque_reg_send(bool is_reg, uint32_t proto, uint32_t instance,
}
+/* Link State registration */
+void sharp_zebra_register_te(void)
+{
+ /* First register to received Link State Update messages */
+ zclient_register_opaque(zclient, LINK_STATE_UPDATE);
+
+ /* Then, request initial TED with SYNC message */
+ ls_request_sync(zclient);
+}
+
void sharp_zebra_send_arp(const struct interface *ifp, const struct prefix *p)
{
zclient_send_neigh_discovery_req(zclient, ifp, p);