struct update_subgroup *subgrp = NULL;
enum route_map_cmd_result_t ret, prev_ret;
bool route_advertised = false;
- bool adv_withdrawn = false;
int adv_conditional = 0;
bgp = THREAD_ARG(t);
/* cmap (route-map attached to exist-map or
* non-exist-map) map validation
*/
- adv_withdrawn = false;
adv_conditional = 0;
ret = bgp_check_rmap_prefixes_in_bgp_table(table,
switch (ret) {
case RMAP_NOOP:
- if (prev_ret == RMAP_NOOP)
+ if (prev_ret == RMAP_NOOP) {
+ peer->advmap_info[afi][safi]
+ .config_change = false;
continue;
-
+ }
peer->advmap_info[afi][safi].cmap_prev_status =
ret;
- if (filter->advmap.status)
- continue;
- /* advertise previously withdrawn routes */
- adv_withdrawn = true;
break;
case RMAP_MATCH:
/* Handle configuration changes */
if (peer->advmap_info[afi][safi]
.config_change) {
- /* If configuration(ACL filetr prefixes)
- * is changed and if the advertise-map
- * filter previous status was withdraw
- * then we need to advertise the
- * previously withdrawn routes.
- * Nothing to do if the filter status
- * was advertise.
- */
- if ((prev_ret != RMAP_NOOP)
- && !filter->advmap.status)
- adv_withdrawn = true;
-
adv_conditional =
(filter->advmap.condition
== CONDITION_EXIST)
? NLRI
: WITHDRAW;
- peer->advmap_info[afi][safi]
- .config_change = false;
} else {
if (prev_ret != RMAP_MATCH)
adv_conditional =
/* Handle configuration changes */
if (peer->advmap_info[afi][safi]
.config_change) {
- /* If configuration(ACL filetr prefixes)
- * is changed and if the advertise-map
- * filter previous status was withdraw
- * then we need to advertise the
- * previously withdrawn routes.
- * Nothing to do if the filter status
- * was advertise.
- */
- if ((prev_ret != RMAP_NOOP)
- && !filter->advmap.status)
- adv_withdrawn = true;
-
adv_conditional =
(filter->advmap.condition
== CONDITION_EXIST)
? WITHDRAW
: NLRI;
- peer->advmap_info[afi][safi]
- .config_change = false;
} else {
if (prev_ret != RMAP_NOMATCH)
adv_conditional =
*/
ret = is_rmap_valid(filter->advmap.amap) ? RMAP_MATCH
: RMAP_NOOP;
- prev_ret =
- peer->advmap_info[afi][safi].amap_prev_status;
- if (ret == RMAP_NOOP) {
- if (prev_ret == RMAP_NOOP) {
- if (!adv_withdrawn)
- continue;
- /* Should not reach here. */
- }
- if (filter->advmap.status && !adv_withdrawn)
- continue;
- }
+ if ((ret == RMAP_NOOP) && (prev_ret == RMAP_NOOP))
+ continue;
/* Derive conditional advertisement status from
* condition and return value of condition-map
*/
}
- if (adv_withdrawn) {
+ /* Send regular update as per the existing policy.
+ * There is a change in route-map, match-rule, ACLs,
+ * or route-map filter configuration on the same peer.
+ */
+ if (peer->advmap_info[afi][safi].config_change) {
paf = peer_af_find(peer, afi, safi);
if (paf) {
update_subgroup_split_peer(paf, NULL);
subgroup_announce_table(
paf->subgroup, NULL);
}
+ peer->advmap_info[afi][safi].config_change =
+ false;
}
+
+ /* Send update as per the conditional advertisement */
if (adv_conditional) {
route_advertised = bgp_conditional_adv_routes(
peer, afi, safi, table,
if (filter->advmap.aname
&& (strcmp(rmap_name, filter->advmap.aname) == 0)) {
filter->advmap.amap = map;
- peer->advmap_info[afi][safi].config_change = true;
}
if (filter->advmap.cname
&& (strcmp(rmap_name, filter->advmap.cname) == 0)) {
filter->advmap.cmap = map;
- peer->advmap_info[afi][safi].config_change = true;
}
if (peer->default_rmap[afi][safi].name
&& (strcmp(rmap_name, peer->default_rmap[afi][safi].name) == 0))
peer->default_rmap[afi][safi].map = map;
+
+ /* Notify BGP conditional advertisement scanner percess */
+ peer->advmap_info[afi][safi].config_change = true;
}
static void bgp_route_map_update_peer_group(const char *rmap_name,