]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd, ospf6d: perform GR consistency check only when necessary 12922/head
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 1 Mar 2023 20:31:56 +0000 (17:31 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Thu, 2 Mar 2023 22:38:03 +0000 (19:38 -0300)
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>
ospf6d/ospf6_flood.c
ospfd/ospf_packet.c

index 2d2069566c60ec45689522a9b9d131333e785c4c..db1520ff20aab4408a354b0b5ecc6ce9df9120d5 100644 (file)
@@ -1105,9 +1105,12 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from,
                                         &new->refresh);
                }
 
+               /* GR: check for network topology change. */
                struct ospf6 *ospf6 = from->ospf6_if->area->ospf6;
                struct ospf6_area *area = from->ospf6_if->area;
-               if (ospf6->gr_info.restart_in_progress)
+               if (ospf6->gr_info.restart_in_progress &&
+                   (new->header->type == ntohs(OSPF6_LSTYPE_ROUTER) ||
+                    new->header->type == ntohs(OSPF6_LSTYPE_NETWORK)))
                        ospf6_gr_check_lsdb_consistency(ospf6, area);
 
                return;
index 5268c9896b470ca604214805fd882e5b7fa0d4dc..2937c4ec0c80596d2a7f76772ade6b54c1e17712 100644 (file)
@@ -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. */