]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: fix adj up->init transition
authorEmanuele Di Pascale <emanuele@voltanet.io>
Mon, 8 Jun 2020 16:00:42 +0000 (18:00 +0200)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 9 Jun 2020 20:56:43 +0000 (22:56 +0200)
there are some paths, e.g. when an established neighbor
sends us hellos with a different IS level, where we go
from adj_state UP to INIT. In such cases we might not
update our SPFs or the circuit state, as the state change
function was only testing for the UP and DOWN cases.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
isisd/isis_adjacency.c

index acfe3e2e1f7af52991782fa514d7116167be6b39..94e38435a33c81ee4d9d96f8d497ed9a0b5e2312 100644 (file)
@@ -268,10 +268,11 @@ void isis_adj_state_change(struct isis_adjacency **padj,
        struct isis_circuit *circuit = adj->circuit;
        bool del = false;
 
+       if (new_state == old_state)
+               return;
+
        adj->adj_state = new_state;
-       if (new_state != old_state) {
-               send_hello_sched(circuit, adj->level, TRIGGERED_IIH_DELAY);
-       }
+       send_hello_sched(circuit, adj->level, TRIGGERED_IIH_DELAY);
 
        if (isis->debugs & DEBUG_ADJ_PACKETS) {
                zlog_debug("ISIS-Adj (%s): Adjacency state change %d->%d: %s",
@@ -314,7 +315,7 @@ void isis_adj_state_change(struct isis_adjacency **padj,
                                 * purposes */
                                adj->last_flap = time(NULL);
                                adj->flaps++;
-                       } else if (new_state == ISIS_ADJ_DOWN) {
+                       } else if (old_state == ISIS_ADJ_UP) {
                                listnode_delete(circuit->u.bc.adjdb[level - 1],
                                                adj);
 
@@ -323,7 +324,8 @@ void isis_adj_state_change(struct isis_adjacency **padj,
                                        isis_tx_queue_clean(circuit->tx_queue);
 
                                hook_call(isis_adj_state_change_hook, adj);
-                               del = true;
+                               if (new_state == ISIS_ADJ_DOWN)
+                                       del = true;
                        }
 
                        if (circuit->u.bc.lan_neighs[level - 1]) {
@@ -362,7 +364,7 @@ void isis_adj_state_change(struct isis_adjacency **padj,
                                                         circuit, 0,
                                                         &circuit->t_send_csnp[1]);
                                }
-                       } else if (new_state == ISIS_ADJ_DOWN) {
+                       } else if (old_state == ISIS_ADJ_UP) {
                                if (adj->circuit->u.p2p.neighbor == adj)
                                        adj->circuit->u.p2p.neighbor = NULL;
                                circuit->upadjcount[level - 1]--;
@@ -370,7 +372,8 @@ void isis_adj_state_change(struct isis_adjacency **padj,
                                        isis_tx_queue_clean(circuit->tx_queue);
 
                                hook_call(isis_adj_state_change_hook, adj);
-                               del = true;
+                               if (new_state == ISIS_ADJ_DOWN)
+                                       del = true;
                        }
                }
        }