From 3aef92192569c33906c6a2623d0753c16c0e7a64 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 30 Aug 2016 08:59:08 -0400 Subject: [PATCH] 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 --- bgpd/bgp_attr.h | 2 ++ bgpd/bgp_routemap.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index a279674af2..9a8e2a75e2 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; } -- 2.39.5