+// SPDX-License-Identifier: GPL-2.0-or-later
/* MPLS/BGP L3VPN MIB
* Copyright (C) 2020 Volta Networks Inc
- *
- * This file is part of FRR.
- *
- * FRRouting is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * FRRouting is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "log.h"
#include "prefix.h"
#include "command.h"
-#include "thread.h"
+#include "frrevent.h"
#include "smux.h"
#include "filter.h"
#include "hook.h"
#include "libfrr.h"
-#include "version.h"
+#include "lib/version.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
if (CHECK_FLAG(l3vpn_bgp->vpn_policy[AFI_IP].flags,
BGP_VPN_POLICY_TOVPN_RD_SET))
prefix_rd2str(&l3vpn_bgp->vpn_policy[AFI_IP].tovpn_rd,
- rd_buf, sizeof(rd_buf));
+ rd_buf, sizeof(rd_buf),
+ bgp_get_asnotation(l3vpn_bgp));
else if (CHECK_FLAG(l3vpn_bgp->vpn_policy[AFI_IP6].flags,
BGP_VPN_POLICY_TOVPN_RD_SET))
prefix_rd2str(&l3vpn_bgp->vpn_policy[AFI_IP6].tovpn_rd,
- rd_buf, sizeof(rd_buf));
+ rd_buf, sizeof(rd_buf),
+ bgp_get_asnotation(l3vpn_bgp));
*var_len = strnlen(rd_buf, RD_ADDRSTRLEN);
return (uint8_t *)rd_buf;
struct bgp *l3vpn_bgp;
uint32_t rt_index = 0;
uint8_t rt_type = 0;
- char *rt_b;
+ char *rt_b = NULL;
+ static char rt_b_str[BUFSIZ] = {};
if (smux_header_table(v, name, length, exact, var_len, write_method)
== MATCH_FAILED)
ECOMMUNITY_ROUTE_TARGET);
break;
default:
- rt_b = NULL;
break;
}
- if (rt_b)
+ if (rt_b) {
*var_len = strnlen(rt_b, ECOMMUNITY_STRLEN);
- else
+ strlcpy(rt_b_str, rt_b, sizeof(rt_b_str));
+ XFREE(MTYPE_ECOMMUNITY_STR, rt_b);
+ } else {
*var_len = 0;
- return (uint8_t *)rt_b;
+ }
+ return (uint8_t *)rt_b_str;
case MPLSL3VPNVRFRTDESCR:
/* since we dont have a description generate one */
memset(rt_description, 0, VRF_NAMSIZ + RT_PREAMBLE_SIZE);
== 0)
return pi;
break;
- default:
+ case IPADDR_NONE:
return pi;
}
}
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;
if (!pi)
return NULL;
+ bpi_ultimate = bgp_get_imported_bpi_ultimate(pi);
+
p = bgp_dest_get_prefix(dest);
if (!p)
case BLACKHOLE_REJECT:
return SNMP_INTEGER(
MPLSL3VPNVRFRTECIDRTYPEREJECT);
- default:
+ case BLACKHOLE_UNSPEC:
+ case BLACKHOLE_NULL:
+ case BLACKHOLE_ADMINPROHIB:
return SNMP_INTEGER(
MPLSL3VPNVRFRTECIDRTYPEBLACKHOLE);
}
- default:
- return SNMP_INTEGER(
- MPLSL3VPNVRFRTECIDRTYPEOTHER);
+ break;
}
} else
return SNMP_INTEGER(MPLSL3VPNVRFRTECIDRTYPEOTHER);
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: