From 5f0c5ec85d1b7e03b792211fab15eff8288971f2 Mon Sep 17 00:00:00 2001 From: vivek Date: Mon, 25 May 2020 14:06:10 -0700 Subject: [PATCH] bgpd: Minor tweaks to EVPN route-import debugs Signed-off-by: Vivek Venkatraman --- bgpd/bgp_evpn.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index a10686189d..b82f00e862 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2634,17 +2634,17 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, afi_t afi = 0; safi_t safi = 0; char buf[PREFIX_STRLEN]; - char buf1[PREFIX_STRLEN]; + bool new_pi = false; memset(pp, 0, sizeof(struct prefix)); ip_prefix_from_evpn_prefix(evp, pp); if (bgp_debug_zebra(NULL)) { zlog_debug( - "import evpn prefix %s as ip prefix %s in vrf %s", + "vrf %s: import evpn prefix %s parent %p flags 0x%x", + vrf_id_to_name(bgp_vrf->vrf_id), prefix2str(evp, buf, sizeof(buf)), - prefix2str(pp, buf1, sizeof(buf)), - vrf_id_to_name(bgp_vrf->vrf_id)); + parent_pi, parent_pi->flags); } /* Create (or fetch) route within the VRF. */ @@ -2678,9 +2678,10 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, && (struct bgp_path_info *)pi->extra->parent == parent_pi) break; - if (!pi) + if (!pi) { pi = bgp_create_evpn_bgp_path_info(parent_pi, rn, &attr); - else { + new_pi = true; + } else { if (attrhash_cmp(pi->attr, &attr) && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) { bgp_unlock_node(rn); @@ -2722,6 +2723,12 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, bgp_unlock_node(rn); + if (bgp_debug_zebra(NULL)) + zlog_debug( + "... %s pi rn %p (l %d) pi %p (l %d, f 0x%x)", + new_pi ? "new" : "update", + rn, rn->lock, pi, pi->lock, pi->flags); + return ret; } @@ -2839,17 +2846,16 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, afi_t afi = 0; safi_t safi = 0; char buf[PREFIX_STRLEN]; - char buf1[PREFIX_STRLEN]; memset(pp, 0, sizeof(struct prefix)); ip_prefix_from_evpn_prefix(evp, pp); if (bgp_debug_zebra(NULL)) { zlog_debug( - "uninstalling evpn prefix %s as ip prefix %s in vrf %s", + "vrf %s: unimport evpn prefix %s parent %p flags 0x%x", + vrf_id_to_name(bgp_vrf->vrf_id), prefix2str(evp, buf, sizeof(buf)), - prefix2str(pp, buf1, sizeof(buf)), - vrf_id_to_name(bgp_vrf->vrf_id)); + parent_pi, parent_pi->flags); } /* Locate route within the VRF. */ @@ -2876,6 +2882,11 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, if (!pi) return 0; + if (bgp_debug_zebra(NULL)) + zlog_debug( + "... delete rn %p (l %d) pi %p (l %d, f 0x%x)", + rn, rn->lock, pi, pi->lock, pi->flags); + /* Process for route leaking. */ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp_vrf, pi); -- 2.39.5