diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 17a01fa77e..5d34e292d0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1213,9 +1213,18 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, /* If one path has a label but the other does not, do not treat * them as equals for multipath */ - if ((new->extra &&bgp_is_valid_label(&new->extra->label[0])) - != (exist->extra - && bgp_is_valid_label(&exist->extra->label[0]))) { + int newl, existl; + + newl = existl = 0; + + if (new->extra) + newl = new->extra->num_labels; + if (exist->extra) + existl = exist->extra->num_labels; + if (((new->extra &&bgp_is_valid_label(&new->extra->label[0])) != + (exist->extra && + bgp_is_valid_label(&exist->extra->label[0]))) || + (newl != existl)) { if (debug) zlog_debug( "%s: %s and %s cannot be multipath, one has a label while the other does not",