]> git.proxmox.com Git - mirror_frr.git/commitdiff
isisd: gracefully handle spf error
authorEmanuele Di Pascale <emanuele@voltanet.io>
Fri, 3 Jul 2020 14:55:28 +0000 (16:55 +0200)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Mon, 6 Jul 2020 08:17:57 +0000 (10:17 +0200)
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>
isisd/isis_spf.c

index daf97859f8263e21f9c750ab39f22f9a4f4bcbac..dfcea9a9216fcaf951ed0100c8b282e196b4d9d9 100644 (file)
@@ -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;