Skip to content

Commit

Permalink
bgpd: revamp evpn debugs nexthop and l3vni
Browse files Browse the repository at this point in the history
Add nexthop fied when import/unimport evpn route in vrf,
print bgp vrf instance name which contains "VRF" keyword.

Include pathcount which is list of paths linked to nexthop.

add and delete l3vni to keep symmetric "L3VNI" keyword as
used in other debug statements.

Ticket: #3671288
Testing Done:

2023/12/27 05:10:03.339616 BGP: [HPE1G-3H7F2] ... new pi VRF vrf2
dest 0x55663e8372c0 (l 2) pi 0x55663e8374d0 (l 1, f 0x4010) nh 6.0.0.1

2023/12/27 05:58:56.650116 BGP: [MC0JJ-7ZYQB] ... delete pi VRF vrf2
dest 0x55663e885110 (l 5) pi 0x55663e8851e0 (l 1, f 0x4098) nh 6.0.0.1

2023/12/27 05:10:03.339581 BGP: [P4TBX-3W31N] evpn VRF vrf2 nh
6.0.0.1 rmac 00:02:00:00:00:04 add to zebra

2023/12/27 06:13:12.685906 BGP: [SWSCZ-2Z6M4] evpn vrf VRF vrf1 nh
6.0.0.1 del to zebra

2023/12/27 05:10:03.339603 BGP: [Y2EAK-4N7FV] path 60.1.1.111/32 linked
to VRF vrf2 nh 6.0.0.1 pathcount 0

2023/12/27 05:58:56.650125 BGP: [GVE17-CSNTB] path 81.1.1.0/24 unlinked
from VRF vrf2 nh 6.0.0.1 pathcount 16

2023/12/27 05:08:10.108038 ZEBRA: [Q8ZEK-CT776] Send L3VNI ADD 104001
VRF vrf1 RMAC 00:04:ba:10:10:62 VRR 1c:34:da:19:59:62 local-ip 6.0.0.31
filter none to bgp

2023/12/27 05:08:26.043121 ZEBRA: [R43YF-2MKZ3] Send L3VNI DEL 104001
VRF vrf1 to bgp

Signed-off-by: Chirag Shah <[email protected]>
  • Loading branch information
chiragshah6 committed Dec 27, 2023
1 parent 080299f commit c4fe20b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 33 deletions.
42 changes: 35 additions & 7 deletions bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3067,11 +3067,24 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
/* Process for route leaking. */
vpn_leak_from_vrf_update(bgp_get_default(), bgp_vrf, pi);

if (bgp_debug_zebra(NULL))
zlog_debug("... %s pi dest %p (l %d) pi %p (l %d, f 0x%x)",
if (bgp_debug_zebra(NULL)) {
struct ipaddr nhip;

memset(&nhip, 0, sizeof(nhip));
if (pi->net->rn->p.family == AF_INET6) {
SET_IPADDR_V6(&nhip);
memcpy(&nhip.ipaddr_v6, &pi->attr->mp_nexthop_global,
sizeof(nhip.ipaddr_v6));
} else {
SET_IPADDR_V4(&nhip);
memcpy(&nhip.ipaddr_v4, &pi->attr->nexthop,
sizeof(nhip.ipaddr_v4));
}
zlog_debug("... %s pi dest %p (l %d) pi %p (l %d, f 0x%x) nh %pIA",
new_pi ? "new" : "update", dest,
bgp_dest_get_lock_count(dest), pi, pi->lock,
pi->flags);
pi->flags, &nhip);
}

bgp_dest_unlock_node(dest);

Expand Down Expand Up @@ -3380,10 +3393,25 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
return 0;
}

if (bgp_debug_zebra(NULL))
zlog_debug("... delete dest %p (l %d) pi %p (l %d, f 0x%x)",
dest, bgp_dest_get_lock_count(dest), pi, pi->lock,
pi->flags);
if (bgp_debug_zebra(NULL)) {
struct ipaddr nhip;

memset(&nhip, 0, sizeof(nhip));
if (pi->net->rn->p.family == AF_INET6) {
SET_IPADDR_V6(&nhip);
memcpy(&nhip.ipaddr_v6, &pi->attr->mp_nexthop_global,
sizeof(nhip.ipaddr_v6));
} else {
SET_IPADDR_V4(&nhip);
memcpy(&nhip.ipaddr_v4, &pi->attr->nexthop,
sizeof(nhip.ipaddr_v4));
}

zlog_debug("... delete pi %s dest %p (l %d) pi %p (l %d, f 0x%x) nh %pIA",
bgp_vrf->name_pretty, dest,
bgp_dest_get_lock_count(dest), pi, pi->lock,
pi->flags, &nhip);
}

/* Process for route leaking. */
vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp_vrf, pi);
Expand Down
22 changes: 12 additions & 10 deletions bgpd/bgp_evpn_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -4457,13 +4457,13 @@ static void bgp_evpn_nh_zebra_update_send(struct bgp_evpn_nh *nh, bool add)

stream_putw_at(s, 0, stream_get_endp(s));

