mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 11:44:16 +00:00
lib, bgpd: Disallow processing of duplicate config.
This fix aims to reduce the load on BGPD when certain exisiting configurations are replayed. Specifically, the fix prevents BGPD from processing routes when the following already existing configurations are replayed: 1) A match criteria is configured within a route-map. 2) When "call" is invoked within a route-map. 3) When a route-map is tied to a BGP neighbor. Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
This commit is contained in:
parent
0f8cf61ae6
commit
1dc02a55bc
@ -6186,8 +6186,15 @@ int peer_route_map_set(struct peer *peer, afi_t afi, safi_t safi, int direct,
|
|||||||
|
|
||||||
/* Set configuration on peer. */
|
/* Set configuration on peer. */
|
||||||
filter = &peer->filter[afi][safi];
|
filter = &peer->filter[afi][safi];
|
||||||
if (filter->map[direct].name)
|
if (filter->map[direct].name) {
|
||||||
|
/* If the neighbor is configured with the same route-map
|
||||||
|
* again then, ignore the duplicate configuration.
|
||||||
|
*/
|
||||||
|
if (strcmp(filter->map[direct].name, name) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
XFREE(MTYPE_BGP_FILTER_NAME, filter->map[direct].name);
|
XFREE(MTYPE_BGP_FILTER_NAME, filter->map[direct].name);
|
||||||
|
}
|
||||||
route_map_counter_decrement(filter->map[direct].map);
|
route_map_counter_decrement(filter->map[direct].map);
|
||||||
filter->map[direct].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, name);
|
filter->map[direct].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, name);
|
||||||
filter->map[direct].map = route_map;
|
filter->map[direct].map = route_map;
|
||||||
|
@ -1308,6 +1308,16 @@ int route_map_add_match(struct route_map_index *index, const char *match_name,
|
|||||||
for (rule = index->match_list.head; rule; rule = next) {
|
for (rule = index->match_list.head; rule; rule = next) {
|
||||||
next = rule->next;
|
next = rule->next;
|
||||||
if (rule->cmd == cmd) {
|
if (rule->cmd == cmd) {
|
||||||
|
/* If the configured route-map match rule is exactly
|
||||||
|
* the same as the existing configuration then,
|
||||||
|
* ignore the duplicate configuration.
|
||||||
|
*/
|
||||||
|
if (strcmp(match_arg, rule->rule_str) == 0) {
|
||||||
|
if (cmd->func_free)
|
||||||
|
(*cmd->func_free)(compile);
|
||||||
|
return RMAP_COMPILE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
route_map_rule_delete(&index->match_list, rule);
|
route_map_rule_delete(&index->match_list, rule);
|
||||||
replaced = 1;
|
replaced = 1;
|
||||||
}
|
}
|
||||||
@ -2805,6 +2815,13 @@ DEFUN (rmap_call,
|
|||||||
|
|
||||||
assert(index);
|
assert(index);
|
||||||
|
|
||||||
|
/* If "call" is invoked with the same route-map name as
|
||||||
|
* the one previously configured then, ignore the duplicate
|
||||||
|
* configuration.
|
||||||
|
*/
|
||||||
|
if (index->nextrm && (strcmp(index->nextrm, rmap) == 0))
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
if (index->nextrm) {
|
if (index->nextrm) {
|
||||||
route_map_upd8_dependency(RMAP_EVENT_CALL_DELETED,
|
route_map_upd8_dependency(RMAP_EVENT_CALL_DELETED,
|
||||||
index->nextrm, index->map->name);
|
index->nextrm, index->map->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user