From 6f27419975c3f5475b451f4f3b2728eaac9f632e Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 3 Nov 2022 12:01:51 +0100 Subject: [PATCH] bgpd: display the IGP metric of the ultimate path in snmp Display the IGP metric of the ultimate path in the SNMP OID mplsL3VpnVrfRteInetCidrMetric1. Fixes: da0c0ef70c ("bgpd: VRF-Lite fix best path selection") Signed-off-by: Louis Scalbert --- bgpd/bgp_mplsvpn_snmp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_mplsvpn_snmp.c b/bgpd/bgp_mplsvpn_snmp.c index 7a2f618ce6..8d5daa49c8 100644 --- a/bgpd/bgp_mplsvpn_snmp.c +++ b/bgpd/bgp_mplsvpn_snmp.c @@ -1529,7 +1529,7 @@ static uint8_t *mplsL3vpnRteTable(struct variable *v, oid name[], char vrf_name[VRF_NAMSIZ]; struct bgp *l3vpn_bgp; struct bgp_dest *dest; - struct bgp_path_info *pi; + struct bgp_path_info *pi, *bpi_ultimate; const struct prefix *p; uint16_t policy = 0; @@ -1545,6 +1545,8 @@ static uint8_t *mplsL3vpnRteTable(struct variable *v, oid name[], if (!pi) return NULL; + bpi_ultimate = bgp_get_imported_bpi_ultimate(pi); + p = bgp_dest_get_prefix(dest); if (!p) @@ -1661,8 +1663,8 @@ static uint8_t *mplsL3vpnRteTable(struct variable *v, oid name[], case MPLSL3VPNVRFRTEINETCIDRNEXTHOPAS: return SNMP_INTEGER(pi->peer ? pi->peer->as : 0); case MPLSL3VPNVRFRTEINETCIDRMETRIC1: - if (pi->extra) - return SNMP_INTEGER(pi->extra->igpmetric); + if (bpi_ultimate->extra) + return SNMP_INTEGER(bpi_ultimate->extra->igpmetric); else return SNMP_INTEGER(0); case MPLSL3VPNVRFRTEINETCIDRMETRIC2: -- 2.39.5