From bb4ef1aec80227d318e48ed65c261b812e356f1b Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 5 Oct 2018 09:43:28 -0400 Subject: [PATCH] bgpd: Add some debugs to note when we are not talking to zebra Allow some debug notification when we are unable to talk to zebra due to the connection not being there yet. Signed-off-by: Donald Sharp --- bgpd/bgp_evpn.c | 13 ++++++++++--- bgpd/bgp_nht.c | 6 +++++- bgpd/bgp_zebra.c | 23 +++++++++++++++++++---- bgpd/bgpd.c | 13 ++++++++++--- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 574ece8cc5..c91a2ab6bd 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -558,9 +558,12 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn, return 0; /* Don't try to register if Zebra doesn't know of this instance. */ - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: No zebra instance to talk to, not installing remote macip", + __PRETTY_FUNCTION__); return 0; - + } s = zclient->obuf; stream_reset(s); @@ -616,8 +619,12 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn, return 0; /* Don't try to register if Zebra doesn't know of this instance. */ - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: No zebra instance to talk to, not installing remote vtep", + __PRETTY_FUNCTION__); return 0; + } s = zclient->obuf; stream_reset(s); diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index e764860bcc..2e7f17fdae 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -587,8 +587,12 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command) return; /* Don't try to register if Zebra doesn't know of this instance. */ - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bnc->bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bnc->bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: No zebra instance to talk to, not installing NHT entry", + __PRETTY_FUNCTION__); return; + } p = &(bnc->node->p); if ((command == ZEBRA_NEXTHOP_REGISTER diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 81a5be9d0c..0b79a9ee18 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -68,8 +68,11 @@ static inline int bgp_install_info_to_zebra(struct bgp *bgp) if (zclient->sock <= 0) return 0; - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + zlog_debug("%s: No zebra instance to talk to, not installing information", + __PRETTY_FUNCTION__); return 0; + } return 1; } @@ -1895,8 +1898,12 @@ int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise, vni_t vni) return 0; /* Don't try to register if Zebra doesn't know of this instance. */ - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: No zebra instance to talk to, cannot advertise subnet", + __PRETTY_FUNCTION__); return 0; + } s = zclient->obuf; stream_reset(s); @@ -1918,8 +1925,12 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni) return 0; /* Don't try to register if Zebra doesn't know of this instance. */ - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: No zebra instance to talk to, not installing gw_macip", + __PRETTY_FUNCTION__); return 0; + } s = zclient->obuf; stream_reset(s); @@ -1942,8 +1953,12 @@ int bgp_zebra_vxlan_flood_control(struct bgp *bgp, return 0; /* Don't try to register if Zebra doesn't know of this instance. */ - if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: No zebra instance to talk to, not installing all vni", + __PRETTY_FUNCTION__); return 0; + } s = zclient->obuf; stream_reset(s); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index be092e9501..19384eec2f 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3072,9 +3072,12 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name, bgp_handle_socket(bgp, vrf, VRF_UNKNOWN, true); listnode_add(bm->bgp, bgp); - if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: Registering BGP instance %s to zebra", + __PRETTY_FUNCTION__, name); bgp_zebra_instance_register(bgp); - + } return 0; } @@ -3218,8 +3221,12 @@ int bgp_delete(struct bgp *bgp) } /* Deregister from Zebra, if needed */ - if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) + if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("%s: deregistering this bgp %s instance from zebra", + __PRETTY_FUNCTION__, bgp->name); bgp_zebra_instance_deregister(bgp); + } /* Remove visibility via the master list - there may however still be * routes to be processed still referencing the struct bgp. -- 2.39.5