From: root Date: Tue, 30 Aug 2016 12:59:08 +0000 (-0400) Subject: bgpd: Add fix for multiple set commands with prefer-global X-Git-Tag: frr-2.0-rc1~358 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b2e03f7a77ccbc19b014de588e8694f571545cd1;p=matthieu%2Ffrr.git bgpd: Add fix for multiple set commands with prefer-global In further testing, found that if there were multiple set commands in the route-map with one being prefer-global, the removal of the prefer-global was not recognized and reacted to correctly. This small addition includes that support Ticket: CM-11480 Signed-off-by: Don Slice Reviewed By: Donald Sharp Testing Done: Manual testing, bgp-min and bgp-smoke completed (cherry picked from commit 3aef92192569c33906c6a2623d0753c16c0e7a64) --- diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index b8cdfea137..0bf8c897de 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -148,6 +148,7 @@ struct attr #define BATTR_RMAP_NEXTHOP_UNCHANGED (1 << 3) #define BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED (1 << 4) #define BATTR_RMAP_IPV6_LL_NHOP_CHANGED (1 << 5) +#define BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED (1 << 6) /* Router Reflector related structure. */ struct cluster_list @@ -277,6 +278,7 @@ bgp_rmap_nhop_changed(u_int32_t out_rmap_flags, u_int32_t in_rmap_flags) CHECK_FLAG(out_rmap_flags, BATTR_RMAP_NEXTHOP_UNCHANGED) || CHECK_FLAG(out_rmap_flags, BATTR_RMAP_IPV4_NHOP_CHANGED) || CHECK_FLAG(out_rmap_flags, BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED) || + CHECK_FLAG(out_rmap_flags, BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED) || CHECK_FLAG(out_rmap_flags, BATTR_RMAP_IPV6_LL_NHOP_CHANGED) || CHECK_FLAG(in_rmap_flags, BATTR_RMAP_NEXTHOP_UNCHANGED)) ? 1 : 0); } diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 2a4d416633..e4fd730cf0 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2215,8 +2215,14 @@ route_set_ipv6_nexthop_prefer_global (void *rule, struct prefix *prefix, /* Set next hop preference to global */ bgp_info->attr->extra->mp_nexthop_prefer_global = TRUE; SET_FLAG(bgp_info->attr->rmap_change_flags, - BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED); + BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED); } + else + { + bgp_info->attr->extra->mp_nexthop_prefer_global = FALSE; + SET_FLAG(bgp_info->attr->rmap_change_flags, + BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED); + } } return RMAP_OKAY; }