From adae8192d184beafdf84b15b24b66c7ccd0c92e0 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Tue, 19 Nov 2024 12:24:30 -0800 Subject: [PATCH 1/5] zebra: EVPN check vxlan oper up in vlan mapping When VLAN-VNI mapping is updated, do not set the L2VNI up event if the associated VXLAN device is not up. This may result in bgp synced remote routes to skip installing in Zebra and onwards (Kernel). Ticket: #4139506 Signed-off-by: Chirag Shah --- zebra/zebra_vxlan_if.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_vxlan_if.c b/zebra/zebra_vxlan_if.c index 17ab05c1f3f5..2658c9f01c44 100644 --- a/zebra/zebra_vxlan_if.c +++ b/zebra/zebra_vxlan_if.c @@ -1032,7 +1032,13 @@ int zebra_vxlan_if_vni_up(struct interface *ifp, struct zebra_vxlan_vni *vnip) /* If part of a bridge, inform BGP about this VNI. */ /* Also, read and populate local MACs and neighbors. */ if (zif->brslave_info.br_if) { - zebra_evpn_send_add_to_client(zevpn); + if (if_is_operative(zevpn->vxlan_if)) { + zebra_evpn_send_add_to_client(zevpn); + } else { + if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_VXLAN) + zlog_debug("%s VNI %u vxlan_if %s oper down skipping vni up to client", + __func__, zevpn->vni, zevpn->vxlan_if->name); + } zebra_evpn_read_mac_neigh(zevpn, ifp); } } From 97538158ba0b073febebea1439dceae2947a7e0c Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Thu, 14 Nov 2024 15:17:07 -0800 Subject: [PATCH 2/5] zebra: EVPN add debug trace for HREP entry Ticket: #4139506 Signed-off-by: Chirag Shah --- zebra/rt_netlink.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index ab07ef8d2124..492fe528894e 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -3683,6 +3683,13 @@ netlink_vxlan_flood_update_ctx(const struct zebra_dplane_ctx *ctx, int cmd, if (dplane_ctx_get_type(ctx) != 0) proto = zebra2proto(dplane_ctx_get_type(ctx)); + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("Tx %s family %s IF %s(%u) VNI %u MAC %pEA VTEP %pIA vid %u", + nl_msg_type_to_str(cmd), nl_family_to_str(PF_BRIDGE), + dplane_ctx_get_ifname(ctx), dplane_ctx_get_ifindex(ctx), + dplane_ctx_neigh_get_vni(ctx), &dst_mac, + dplane_ctx_neigh_get_ipaddr(ctx), dplane_ctx_mac_get_vlan(ctx)); + return netlink_neigh_update_msg_encode( ctx, cmd, (const void *)&dst_mac, ETH_ALEN, dplane_ctx_neigh_get_ipaddr(ctx), false, PF_BRIDGE, 0, NTF_SELF, From 866148ef1b1931f5385c6452344540fc61366a6c Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Wed, 20 Nov 2024 09:15:24 -0800 Subject: [PATCH 3/5] zebra: add debug in remote vtep install ifp not up Ticket: #4139506 Signed-off-by: Chirag Shah --- zebra/zebra_vxlan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 9e2c138e21f1..0658f996e6b6 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -4755,8 +4755,14 @@ void zebra_vxlan_remote_vtep_add(vrf_id_t vrf_id, vni_t vni, zif = ifp->info; /* If down or not mapped to a bridge, we're done. */ - if (!if_is_operative(ifp) || !zif->brslave_info.br_if) + if (!if_is_operative(ifp) || !zif->brslave_info.br_if) { + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug( + "%s VNI %u VTEP %pI4 ifp %s oper %u br_if %u skipping update", + __func__, zevpn->vni, &vtep_ip, ifp->name, + if_is_operative(ifp), !zif->brslave_info.br_if); return; + } zvtep = zebra_evpn_vtep_find(zevpn, &vtep_ip); if (zvtep) { From 91119dab9b2e1ac911685cf7232739d3e7dab453 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Tue, 19 Nov 2024 18:11:10 -0800 Subject: [PATCH 4/5] tools: add helper function to print family Ticket: #4127810 Testing: 2024-11-20T01:52:10.073 frr_zebra:netlink_neigh_update_msg_encode {'mac': '00:00:00:00:00:00', 'ip': '27.0.0.4', 'nhg': 0, 'flags': 2, 'state': 192, 'family': 'bridge', 'type': 0, 'op': 23} Signed-off-by: Chirag Shah --- tools/frr_babeltrace.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/frr_babeltrace.py b/tools/frr_babeltrace.py index 9832568b3736..c3a22cd1e809 100755 --- a/tools/frr_babeltrace.py +++ b/tools/frr_babeltrace.py @@ -79,6 +79,28 @@ def parse_event(event, field_parsers): else: field_info[field] = event.get(field) print(event.name, field_info) + + +def print_family_str(field_val): + """ + pretty print kernel family to string + """ + if field_val == socket.AF_INET: + cmd_str = "ipv4" + elif field_val == socket.AF_INET6: + cmd_str = "ipv6" + elif field_val == socket.AF_BRIDGE: + cmd_str = "bridge" + elif field_val == 128: # RTNL_FAMILY_IPMR: + cmd_str = "ipv4MR" + elif field_val == 129: # RTNL_FAMILY_IP6MR: + cmd_str = "ipv6MR" + else: + cmd_str = "Invalid family" + + return cmd_str + + ############################ common parsers - end ############################# ############################ evpn parsers - start ############################# From 814a89f6e51cdb27f695212774e711704b44f8cc Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Mon, 25 Nov 2024 08:58:25 -0800 Subject: [PATCH 5/5] tools: fix style check babletrace file python3 -m black tools/frr_babeltrace.py Signed-off-by: Chirag Shah --- tools/frr_babeltrace.py | 54 ++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/tools/frr_babeltrace.py b/tools/frr_babeltrace.py index c3a22cd1e809..7ace5d64b68b 100755 --- a/tools/frr_babeltrace.py +++ b/tools/frr_babeltrace.py @@ -18,6 +18,7 @@ import babeltrace + ########################### common parsers - start ############################ def print_ip_addr(field_val): """ @@ -48,24 +49,28 @@ def print_mac(field_val): """ return ":".join("%02x" % fb for fb in field_val) + def print_net_ipv4_addr(field_val): """ pretty print ctf_integer_network ipv4 """ return str(ipaddress.IPv4Address(field_val)) + def print_esi(field_val): """ pretty print ethernet segment id, esi_t """ return ":".join("%02x" % fb for fb in field_val) + def get_field_list(event): """ only fetch fields added via the TP, skip metadata etc. """ return event.field_list_with_scope(babeltrace.CTFScope.EVENT_FIELDS) + def parse_event(event, field_parsers): """ Wild card event parser; doesn't make things any prettier @@ -103,6 +108,7 @@ def print_family_str(field_val): ############################ common parsers - end ############################# + ############################ evpn parsers - start ############################# def parse_frr_bgp_evpn_mac_ip_zsend(event): """ @@ -114,13 +120,16 @@ def parse_frr_bgp_evpn_mac_ip_zsend(event): ctf_integer_network_hex(unsigned int, vtep, vtep.s_addr) ctf_array(unsigned char, esi, esi, sizeof(esi_t)) """ - field_parsers = {"ip": print_ip_addr, - "mac": print_mac, - "esi": print_esi, - "vtep": print_net_ipv4_addr} + field_parsers = { + "ip": print_ip_addr, + "mac": print_mac, + "esi": print_esi, + "vtep": print_net_ipv4_addr, + } parse_event(event, field_parsers) + def parse_frr_bgp_evpn_bum_vtep_zsend(event): """ bgp evpn bum-vtep parser; raw format - @@ -132,6 +141,7 @@ def parse_frr_bgp_evpn_bum_vtep_zsend(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_nh_rmac_send(event): """ bgp evpn nh-rmac parser; raw format - @@ -141,17 +151,18 @@ def parse_frr_bgp_evpn_mh_nh_rmac_send(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_add_zrecv(event): """ bgp evpn local-es parser; raw format - ctf_array(unsigned char, esi, esi, sizeof(esi_t)) ctf_integer_network_hex(unsigned int, vtep, vtep.s_addr) """ - field_parsers = {"esi": print_esi, - "vtep": print_net_ipv4_addr} + field_parsers = {"esi": print_esi, "vtep": print_net_ipv4_addr} parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_del_zrecv(event): """ bgp evpn local-es parser; raw format - @@ -161,6 +172,7 @@ def parse_frr_bgp_evpn_mh_local_es_del_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_evi_add_zrecv(event): """ bgp evpn local-es-evi parser; raw format - @@ -170,6 +182,7 @@ def parse_frr_bgp_evpn_mh_local_es_evi_add_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_evi_del_zrecv(event): """ bgp evpn local-es-evi parser; raw format - @@ -179,6 +192,7 @@ def parse_frr_bgp_evpn_mh_local_es_evi_del_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_es_evi_vtep_add(event): """ bgp evpn remote ead evi remote vtep add; raw format - @@ -189,6 +203,7 @@ def parse_frr_bgp_evpn_mh_es_evi_vtep_add(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_es_evi_vtep_del(event): """ bgp evpn remote ead evi remote vtep del; raw format - @@ -199,6 +214,7 @@ def parse_frr_bgp_evpn_mh_es_evi_vtep_del(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_upd(event): """ bgp evpn local ead evi vtep; raw format - @@ -209,6 +225,7 @@ def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_upd(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_del(event): """ bgp evpn local ead evi vtep del; raw format - @@ -219,6 +236,7 @@ def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_del(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_vni_add_zrecv(event): """ bgp evpn local-vni parser; raw format - @@ -230,6 +248,7 @@ def parse_frr_bgp_evpn_local_vni_add_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_l3vni_add_zrecv(event): """ bgp evpn local-l3vni parser; raw format - @@ -237,12 +256,15 @@ def parse_frr_bgp_evpn_local_l3vni_add_zrecv(event): ctf_array(unsigned char, svi_rmac, svi_rmac, sizeof(struct ethaddr)) ctf_array(unsigned char, vrr_rmac, vrr_rmac, sizeof(struct ethaddr)) """ - field_parsers = {"vtep": print_net_ipv4_addr, - "svi_rmac": print_mac, - "vrr_rmac": print_mac} + field_parsers = { + "vtep": print_net_ipv4_addr, + "svi_rmac": print_mac, + "vrr_rmac": print_mac, + } parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_macip_add_zrecv(event): """ bgp evpn local-mac-ip parser; raw format - @@ -256,6 +278,7 @@ def parse_frr_bgp_evpn_local_macip_add_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_macip_del_zrecv(event): """ bgp evpn local-mac-ip del parser; raw format - @@ -267,16 +290,20 @@ def parse_frr_bgp_evpn_local_macip_del_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_advertise_type5(event): """ local originated type-5 route """ - field_parsers = {"ip": print_ip_addr, - "rmac": print_mac, - "vtep": print_net_ipv4_addr} + field_parsers = { + "ip": print_ip_addr, + "rmac": print_mac, + "vtep": print_net_ipv4_addr, + } parse_event(event, field_parsers) + def parse_frr_bgp_evpn_withdraw_type5(event): """ local originated type-5 route withdraw @@ -285,8 +312,10 @@ def parse_frr_bgp_evpn_withdraw_type5(event): parse_event(event, field_parsers) + ############################ evpn parsers - end *############################# + def main(): """ FRR lttng trace output parser; babel trace plugin @@ -341,5 +370,6 @@ def main(): else: parse_event(event, {}) + if __name__ == "__main__": main()