diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 15c1df8473..941bae4ff4 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -550,6 +550,7 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, bool same_esi; bool old_proxy; bool new_proxy; + bool new_origin, exist_origin; *paths_eq = 0; @@ -794,8 +795,12 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, * - BGP_ROUTE_AGGREGATE * - BGP_ROUTE_REDISTRIBUTE */ - if (!(new->sub_type == BGP_ROUTE_NORMAL || - new->sub_type == BGP_ROUTE_IMPORTED)) { + new_origin = !(new->sub_type == BGP_ROUTE_NORMAL || + new->sub_type == BGP_ROUTE_IMPORTED); + exist_origin = !(exist->sub_type == BGP_ROUTE_NORMAL || + exist->sub_type == BGP_ROUTE_IMPORTED); + + if (new_origin && !exist_origin) { *reason = bgp_path_selection_local_route; if (debug) zlog_debug( @@ -804,8 +809,7 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, return 1; } - if (!(exist->sub_type == BGP_ROUTE_NORMAL || - exist->sub_type == BGP_ROUTE_IMPORTED)) { + if (!new_origin && exist_origin) { *reason = bgp_path_selection_local_route; if (debug) zlog_debug(