bgpd: For deterministic MED build a multipath set for each peer AS as the
first stage of the best path calculation. The second stage then
selects a winner from each peer AS's best path. In the second stage we
clear multipath set of the non-selected best paths via
bgp_mp_dmed_deselect(). Since the multipath set is already marked up
for the winning path, we don't call bgp_info_mpath_update() after the
second stage calculation.

* bgpd/bgp_mpath.c
  * bgp_mp_dmed_deselect(): New function to cleanup the multipath
    markup if a DMED selected path loses in stage 2 of the best path
    calculation
* bgpd/bgp_mpath.h
  * Add external declaration of bgp_mp_dmed_deselect()
* bgpd/bgp_route.c
  * bgp_best_selection(): If multipath is enabled, build up the mp_list
    for the current peer AS, and do the RIB markup the best path from
    that AS. In the second stage, clear the RIB markup for the DMED
    selected path if it is not selected as best. Only call
    bgp_info_mpath_update() in the second stage when not doing
    deterministic MED.
3 files changed