summaryrefslogtreecommitdiff
path: root/ospfd/ospf_packet.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2023-03-01 17:31:56 -0300
committerRenato Westphal <renato@opensourcerouting.org>2023-03-02 19:38:03 -0300
commitcb1f47c2eb46c3ca7bd485c15fed024f31c50be6 (patch)
tree3597e37abb9aea4eff6516c695a7465418af8d69 /ospfd/ospf_packet.c
parent3d2533ed58d299b64505e055a824ab0396af9be4 (diff)
ospfd, ospf6d: perform GR consistency check only when necessary
The GR code should check for topology changes only upon the receipt of Router-LSAs and Network-LSAs. Other LSAs types don't affect the topology as far as a restarting router is concerned. This optimization reduces unnecessary computations when the restarting router receives thousands of inter-area LSAs or external LSAs while coming back up. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r--ospfd/ospf_packet.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 5268c9896b..2937c4ec0c 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -2102,6 +2102,14 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph,
if (ospf_flood(oi->ospf, nbr, current, lsa)
< 0) /* Trap NSSA later. */
DISCARD_LSA(lsa, 5);
+
+ /* GR: check for network topology change. */
+ if (ospf->gr_info.restart_in_progress &&
+ ((lsa->data->type == OSPF_ROUTER_LSA ||
+ lsa->data->type == OSPF_NETWORK_LSA)))
+ ospf_gr_check_lsdb_consistency(oi->ospf,
+ oi->area);
+
continue;
}
@@ -2214,9 +2222,6 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph,
assert(listcount(lsas) == 0);
list_delete(&lsas);
-
- if (ospf->gr_info.restart_in_progress)
- ospf_gr_check_lsdb_consistency(oi->ospf, oi->area);
}
/* OSPF Link State Acknowledgment message read -- RFC2328 Section 13.7. */