summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_conditional_adv.c20
-rw-r--r--bgpd/bgp_vty.c14
-rw-r--r--bgpd/bgpd.c16
-rw-r--r--bgpd/bgpd.h2
4 files changed, 26 insertions, 26 deletions
diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c
index dd1510a678..9c2826fa13 100644
--- a/bgpd/bgp_conditional_adv.c
+++ b/bgpd/bgp_conditional_adv.c
@@ -100,7 +100,8 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
if (BGP_DEBUG(update, UPDATE_OUT))
zlog_debug("%s: %s routes to/from %s for %s", __func__,
- update_type == ADVERTISE ? "Advertise" : "Withdraw",
+ update_type == UPDATE_TYPE_ADVERTISE ? "Advertise"
+ : "Withdraw",
peer->host, get_afi_safi_str(afi, safi, false));
addpath_capable = bgp_addpath_encode_tx(peer, afi, safi);
@@ -133,7 +134,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
* on same peer, routes in advertise-map may not
* be advertised as expected.
*/
- if (update_type == ADVERTISE &&
+ if (update_type == UPDATE_TYPE_ADVERTISE &&
subgroup_announce_check(dest, pi, subgrp, dest_p,
&attr, &advmap_attr)) {
bgp_adj_out_set_subgroup(dest, subgrp, &attr,
@@ -248,12 +249,14 @@ static void bgp_conditional_adv_timer(struct thread *t)
*/
if (filter->advmap.condition == CONDITION_EXIST)
filter->advmap.update_type =
- (ret == RMAP_PERMITMATCH) ? ADVERTISE
- : WITHDRAW;
+ (ret == RMAP_PERMITMATCH)
+ ? UPDATE_TYPE_ADVERTISE
+ : UPDATE_TYPE_WITHDRAW;
else
filter->advmap.update_type =
- (ret == RMAP_PERMITMATCH) ? WITHDRAW
- : ADVERTISE;
+ (ret == RMAP_PERMITMATCH)
+ ? UPDATE_TYPE_WITHDRAW
+ : UPDATE_TYPE_ADVERTISE;
/* Send regular update as per the existing policy.
* There is a change in route-map, match-rule, ACLs,
@@ -312,8 +315,9 @@ void bgp_conditional_adv_enable(struct peer *peer, afi_t afi, safi_t safi)
}
/* Register for conditional routes polling timer */
- thread_add_timer(bm->master, bgp_conditional_adv_timer, bgp,
- bgp->condition_check_period, &bgp->t_condition_check);
+ if (!thread_is_scheduled(bgp->t_condition_check))
+ thread_add_timer(bm->master, bgp_conditional_adv_timer, bgp, 0,
+ &bgp->t_condition_check);
}
void bgp_conditional_adv_disable(struct peer *peer, afi_t afi, safi_t safi)
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 63b73bc583..19901792ea 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -12115,11 +12115,12 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
filter->advmap.cname);
json_object_string_add(json_advmap, "advertiseMap",
filter->advmap.aname);
- json_object_string_add(json_advmap, "advertiseStatus",
- filter->advmap.update_type
- == ADVERTISE
- ? "Advertise"
- : "Withdraw");
+ json_object_string_add(
+ json_advmap, "advertiseStatus",
+ filter->advmap.update_type ==
+ UPDATE_TYPE_ADVERTISE
+ ? "Advertise"
+ : "Withdraw");
json_object_object_add(json_addr, "advertiseMap",
json_advmap);
}
@@ -12429,7 +12430,8 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
filter->advmap.cname,
filter->advmap.amap ? "*" : "",
filter->advmap.aname,
- filter->advmap.update_type == ADVERTISE
+ filter->advmap.update_type ==
+ UPDATE_TYPE_ADVERTISE
? "Advertise"
: "Withdraw");
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index b6f2a294a6..0bfcf5163f 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7225,18 +7225,15 @@ static void peer_advertise_map_filter_update(struct peer *peer, afi_t afi,
/* Increment condition_filter_count and/or create timer. */
if (!filter_exists) {
- filter->advmap.update_type = ADVERTISE;
+ filter->advmap.update_type = UPDATE_TYPE_ADVERTISE;
bgp_conditional_adv_enable(peer, afi, safi);
}
+
+ /* Process peer route updates. */
+ peer_on_policy_change(peer, afi, safi, 1);
}
-/* Set advertise-map to the peer but do not process peer route updates here. *
- * Hold filter changes until the conditional routes polling thread is called *
- * AS we need to advertise/withdraw prefixes (in advertise-map) based on the *
- * condition (exist-map/non-exist-map) and routes(specified in condition-map) *
- * in BGP table. So do not call peer_on_policy_change() here, only create *
- * polling timer thread, update filters and increment condition_filter_count.
- */
+/* Set advertise-map to the peer. */
int peer_advertise_map_set(struct peer *peer, afi_t afi, safi_t safi,
const char *advertise_name,
struct route_map *advertise_map,
@@ -7316,7 +7313,6 @@ int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
__func__, peer->host,
get_afi_safi_str(afi, safi, false));
- peer_on_policy_change(peer, afi, safi, 1);
return 0;
}
@@ -7339,8 +7335,6 @@ int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
zlog_debug("%s: Send normal update to %s for %s ",
__func__, member->host,
get_afi_safi_str(afi, safi, false));
-
- peer_on_policy_change(member, afi, safi, 1);
}
return 0;
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index bc5f6cf6fd..7f3d240b8e 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -859,7 +859,7 @@ struct bgp_nexthop {
#define CONDITION_NON_EXIST false
#define CONDITION_EXIST true
-enum update_type { WITHDRAW, ADVERTISE };
+enum update_type { UPDATE_TYPE_WITHDRAW, UPDATE_TYPE_ADVERTISE };
#include "filter.h"