]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: Datastructure changes for OSPFv2 Flood reduction.
authorManoj Naragund <mnaragund@vmware.com>
Mon, 21 Nov 2022 10:32:53 +0000 (02:32 -0800)
committerManoj Naragund <mnaragund@vmware.com>
Fri, 20 Jan 2023 05:02:34 +0000 (21:02 -0800)
Description:
Code changes involve following things.
1. an additional structure containing flood reduction related info
           per area.
        2. a knob variable in the ospf structure for enabling/disabling the feature.
        3. initialization of above mentioned variables.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
ospfd/ospfd.c
ospfd/ospfd.h

index 023dc32a7b4fc028cb8d3d5545d1209c749c9508..b70f3ebddef40e9e64df372ad7f2d70bc476ad5a 100644 (file)
@@ -467,6 +467,8 @@ static struct ospf *ospf_new(unsigned short instance, const char *name)
         */
        ospf_gr_nvm_read(new);
 
+       new->fr_configured = false;
+
        return new;
 }
 
@@ -817,6 +819,7 @@ static void ospf_finish_final(struct ospf *ospf)
        THREAD_OFF(ospf->t_maxage);
        THREAD_OFF(ospf->t_maxage_walker);
        THREAD_OFF(ospf->t_abr_task);
+       THREAD_OFF(ospf->t_abr_fr);
        THREAD_OFF(ospf->t_asbr_check);
        THREAD_OFF(ospf->t_asbr_nssa_redist_update);
        THREAD_OFF(ospf->t_distribute_update);
@@ -962,6 +965,15 @@ struct ospf_area *ospf_area_new(struct ospf *ospf, struct in_addr area_id)
        /* Self-originated LSAs initialize. */
        new->router_lsa_self = NULL;
 
+       /* Initialize FR field */
+       new->fr_info.enabled = false;
+       new->fr_info.configured = false;
+       new->fr_info.state_changed = false;
+       new->fr_info.router_lsas_recv_dc_bit = 0;
+       new->fr_info.indication_lsa_self = NULL;
+       new->fr_info.area_ind_lsa_recvd = false;
+       new->fr_info.area_dc_clear = false;
+
        ospf_opaque_type10_lsa_init(new);
 
        new->oiflist = list_new();
index 3a43010f85f6faff7721114fcb2de3670a77b50a..f044a7e2179fccbda683835c20806437cd1633db 100644 (file)
@@ -116,7 +116,25 @@ struct ospf_redist {
                struct route_map *map;
        } route_map; /* +1 is for default-information */
 #define ROUTEMAP_NAME(R)   (R->route_map.name)
-#define ROUTEMAP(R)        (R->route_map.map)
+#define ROUTEMAP(R) (R->route_map.map)
+};
+
+/* OSPF area flood reduction info */
+struct ospf_area_fr_info {
+       bool enabled;       /* Area support for Flood Reduction */
+       bool configured;    /* Flood Reduction configured per area knob */
+       bool state_changed; /* flood reduction state change info */
+       int router_lsas_recv_dc_bit; /* Number of unique router lsas
+                                     * received with DC bit set.
+                                     * (excluding self)
+                                     */
+       bool area_ind_lsa_recvd;     /* Indication lsa received in this area */
+       bool area_dc_clear;       /* Area has atleast one lsa with dc bit 0(
+                                     * excluding indication lsa)
+                                     */
+       struct ospf_lsa *indication_lsa_self; /* Indication LSA generated
+                                              * in the area.
+                                              */
 };
 
 /* ospf->config */
@@ -255,6 +273,7 @@ struct ospf {
 
        /* Threads. */
        struct thread *t_abr_task;        /* ABR task timer. */
+       struct thread *t_abr_fr;          /* ABR FR timer. */
        struct thread *t_asbr_check;    /* ASBR check timer. */
        struct thread *t_asbr_nssa_redist_update; /* ASBR NSSA redistribution
                                                     update timer. */
@@ -406,6 +425,9 @@ struct ospf {
        bool ti_lfa_enabled;
        enum protection_type ti_lfa_protection_type;
 
+       /* Flood Reduction configuration state */
+       bool fr_configured;
+
        QOBJ_FIELDS;
 };
 DECLARE_QOBJ_TYPE(ospf);
@@ -591,6 +613,8 @@ struct ospf_area {
        uint32_t act_ints;  /* Active interfaces. */
        uint32_t full_nbrs; /* Fully adjacent neighbors. */
        uint32_t full_vls;  /* Fully adjacent virtual neighbors. */
+
+       struct ospf_area_fr_info fr_info; /* Flood reduction info. */
 };
 
 /* OSPF config network structure. */