Enhance a function that permits knowing if two entries belong to the same multipath group.
Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com> --- bgpd/bgp_mpath.c | 15 +++++++++++++++ bgpd/bgp_mpath.h | 1 + 2 files changed, 16 insertions(+) diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 6465aad1d99a..87f3e1eab461 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -781,3 +781,18 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best, else bgp_attr_unintern (&new_attr); } + +/* returns 1 if ri is part of the mpath list from new_select */ +int bgp_is_mpath_entry(struct bgp_info *ri, struct bgp_info *curr) +{ + struct bgp_info *mpinfo; + + /* not a multipath entry */ + if(!curr || !curr->mpath) + return 0; + for (mpinfo = bgp_info_mpath_first (curr); mpinfo; + mpinfo = bgp_info_mpath_next (mpinfo)) + if(mpinfo == ri) + return 1; + return 0; +} diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 2a84d5e1e21b..2b3eaf51901f 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -78,5 +78,6 @@ extern struct bgp_info *bgp_info_mpath_next (struct bgp_info *); /* Accessors for multipath information */ extern u_int32_t bgp_info_mpath_count (struct bgp_info *); extern struct attr *bgp_info_mpath_attr (struct bgp_info *); +extern int bgp_is_mpath_entry(struct bgp_info *ri, struct bgp_info *curr); #endif /* _QUAGGA_BGP_MPATH_H */ -- 2.1.4 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev