summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuele Di Pascale <emanuele@voltanet.io>2020-07-03 16:55:28 +0200
committerEmanuele Di Pascale <emanuele@voltanet.io>2020-07-06 10:17:57 +0200
commit75750ccfce46b1cff072427a4f8ee94e5c95a885 (patch)
treef8cf62ee93e806408224bab1f243d0c8f6cd97ae
parentMerge pull request #6628 from adharkar/frr-master-evpn_rt (diff)
downloadfrr-75750ccfce46b1cff072427a4f8ee94e5c95a885.tar.xz
frr-75750ccfce46b1cff072427a4f8ee94e5c95a885.zip
isisd: gracefully handle spf error
the code in isis_spf_add2tent was asserting in case the vertex we were trying to add was already present in the path or tent trees. This however CAN happen if the user accidentally configures the system Id of the area to the same value of an estabished neighbor. Handle this more gracefully by logging and returning, to prevent crashes. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
-rw-r--r--isisd/isis_spf.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index daf97859f..dfcea9a92 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -373,12 +373,25 @@ static struct isis_vertex *isis_spf_add2tent(struct isis_spftree *spftree,
struct isis_vertex *vertex;
struct listnode *node;
struct isis_adjacency *parent_adj;
-#ifdef EXTREME_DEBUG
char buff[VID2STR_BUFFER];
-#endif
- assert(isis_find_vertex(&spftree->paths, id, vtype) == NULL);
- assert(isis_find_vertex(&spftree->tents, id, vtype) == NULL);
+ vertex = isis_find_vertex(&spftree->paths, id, vtype);
+ if (vertex != NULL) {
+ zlog_err(
+ "%s: vertex %s of type %s already in PATH; check for sysId collisions with established neighbors",
+ __func__, vid2string(vertex, buff, sizeof(buff)),
+ vtype2string(vertex->type));
+ return NULL;
+ }
+ vertex = isis_find_vertex(&spftree->tents, id, vtype);
+ if (vertex != NULL) {
+ zlog_err(
+ "%s: vertex %s of type %s already in TENT; check for sysId collisions with established neighbors",
+ __func__, vid2string(vertex, buff, sizeof(buff)),
+ vtype2string(vertex->type));
+ return NULL;
+ }
+
vertex = isis_vertex_new(spftree, id, vtype);
vertex->d_N = cost;
vertex->depth = depth;