diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2020-12-18 14:38:40 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2020-12-18 14:40:20 -0500 |
| commit | 9149c63517c41681a6cf07e11e6b85f8458dffdb (patch) | |
| tree | 5273f65e2b90273bb19a7f9fe16de4493e90bf9b | |
| parent | 02e7a369b8356e79160d26c18798308c88b4d29d (diff) | |
lib: Add a warning for when we are not operating correctly
There exists a possibilty that route map dependencies
have gotten wrong. Prevent the crash and warn the user
that we may be in trouble.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
| -rw-r--r-- | lib/routemap.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/routemap.c b/lib/routemap.c index 5082a9fa9a..1c2f43d968 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -2767,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)); tmp_dep_data.rname = rname; 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; + } - if (dep_data->refcnt) - dep_data->refcnt--; + dep_data->refcnt--; if (!dep_data->refcnt) { ret_dep_data = hash_release(dep->dep_rmap_hash, |
