From b156c65dc0a2587294c579bc7fa8cf45c8daea45 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 18 Jul 2018 07:35:23 +0300 Subject: [PATCH] Use metric for default-originate with route-map if applied Signed-off-by: Donatas Abraitis donatas.abraitis@gmail.com --- bgpd/bgp_updgrp_adv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index d555006571..594eec59eb 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -690,6 +690,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) aspath = attr.aspath; attr.local_pref = bgp->default_local_pref; + attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC); memset(&p, 0, sizeof(p)); p.family = afi2family(afi); @@ -724,6 +725,8 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) peer->default_rmap[afi][safi].map, &rn->p, RMAP_BGP, &info); + attr.med = info.attr->med; + /* The route map might have set attributes. If * we don't flush them * here, they will be leaked. */ -- 2.39.5