bgp: ignore NHT when bgpd has never connected zebra
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 38fecd9..45d502a 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -50,6 +50,8 @@
struct stream *bgp_nexthop_buf = NULL;
struct stream *bgp_ifindices_buf = NULL;
+int zclient_num_connects;
+
/* Router-id update message from zebra. */
static int
bgp_router_id_update (int command, struct zclient *zclient, zebra_size_t length,
@@ -1171,12 +1173,15 @@
static void
bgp_zebra_connected (struct zclient *zclient)
{
+ zclient_num_connects++;
zclient_send_requests (zclient, VRF_DEFAULT);
}
void
bgp_zebra_init (struct thread_master *master)
{
+ zclient_num_connects = 0;
+
/* Set default values. */
zclient = zclient_new (master);
zclient_init (zclient, ZEBRA_ROUTE_BGP);
@@ -1207,3 +1212,9 @@
zclient_free(zclient);
zclient = NULL;
}
+
+int
+bgp_zebra_num_connects(void)
+{
+ return zclient_num_connects;
+}