]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospfd.h
Merge pull request #12366 from manojvn/ospfv2-flood-reduction
[mirror_frr.git] / ospfd / ospfd.h
index 76501dd6bbce8ddcb8779d54630d767f07ea9d26..4df65ea759d65889cd3ca943ab9bbf7e8b39f4d3 100644 (file)
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * OSPFd main header.
  * Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _ZEBRA_OSPFD_H
@@ -116,7 +101,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 +258,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. */
@@ -313,6 +317,7 @@ struct ospf {
        time_t lsa_refresher_started;
 #define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10
        uint16_t lsa_refresh_interval;
+       uint16_t lsa_refresh_timer;
 
        /* Distance parameter. */
        uint8_t distance_all;
@@ -405,6 +410,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);
@@ -590,6 +598,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. */
@@ -647,8 +657,6 @@ struct ospf_nbr_nbma {
 #define OSPF_TIMER_ON(T,F,V) thread_add_timer (master,(F),ospf,(V),&(T))
 #define OSPF_AREA_TIMER_ON(T,F,V) thread_add_timer (master, (F), area, (V), &(T))
 #define OSPF_POLL_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr_nbma, (V), &(T))
-#define OSPF_POLL_TIMER_OFF(X) OSPF_TIMER_OFF((X))
-#define OSPF_TIMER_OFF(X) thread_cancel(&(X))
 
 /* Extern variables. */
 extern struct ospf_master *om;
@@ -661,7 +669,7 @@ extern struct zebra_privs_t ospfd_privs;
 
 /* Prototypes. */
 extern const char *ospf_redist_string(unsigned int route_type);
-extern struct ospf *ospf_lookup_instance(unsigned short);
+extern struct ospf *ospf_lookup_instance(unsigned short instance);
 extern struct ospf *ospf_lookup(unsigned short instance, const char *name);
 extern struct ospf *ospf_get(unsigned short instance, const char *name,
                             bool *created);
@@ -670,68 +678,82 @@ extern struct ospf *ospf_lookup_by_inst_name(unsigned short instance,
                                             const char *name);
 extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id);
 extern uint32_t ospf_count_area_params(struct ospf *ospf);
-extern void ospf_finish(struct ospf *);
+extern void ospf_finish(struct ospf *ospf);
 extern void ospf_process_refresh_data(struct ospf *ospf, bool reset);
 extern void ospf_router_id_update(struct ospf *ospf);
 extern void ospf_process_reset(struct ospf *ospf);
 extern void ospf_neighbor_reset(struct ospf *ospf, struct in_addr nbr_id,
                                const char *nbr_str);
-extern int ospf_network_set(struct ospf *, struct prefix_ipv4 *, struct in_addr,
-                           int);
-extern int ospf_network_unset(struct ospf *, struct prefix_ipv4 *,
-                             struct in_addr);
-extern int ospf_area_display_format_set(struct ospf *, struct ospf_area *area,
-                                       int df);
-extern int ospf_area_stub_set(struct ospf *, struct in_addr);
-extern int ospf_area_stub_unset(struct ospf *, struct in_addr);
-extern int ospf_area_no_summary_set(struct ospf *, struct in_addr);
-extern int ospf_area_no_summary_unset(struct ospf *, struct in_addr);
-extern int ospf_area_nssa_set(struct ospf *, struct in_addr);
-extern int ospf_area_nssa_unset(struct ospf *, struct in_addr, int);
+extern int ospf_network_set(struct ospf *ospf, struct prefix_ipv4 *p,
+                           struct in_addr area_id, int df);
+extern int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
+                             struct in_addr aread_id);
+extern int ospf_area_display_format_set(struct ospf *ospf,
+                                       struct ospf_area *area, int df);
+extern int ospf_area_stub_set(struct ospf *ospf, struct in_addr area_id);
+extern int ospf_area_stub_unset(struct ospf *ospf, struct in_addr area_id);
+extern int ospf_area_no_summary_set(struct ospf *ospf, struct in_addr area_id);
+extern int ospf_area_no_summary_unset(struct ospf *ospf,
+                                     struct in_addr area_id);
+extern int ospf_area_nssa_set(struct ospf *ospf, struct in_addr area_id);
+extern int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id,
+                               int argc);
 extern int ospf_area_nssa_suppress_fa_set(struct ospf *ospf,
                                          struct in_addr area_id);
 extern int ospf_area_nssa_suppress_fa_unset(struct ospf *ospf,
                                            struct in_addr area_id);