if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) {
if (BGP_DEBUG(evpn_mh, EVPN_MH_ES) || bgp_debug_zebra(NULL)) {
if (add)
zlog_debug("evpn vrf %s nh %s rmac %pEA add to zebra",
zlog_debug("evpn %s nh %s rmac %pEA add to zebra",
nh->bgp_vrf->name_pretty, nh->nh_str,
&nh->rmac);
else if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
zlog_debug("evpn vrf %s nh %s del to zebra",
else
zlog_debug("evpn %s nh %s del to zebra",
nh->bgp_vrf->name_pretty, nh->nh_str);
}

Expand Down Expand Up @@ -4646,7 +4646,7 @@ static void bgp_evpn_nh_update_ref_pi(struct bgp_evpn_nh *nh)
continue;

if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
zlog_debug("evpn vrf %s nh %s ref_pi update",
zlog_debug("evpn %s nh %s ref_pi update",
nh->bgp_vrf->name_pretty, nh->nh_str);
nh->ref_pi = pi;
/* If we have a new pi copy rmac from it and update
Expand Down Expand Up @@ -4724,11 +4724,12 @@ static void bgp_evpn_path_nh_unlink(struct bgp_path_evpn_nh_info *nh_info)

pi = nh_info->pi;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
zlog_debug("path %s unlinked from nh %s %s",
zlog_debug("path %s unlinked from %s nh %s pathcount %u",
pi->net ? prefix2str(&pi->net->rn->p, prefix_buf,
sizeof(prefix_buf))
: "",
nh->bgp_vrf->name_pretty, nh->nh_str);
nh->bgp_vrf->name_pretty, nh->nh_str,
listcount(nh->pi_list));

list_delete_node(nh->pi_list, &nh_info->nh_listnode);

Expand Down Expand Up @@ -4759,7 +4760,7 @@ static void bgp_evpn_path_nh_link(struct bgp *bgp_vrf, struct bgp_path_info *pi)

if (!bgp_vrf->evpn_nh_table) {
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
zlog_debug("path %pFX linked to vrf %s failed",
zlog_debug("path %pFX linked to %s failed",
&pi->net->rn->p, bgp_vrf->name_pretty);
return;
}
Expand Down Expand Up @@ -4807,8 +4808,9 @@ static void bgp_evpn_path_nh_link(struct bgp *bgp_vrf, struct bgp_path_info *pi)
bgp_evpn_path_nh_unlink(nh_info);

if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
zlog_debug("path %pFX linked to nh %s %s", &pi->net->rn->p,
nh->bgp_vrf->name_pretty, nh->nh_str);
zlog_debug("path %pFX linked to %s nh %s pathcount %u",
&pi->net->rn->p, nh->bgp_vrf->name_pretty,
nh->nh_str, listcount(nh->pi_list));

/* link mac-ip path to the new nh */
nh_info->nh = nh;
Expand Down
13 changes: 6 additions & 7 deletions bgpd/bgp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -2936,12 +2936,11 @@ static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS)
is_anycast_mac = stream_getl(s);

if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug(
"Rx L3-VNI ADD VRF %s VNI %u Originator-IP %pI4 RMAC svi-mac %pEA vrr-mac %pEA filter %s svi-if %u",
vrf_id_to_name(vrf_id), l3vni, &originator_ip,
&svi_rmac, &vrr_rmac,
filter ? "prefix-routes-only" : "none",
svi_ifindex);
zlog_debug("Rx L3VNI ADD VRF %s VNI %u Originator-IP %pI4 RMAC svi-mac %pEA vrr-mac %pEA filter %s svi-if %u",
vrf_id_to_name(vrf_id), l3vni,
&originator_ip, &svi_rmac, &vrr_rmac,
filter ? "prefix-routes-only" : "none",
svi_ifindex);

frrtrace(8, frr_bgp, evpn_local_l3vni_add_zrecv, l3vni, vrf_id,
&svi_rmac, &vrr_rmac, filter, originator_ip,
Expand All @@ -2952,7 +2951,7 @@ static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS)
is_anycast_mac);
} else {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Rx L3-VNI DEL VRF %s VNI %u",
zlog_debug("Rx L3VNI DEL VRF %s VNI %u",
vrf_id_to_name(vrf_id), l3vni);

frrtrace(2, frr_bgp, evpn_local_l3vni_del_zrecv, l3vni, vrf_id);
Expand Down
17 changes: 8 additions & 9 deletions zebra/zebra_vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2265,14 +2265,13 @@ static int zl3vni_send_add_to_client(struct zebra_l3vni *zl3vni)
stream_putw_at(s, 0, stream_get_endp(s));

if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"Send L3_VNI_ADD %u VRF %s RMAC %pEA VRR %pEA local-ip %pI4 filter %s to %s",
zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
&svi_rmac, &vrr_rmac, &zl3vni->local_vtep_ip,
CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY)
? "prefix-routes-only"
: "none",
zebra_route_string(client->proto));
zlog_debug("Send L3VNI ADD %u VRF %s RMAC %pEA VRR %pEA local-ip %pI4 filter %s to %s",
zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
&svi_rmac, &vrr_rmac, &zl3vni->local_vtep_ip,
CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY)
? "prefix-routes-only"
: "none",
zebra_route_string(client->proto));

client->l3vniadd_cnt++;
return zserv_send_message(client, s);
Expand Down Expand Up @@ -2300,7 +2299,7 @@ static int zl3vni_send_del_to_client(struct zebra_l3vni *zl3vni)
stream_putw_at(s, 0, stream_get_endp(s));

if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Send L3_VNI_DEL %u VRF %s to %s", zl3vni->vni,
zlog_debug("Send L3VNI DEL %u VRF %s to %s", zl3vni->vni,
vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
zebra_route_string(client->proto));

Expand Down

0 comments on commit c4fe20b

Please sign in to comment.