]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospfd.h
Merge pull request #3502 from donaldsharp/socket_to_me_baby
[mirror_frr.git] / ospfd / ospfd.h
index 4c5bb756f6e759731f33af69e76a785e294af44c..cbea033b7357a9ba0e9efa3fac3bac3a68318ee7 100644 (file)
@@ -81,7 +81,7 @@
 #define OSPF_LS_REFRESH_JITTER      60
 
 struct ospf_external {
-       u_short instance;
+       unsigned short instance;
        struct route_table *external_info;
 };
 
@@ -93,18 +93,13 @@ struct ospf_master {
        /* OSPF thread master. */
        struct thread_master *master;
 
-
-       /* Redistributed external information. */
-       struct list *external[ZEBRA_ROUTE_MAX + 1];
-#define EXTERNAL_INFO(E)      (E->external_info)
-
        /* Various OSPF global configuration. */
-       u_char options;
+       uint8_t options;
 #define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */
 };
 
 struct ospf_redist {
-       u_short instance;
+       unsigned short instance;
 
        /* Redistribute metric info. */
        struct {
@@ -126,25 +121,26 @@ struct ospf_redist {
 struct ospf {
        /* OSPF's running state based on the '[no] router ospf [<instance>]'
         * config. */
-       u_char oi_running;
+       uint8_t oi_running;
 
        /* OSPF instance ID  */
-       u_short instance;
+       unsigned short instance;
 
        /* OSPF Router ID. */
        struct in_addr router_id;       /* Configured automatically. */
        struct in_addr router_id_static; /* Configured manually. */
+       struct in_addr router_id_zebra;
 
-       vrf_id_t vrf_id;  /* VRF Id */
-       char *name;       /* VRF name */
+       vrf_id_t vrf_id; /* VRF Id */
+       char *name;      /* VRF name */
 
        /* ABR/ASBR internal flags. */
-       u_char flags;
+       uint8_t flags;
 #define OSPF_FLAG_ABR           0x0001
 #define OSPF_FLAG_ASBR          0x0002
 
        /* ABR type. */
-       u_char abr_type;
+       uint8_t abr_type;
 #define OSPF_ABR_UNKNOWN       0
 #define OSPF_ABR_STAND          1
 #define OSPF_ABR_IBM            2
@@ -153,26 +149,24 @@ struct ospf {
 #define OSPF_ABR_DEFAULT       OSPF_ABR_CISCO
 
        /* NSSA ABR */
-       u_char anyNSSA; /* Bump for every NSSA attached. */
+       uint8_t anyNSSA; /* Bump for every NSSA attached. */
 
        /* Configured variables. */
-       u_char config;
+       uint8_t config;
 #define OSPF_RFC1583_COMPATIBLE         (1 << 0)
 #define OSPF_OPAQUE_CAPABLE            (1 << 2)
 #define OSPF_LOG_ADJACENCY_CHANGES     (1 << 3)
 #define OSPF_LOG_ADJACENCY_DETAIL      (1 << 4)
 
        /* Opaque-LSA administrative flags. */
-       u_char opaque;
+       uint8_t opaque;
 #define OPAQUE_OPERATION_READY_BIT     (1 << 0)
 
        /* RFC3137 stub router. Configured time to stay stub / max-metric */
        unsigned int stub_router_startup_time;  /* seconds */
        unsigned int stub_router_shutdown_time; /* seconds */
-                                               /* $FRR indent$ */
-                                               /* clang-format off */
 #define OSPF_STUB_ROUTER_UNCONFIGURED    0
-       u_char stub_router_admin_set;
+       uint8_t stub_router_admin_set;
 #define OSPF_STUB_ROUTER_ADMINISTRATIVE_SET     1
 #define OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET   0
 
@@ -191,12 +185,10 @@ struct ospf {
                spf_hold_multiplier; /* Adaptive multiplier for hold time */
 
        int default_originate;  /* Default information originate. */
-                                     /* $FRR indent$ */
-                                     /* clang-format off */
 #define DEFAULT_ORIGINATE_NONE         0
 #define DEFAULT_ORIGINATE_ZEBRA                1
 #define DEFAULT_ORIGINATE_ALWAYS       2
-       u_int32_t ref_bandwidth;      /* Reference Bandwidth (Kbps). */
+       uint32_t ref_bandwidth;       /* Reference Bandwidth (Kbps). */
        struct route_table *networks; /* OSPF config networks. */
        struct list *vlinks;      /* Configured Virtual-Links. */
        struct list *areas;        /* OSPF areas. */
@@ -204,7 +196,7 @@ struct ospf {
        struct ospf_area *backbone; /* Pointer to the Backbone Area. */
 
        struct list *oiflist;             /* ospf interfaces */
-       u_char passive_interface_default; /* passive-interface default */
+       uint8_t passive_interface_default; /* passive-interface default */
 
        /* LSDB of AS-external-LSAs. */
        struct ospf_lsdb *lsdb;
@@ -244,6 +236,7 @@ struct ospf {
        struct thread *t_external_lsa;      /* AS-external-LSA origin timer. */
        struct thread
                *t_opaque_lsa_self; /* Type-11 Opaque-LSAs origin event. */
+       struct thread *t_sr_update; /* Segment Routing update timer */
 
        unsigned int maxage_delay;      /* Delay on Maxage remover timer, sec */
        struct thread *t_maxage;        /* MaxAge LSA remover timer. */
@@ -283,32 +276,42 @@ struct ospf {
                 / OSPF_LSA_REFRESHER_GRANULARITY                              \
         + 1)
        struct {
-               u_int16_t index;
+               uint16_t index;
                struct list *qs[OSPF_LSA_REFRESHER_SLOTS];
        } lsa_refresh_queue;
 
        struct thread *t_lsa_refresher;
        time_t lsa_refresher_started;
 #define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10
-       u_int16_t lsa_refresh_interval;
+       uint16_t lsa_refresh_interval;
 
        /* Distance parameter. */
-       u_char distance_all;
-       u_char distance_intra;
-       u_char distance_inter;
-       u_char distance_external;
+       uint8_t distance_all;
+       uint8_t distance_intra;
+       uint8_t distance_inter;
+       uint8_t distance_external;
 
        /* Statistics for LSA origination. */
-       u_int32_t lsa_originate_count;
+       uint32_t lsa_originate_count;
 
        /* Statistics for LSA used for new instantiation. */
-       u_int32_t rx_lsa_count;
+       uint32_t rx_lsa_count;
 
-       /* Counter of "ip ospf area x.x.x.x" */
-       u_int32_t if_ospf_cli_count;
+       /* Counter of "ip ospf area x.x.x.x" used
+        * for multual exclusion of network command under
+        * router ospf or ip ospf area x under interface. */
+       uint32_t if_ospf_cli_count;
 
        struct route_table *distance_table;
 
+       /* Used during ospf instance going down send LSDB
+        * update to neighbors immediatly */
+       uint8_t inst_shutdown;
+
+       /* Redistributed external information. */
+       struct list *external[ZEBRA_ROUTE_MAX + 1];
+#define EXTERNAL_INFO(E)      (E->external_info)
+
        QOBJ_FIELDS
 };
 DECLARE_QOBJ_TYPE(ospf)
@@ -336,38 +339,30 @@ struct ospf_area {
        int external_routing;    /* ExternalRoutingCapability. */
        int no_summary;          /* Don't inject summaries into stub.*/
        int shortcut_configured; /* Area configured as shortcut. */
-                                /* $FRR indent$ */
-                                /* clang-format off */
 #define OSPF_SHORTCUT_DEFAULT  0
 #define OSPF_SHORTCUT_ENABLE   1
 #define OSPF_SHORTCUT_DISABLE  2
        int shortcut_capability; /* Other ABRs agree on S-bit */
-       u_int32_t default_cost;  /* StubDefaultCost. */
+       uint32_t default_cost;   /* StubDefaultCost. */
        int auth_type;           /* Authentication type. */
 
 
-       u_char NSSATranslatorRole;  /* NSSA configured role */
-                                   /* $FRR indent$ */
-                                   /* clang-format off */
+       uint8_t NSSATranslatorRole; /* NSSA configured role */
 #define OSPF_NSSA_ROLE_NEVER     0
 #define OSPF_NSSA_ROLE_CANDIDATE 1
 #define OSPF_NSSA_ROLE_ALWAYS    2
-       u_char NSSATranslatorState; /* NSSA operational role */
-                                   /* $FRR indent$ */
-                                   /* clang-format off */
+       uint8_t NSSATranslatorState; /* NSSA operational role */
 #define OSPF_NSSA_TRANSLATE_DISABLED 0
 #define OSPF_NSSA_TRANSLATE_ENABLED  1
        int NSSATranslatorStabilityInterval;
 
-       u_char transit;             /* TransitCapability. */
-                                   /* $FRR indent$ */
-                                   /* clang-format off */
+       uint8_t transit; /* TransitCapability. */
 #define OSPF_TRANSIT_FALSE      0
 #define OSPF_TRANSIT_TRUE       1
        struct route_table *ranges; /* Configured Area Ranges. */
 
        /* RFC3137 stub router state flags for area */
-       u_char stub_router_state;
+       uint8_t stub_router_state;
 #define OSPF_AREA_ADMIN_STUB_ROUTED    (1 << 0) /* admin stub-router set */
 #define OSPF_AREA_IS_STUB_ROUTED       (1 << 1) /* stub-router active */
 #define OSPF_AREA_WAS_START_STUB_ROUTED        (1 << 2) /* startup SR was done */
@@ -417,19 +412,19 @@ struct ospf_area {
        struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */
 
        /* Statistics field. */
-       u_int32_t spf_calculation; /* SPF Calculation Count. */
+       uint32_t spf_calculation; /* SPF Calculation Count. */
 
        /* Time stamps. */
        struct timeval ts_spf; /* SPF calculation time stamp. */
 
        /* Router count. */
-       u_int32_t abr_count;  /* ABR router in this area. */
-       u_int32_t asbr_count; /* ASBR router in this area. */
+       uint32_t abr_count;  /* ABR router in this area. */
+       uint32_t asbr_count; /* ASBR router in this area. */
 
        /* Counters. */
-       u_int32_t act_ints;  /* Active interfaces. */
-       u_int32_t full_nbrs; /* Fully adjacent neighbors. */
-       u_int32_t full_vls;  /* Fully adjacent virtual neighbors. */
+       uint32_t act_ints;  /* Active interfaces. */
+       uint32_t full_nbrs; /* Fully adjacent neighbors. */
+       uint32_t full_vls;  /* Fully adjacent virtual neighbors. */
 };
 
 /* OSPF config network structure. */
@@ -451,16 +446,16 @@ struct ospf_nbr_nbma {
        struct ospf_neighbor *nbr;
 
        /* Neighbor priority. */
-       u_char priority;
+       uint8_t priority;
 
        /* Poll timer value. */
-       u_int32_t v_poll;
+       uint32_t v_poll;
 
        /* Poll timer thread. */
        struct thread *t_poll;
 
        /* State change. */
-       u_int32_t state_change;
+       uint32_t state_change;
 };
 
 /* Macro. */
@@ -505,11 +500,11 @@ extern int ospf_zlog;
 extern struct zebra_privs_t ospfd_privs;
 
 /* Prototypes. */
-extern const char *ospf_redist_string(u_int route_type);
-extern struct ospf *ospf_lookup_instance(u_short);
-extern struct ospf *ospf_get(u_short instance, const char *name);
-extern struct ospf *ospf_get_instance(u_short);
-extern struct ospf *ospf_lookup_by_inst_name(u_short instance,
+extern const char *ospf_redist_string(unsigned int route_type);
+extern struct ospf *ospf_lookup_instance(unsigned short);
+extern struct ospf *ospf_get(unsigned short instance, const char *name);
+extern struct ospf *ospf_get_instance(unsigned short);
+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 void ospf_finish(struct ospf *);
@@ -540,7 +535,7 @@ extern int ospf_timers_refresh_set(struct ospf *, int);
 extern int ospf_timers_refresh_unset(struct ospf *);
 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, u_char);
+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);
@@ -566,6 +561,8 @@ extern void ospf_area_del_if(struct ospf_area *, struct ospf_interface *);
 
 extern void ospf_interface_area_set(struct ospf *, struct interface *);
 extern void ospf_interface_area_unset(struct ospf *, struct interface *);
+extern bool ospf_interface_area_is_already_set(struct ospf *ospf,
+                                              struct interface *ifp);
 
 extern void ospf_route_map_init(void);