]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: check vertex type before checking its data
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 20 Nov 2020 22:26:45 +0000 (19:26 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 23 Nov 2020 18:22:36 +0000 (15:22 -0300)
vertex->N is an union whose "id" and "ip" fields are only valid
depending on the vertex type (IS adjacency or IP reachability
information). As such, add a vertex type check before consulting
vertex->N.id in order to prevent unexpected behavior from happening.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
isisd/isis_spf.c

index 19cacde4fe29ca64ac1a42d19da0f544f7d0e2ca..58b0cf2684da62967f32bdd8cc10d44902ed5a24 100644 (file)
@@ -1811,7 +1811,8 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue,
                "Vertex               Type         Metric Next-Hop             Interface Parent\n");
 
        for (ALL_QUEUE_ELEMENTS_RO(queue, node, vertex)) {
-               if (memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) {
+               if (VTYPE_IS(vertex->type)
+                   && memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) {
                        vty_out(vty, "%-20s %-12s %-6s",
                                print_sys_hostname(root_sysid), "", "");
                        vty_out(vty, "%-30s\n", "");