]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: GR Helper functionality changes
authorrgirada <rgirada@vmware.com>
Sat, 22 Aug 2020 12:08:01 +0000 (05:08 -0700)
committerrgirada <rgirada@vmware.com>
Tue, 22 Sep 2020 07:02:37 +0000 (00:02 -0700)
Description:
1. Skipping inactivity timer during  graceful restart to make
   the RESTARTER active even after dead timer expiry.
2. Handling HELPER on unplanned outages.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
ospfd/ospf_nsm.c
ospfd/ospf_packet.c

index 03277ae61c43160c3675eb3b1b29f5da41108ce8..2931831826cce836abb624082dc556e663eed101 100644 (file)
@@ -70,7 +70,15 @@ static int ospf_inactivity_timer(struct thread *thread)
                           IF_NAME(nbr->oi), inet_ntoa(nbr->router_id),
                           ospf_get_name(nbr->oi->ospf));
 
-       OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_InactivityTimer);
+       /* Dont trigger NSM_InactivityTimer event , if the current
+        * router acting as HELPER for this neighbour.
+        */
+       if (!OSPF_GR_IS_ACTIVE_HELPER(nbr))
+               OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_InactivityTimer);
+       else if (IS_DEBUG_OSPF_GR_HELPER)
+               zlog_debug(
+                       "%s, Acting as HELPER for this neighbour, So inactivitytimer event will not be fired.",
+                       __PRETTY_FUNCTION__);
 
        return 0;
 }
@@ -689,7 +697,11 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
                                lookup_msg(ospf_nsm_state_msg, old_state, NULL),
                                lookup_msg(ospf_nsm_state_msg, state, NULL));
 
-               ospf_router_lsa_update_area(oi->area);
+               /* Dont originate router LSA if the current
+                * router is acting as a HELPER for this neighbour.
+                */
+               if (!OSPF_GR_IS_ACTIVE_HELPER(nbr))
+                       ospf_router_lsa_update_area(oi->area);
 
                if (oi->type == OSPF_IFTYPE_VIRTUALLINK) {
                        vl_area = ospf_area_lookup_by_area_id(
@@ -699,15 +711,21 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
                                ospf_router_lsa_update_area(vl_area);
                }
 
-               /* Originate network-LSA. */
-               if (oi->state == ISM_DR) {
-                       if (oi->network_lsa_self && oi->full_nbrs == 0) {
-                               ospf_lsa_flush_area(oi->network_lsa_self,
-                                                   oi->area);
-                               ospf_lsa_unlock(&oi->network_lsa_self);
-                               oi->network_lsa_self = NULL;
-                       } else
-                               ospf_network_lsa_update(oi);
+               /* Dont originate/flush network LSA if the current
+                * router is acting as a HELPER for this neighbour.
+                */
+               if (!OSPF_GR_IS_ACTIVE_HELPER(nbr)) {
+                       /* Originate network-LSA. */
+                       if (oi->state == ISM_DR) {
+                               if (oi->network_lsa_self
+                                   && oi->full_nbrs == 0) {
+                                       ospf_lsa_flush_area(
+                                               oi->network_lsa_self, oi->area);
+                                       ospf_lsa_unlock(&oi->network_lsa_self);
+                                       oi->network_lsa_self = NULL;
+                               } else
+                                       ospf_network_lsa_update(oi);
+                       }
                }
        }
 
index 61aae695b3baa7c0086f38dbbb539a9dad5b3d0e..160982a23866ef563d745ce491fd403aa4e022b6 100644 (file)
@@ -54,6 +54,7 @@
 #include "ospfd/ospf_dump.h"
 #include "ospfd/ospf_errors.h"
 #include "ospfd/ospf_zebra.h"
+#include "ospfd/ospf_gr_helper.h"
 
 /*
  * OSPF Fragmentation / fragmented writes
@@ -1058,7 +1059,16 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
                OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_TwoWayReceived);
                nbr->options |= hello->options;
        } else {
-               OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_OneWayReceived);
+               /* If the router is DR_OTHER, RESTARTER will not wait
+                * until it receives the hello from it if it receives
+                * from DR and BDR.
+                * So, helper might receives ONW_WAY hello from
+                * RESTARTER. So not allowing to change the state if it
+                * receives one_way hellow when it acts as HELPER for
+                * that specific neighbor.
+                */
+               if (!OSPF_GR_IS_ACTIVE_HELPER(nbr))
+                       OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_OneWayReceived);
                /* Set neighbor information. */
                nbr->priority = hello->priority;
                nbr->d_router = hello->d_router;
@@ -4262,6 +4272,12 @@ void ospf_ls_ack_send(struct ospf_neighbor *nbr, struct ospf_lsa *lsa)
 {
        struct ospf_interface *oi = nbr->oi;
 
+       if (IS_GRACE_LSA(lsa)) {
+               if (IS_DEBUG_OSPF_GR_HELPER)
+                       zlog_debug("%s, Sending GRACE ACK to Restarter.",
+                                  __PRETTY_FUNCTION__);
+       }
+
        if (listcount(oi->ls_ack_direct.ls_ack) == 0)
                oi->ls_ack_direct.dst = nbr->address.u.prefix4;