forked from Mirror/frr
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>
This commit is contained in:
parent
f83857832f
commit
24f3d9ff1a
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue