mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 23:19:13 +00:00
Merge pull request #7768 from donaldsharp/route_map_opt
Route map dependency fix
This commit is contained in:
commit
1facc03e61
@ -1347,7 +1347,7 @@ enum rmap_compile_rets route_map_add_match(struct route_map_index *index,
|
|||||||
get_route_map_delete_event(type);
|
get_route_map_delete_event(type);
|
||||||
route_map_upd8_dependency(
|
route_map_upd8_dependency(
|
||||||
delete_rmap_event_type,
|
delete_rmap_event_type,
|
||||||
rule_key,
|
rule->rule_str,
|
||||||
index->map->name);
|
index->map->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2586,22 +2586,23 @@ static void route_map_clear_reference(struct hash_bucket *bucket, void *arg)
|
|||||||
struct route_map_dep *dep = bucket->data;
|
struct route_map_dep *dep = bucket->data;
|
||||||
struct route_map_dep_data *dep_data = NULL, tmp_dep_data;
|
struct route_map_dep_data *dep_data = NULL, tmp_dep_data;
|
||||||
|
|
||||||
if (arg) {
|
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data));
|
||||||
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data));
|
tmp_dep_data.rname = arg;
|
||||||
tmp_dep_data.rname = arg;
|
dep_data = hash_release(dep->dep_rmap_hash, &tmp_dep_data);
|
||||||
dep_data = hash_release(dep->dep_rmap_hash,
|
if (dep_data) {
|
||||||
&tmp_dep_data);
|
if (rmap_debug)
|
||||||
if (dep_data) {
|
zlog_debug("Clearing reference for %s to %s count: %d",
|
||||||
XFREE(MTYPE_ROUTE_MAP_NAME, dep_data->rname);
|
dep->dep_name, tmp_dep_data.rname,
|
||||||
XFREE(MTYPE_ROUTE_MAP_DEP_DATA, dep_data);
|
dep_data->refcnt);
|
||||||
}
|
|
||||||
if (!dep->dep_rmap_hash->count) {
|
XFREE(MTYPE_ROUTE_MAP_NAME, dep_data->rname);
|
||||||
dep = hash_release(dep->this_hash,
|
XFREE(MTYPE_ROUTE_MAP_DEP_DATA, dep_data);
|
||||||
(void *)dep->dep_name);
|
}
|
||||||
hash_free(dep->dep_rmap_hash);
|
if (!dep->dep_rmap_hash->count) {
|
||||||
XFREE(MTYPE_ROUTE_MAP_NAME, dep->dep_name);
|
dep = hash_release(dep->this_hash, (void *)dep->dep_name);
|
||||||
XFREE(MTYPE_ROUTE_MAP_DEP, dep);
|
hash_free(dep->dep_rmap_hash);
|
||||||
}
|
XFREE(MTYPE_ROUTE_MAP_NAME, dep->dep_name);
|
||||||
|
XFREE(MTYPE_ROUTE_MAP_DEP, dep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2609,6 +2610,9 @@ static void route_map_clear_all_references(char *rmap_name)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (rmap_debug)
|
||||||
|
zlog_debug("Clearing references for %s", rmap_name);
|
||||||
|
|
||||||
for (i = 1; i < ROUTE_MAP_DEP_MAX; i++) {
|
for (i = 1; i < ROUTE_MAP_DEP_MAX; i++) {
|
||||||
hash_iterate(route_map_dep_hash[i], route_map_clear_reference,
|
hash_iterate(route_map_dep_hash[i], route_map_clear_reference,
|
||||||
(void *)rmap_name);
|
(void *)rmap_name);
|
||||||
@ -2763,12 +2767,19 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
|
|||||||
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data));
|
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data));
|
||||||
tmp_dep_data.rname = rname;
|
tmp_dep_data.rname = rname;
|
||||||
dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data);
|
dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data);
|
||||||
|
/*
|
||||||
if (!dep_data)
|
* If dep_data is NULL then something has gone seriously
|
||||||
|
* wrong in route-map handling. Note it and prevent
|
||||||
|
* the crash.
|
||||||
|
*/
|
||||||
|
if (!dep_data) {
|
||||||
|
zlog_warn(
|
||||||
|
"route-map dependency for route-map %s: %s is not correct",
|
||||||
|
rmap_name, dep_name);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (dep_data->refcnt)
|
dep_data->refcnt--;
|
||||||
dep_data->refcnt--;
|
|
||||||
|
|
||||||
if (!dep_data->refcnt) {
|
if (!dep_data->refcnt) {
|
||||||
ret_dep_data = hash_release(dep->dep_rmap_hash,
|
ret_dep_data = hash_release(dep->dep_rmap_hash,
|
||||||
|
Loading…
Reference in New Issue
Block a user