summaryrefslogtreecommitdiff
path: root/bgpd/bgp_bmp.c
diff options
context:
space:
mode:
authormxyns <mx.yns@outlook.fr>2022-07-28 18:23:14 +0200
committerMaxence Younsi <mx.yns@outlook.fr>2023-11-04 12:17:48 +0100
commit24f3d9ff1a8680df1e2c11c457bec6dca88b82c0 (patch)
tree0b8932b4b2ae9dc210bdec80d8bf9956e0e4524e /bgpd/bgp_bmp.c
parentf83857832f6083b27ea40fda1bd32a2095fbfc27 (diff)
bgpd: safer vrf/table name (RFC9069) info tlv
vrf_id_to_name is used for display values only and returns "Unknown" when the vrf is not found doing a manual lookup and not providing any tlv when the vrf is not found should be better Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
Diffstat (limited to 'bgpd/bgp_bmp.c')
-rw-r--r--bgpd/bgp_bmp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c
index e75f08eaff..78528b080a 100644
--- a/bgpd/bgp_bmp.c
+++ b/bgpd/bgp_bmp.c
@@ -344,6 +344,19 @@ static void bmp_put_info_tlv(struct stream *s, uint16_t type,
stream_put(s, string, len);
}
+static void bmp_put_vrftablename_info_tlv(struct stream *s, struct bmp *bmp)
+{
+
+#define BMP_INFO_TYPE_VRFTABLENAME 3
+ char *vrftablename = "global";
+ if (bmp->targets->bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT) {
+ struct vrf *vrf = vrf_lookup_by_id(bmp->targets->bgp->vrf_id);
+ vrftablename = vrf ? vrf->name : NULL;
+ }
+ if (vrftablename != NULL)
+ bmp_put_info_tlv(s, BMP_INFO_TYPE_VRFTABLENAME, vrftablename);
+}
+
static int bmp_send_initiation(struct bmp *bmp)
{
int len;