summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-01-22 09:23:44 +0100
committerGitHub <noreply@github.com>2025-01-22 09:23:44 +0100
commitc6c570a7e64eb87fbb7c634487c0be02a6d5608b (patch)
tree79f999e464bb2430e39b6383db40b905b0b4e337
parentMerge pull request #17889 from louis-6wind/fix-rpki-table-version (diff)
parentbgpd: fix evpn path info get api (diff)
downloadfrr-c6c570a7e64eb87fbb7c634487c0be02a6d5608b.tar.xz
frr-c6c570a7e64eb87fbb7c634487c0be02a6d5608b.zip
Merge pull request #17899 from chiragshah6/evpn_dev1
bgpd: fix evpn path info get api
-rw-r--r--bgpd/bgp_evpn_mh.c2
-rw-r--r--bgpd/bgp_route.c13
-rw-r--r--bgpd/bgp_route.h1
3 files changed, 15 insertions, 1 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index ad3625242..b6ec8341a 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -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;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index a1b12e5a8..8b94892b3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -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))
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 7f4a3b918..c4cbbee0c 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -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);