bgpd: fix evpn path info get api

EVPN imported routes AF is not AF_EVPN, in that case
the path info extra with EVPN is nver created.
In order to create evpn info under path extra, define
new api which does not specifically check for AF_EVPN
afi type.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
This commit is contained in:
Chirag Shah 2025-01-06 18:57:54 -08:00
parent 6c7de02802
commit c358b92c9f
3 changed files with 15 additions and 1 deletions

View File

@ -4737,7 +4737,7 @@ bgp_evpn_path_nh_info_new(struct bgp_path_info *pi)
struct bgp_path_mh_info *mh_info;
struct bgp_path_evpn_nh_info *nh_info;
e = bgp_path_info_extra_get(pi);
e = bgp_evpn_path_info_extra_get(pi);
/* If mh_info doesn't exist allocate it */
mh_info = e->evpn->mh_info;

View File

@ -328,6 +328,19 @@ struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *pi)
return pi->extra;
}
/* Get bgp_path_info extra along with evpn information for the given bgp_path_info.
* This is used for EVPN imported routes like Type-5.
*/
struct bgp_path_info_extra *bgp_evpn_path_info_extra_get(struct bgp_path_info *pi)
{
if (!pi->extra)
pi->extra = bgp_path_info_extra_new();
if (!pi->extra->evpn)
pi->extra->evpn = XCALLOC(MTYPE_BGP_ROUTE_EXTRA_EVPN,
sizeof(struct bgp_path_info_extra_evpn));
return pi->extra;
}
bool bgp_path_info_has_valid_label(const struct bgp_path_info *path)
{
if (!BGP_PATH_INFO_NUM_LABELS(path))

View File

@ -801,6 +801,7 @@ extern void bgp_path_info_delete(struct bgp_dest *dest,
struct bgp_path_info *pi);
extern struct bgp_path_info_extra *
bgp_path_info_extra_get(struct bgp_path_info *path);
extern struct bgp_path_info_extra *bgp_evpn_path_info_extra_get(struct bgp_path_info *path);
extern bool bgp_path_info_has_valid_label(const struct bgp_path_info *path);
extern void bgp_path_info_set_flag(struct bgp_dest *dest,
struct bgp_path_info *path, uint32_t flag);