-extern int ospf_area_nssa_translator_role_set(struct ospf *, struct in_addr,
-                                             int);
-extern int ospf_area_export_list_set(struct ospf *, struct ospf_area *,
-                                    const char *);
-extern int ospf_area_export_list_unset(struct ospf *, struct ospf_area *);
-extern int ospf_area_import_list_set(struct ospf *, struct ospf_area *,
-                                    const char *);
-extern int ospf_area_import_list_unset(struct ospf *, struct ospf_area *);
-extern int ospf_area_shortcut_set(struct ospf *, struct ospf_area *, int);
-extern int ospf_area_shortcut_unset(struct ospf *, struct ospf_area *);
-extern int ospf_timers_refresh_set(struct ospf *, int);
-extern int ospf_timers_refresh_unset(struct ospf *);
+extern int ospf_area_nssa_translator_role_set(struct ospf *ospf,
+                                             struct in_addr area_id, int role);
+extern int ospf_area_export_list_set(struct ospf *ospf,
+                                    struct ospf_area *area_id,
+                                    const char *list_name);
+extern int ospf_area_export_list_unset(struct ospf *ospf,
+                                      struct ospf_area *area_id);
+extern int ospf_area_import_list_set(struct ospf *ospf,
+                                    struct ospf_area *area_id,
+                                    const char *name);
+extern int ospf_area_import_list_unset(struct ospf *ospf,
+                                      struct ospf_area *area_id);
+extern int ospf_area_shortcut_set(struct ospf *ospf, struct ospf_area *area_id,
+                                 int mode);
+extern int ospf_area_shortcut_unset(struct ospf *ospf,
+                                   struct ospf_area *area_id);
+extern int ospf_timers_refresh_set(struct ospf *ospf, int interval);
+extern int ospf_timers_refresh_unset(struct ospf *ospf);
 void ospf_area_lsdb_discard_delete(struct ospf_area *area);
-extern int ospf_nbr_nbma_set(struct ospf *, struct in_addr);
-extern int ospf_nbr_nbma_unset(struct ospf *, struct in_addr);
-extern int ospf_nbr_nbma_priority_set(struct ospf *, struct in_addr, uint8_t);
-extern int ospf_nbr_nbma_priority_unset(struct ospf *, struct in_addr);
-extern int ospf_nbr_nbma_poll_interval_set(struct ospf *, struct in_addr,
-                                          unsigned int);
-extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *, struct in_addr);
-extern void ospf_prefix_list_update(struct prefix_list *);
-extern void ospf_if_update(struct ospf *, struct interface *);
-extern void ospf_ls_upd_queue_empty(struct ospf_interface *);
+extern int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr);
+extern int ospf_nbr_nbma_unset(struct ospf *ospf, struct in_addr nbr_addr);
+extern int ospf_nbr_nbma_priority_set(struct ospf *ospf,
+                                     struct in_addr nbr_addr,
+                                     uint8_t priority);
+extern int ospf_nbr_nbma_priority_unset(struct ospf *ospf,
+                                       struct in_addr nbr_addr);
+extern int ospf_nbr_nbma_poll_interval_set(struct ospf *ospf,
+                                          struct in_addr nbr_addr,
+                                          unsigned int interval);
+extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *ospf,
+                                            struct in_addr addr);
+extern void ospf_if_update(struct ospf *ospf, struct interface *ifp);
+extern void ospf_ls_upd_queue_empty(struct ospf_interface *oi);
 extern void ospf_terminate(void);
-extern void ospf_nbr_nbma_if_update(struct ospf *, struct ospf_interface *);
-extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *,
-                                                 struct in_addr);
-extern int ospf_oi_count(struct interface *);
+extern void ospf_nbr_nbma_if_update(struct ospf *ospf,
+                                   struct ospf_interface *oi);
+extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *ospf,
+                                                 struct in_addr nbr_addr);
+extern int ospf_oi_count(struct interface *ifp);
 
 extern struct ospf_area *ospf_area_new(struct ospf *ospf,
                                       struct in_addr area_id);
-extern struct ospf_area *ospf_area_get(struct ospf *, struct in_addr);
-extern void ospf_area_check_free(struct ospf *, struct in_addr);
-extern struct ospf_area *ospf_area_lookup_by_area_id(struct ospf *,
-                                                    struct in_addr);
-extern void ospf_area_add_if(struct ospf_area *, struct ospf_interface *);
-extern void ospf_area_del_if(struct ospf_area *, struct ospf_interface *);
+extern struct ospf_area *ospf_area_get(struct ospf *ospf,
+                                      struct in_addr area_id);
+extern void ospf_area_check_free(struct ospf *ospf, struct in_addr area_id);
+extern struct ospf_area *ospf_area_lookup_by_area_id(struct ospf *ospf,
+                                                    struct in_addr area_id);
+extern void ospf_area_add_if(struct ospf_area *oa, struct ospf_interface *oi);
+extern void ospf_area_del_if(struct ospf_area *oa, struct ospf_interface *oi);
 
-extern void ospf_interface_area_set(struct ospf *, struct interface *);
-extern void ospf_interface_area_unset(struct ospf *, struct interface *);
+extern void ospf_interface_area_set(struct ospf *ospf, struct interface *ifp);
+extern void ospf_interface_area_unset(struct ospf *ospf, struct interface *ifp);
 
 extern void ospf_route_map_init(void);
 
@@ -741,7 +763,7 @@ extern void ospf_vrf_terminate(void);
 extern void ospf_vrf_link(struct ospf *ospf, struct vrf *vrf);
 extern void ospf_vrf_unlink(struct ospf *ospf, struct vrf *vrf);
 const char *ospf_vrf_id_to_name(vrf_id_t vrf_id);
-int ospf_area_nssa_no_summary_set(struct ospf *, struct in_addr);
+int ospf_area_nssa_no_summary_set(struct ospf *ospf, struct in_addr area_id);
 
 const char *ospf_get_name(const struct ospf *ospf);
 extern struct ospf_interface *add_ospf_interface(struct connected *co,