1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2003 Yasuhiro Ohara
13 /* OSPFv3 instance. */
15 /* OSPFv3 thread master. */
16 struct thread_master
*master
;
19 /* ospf6->config_flags */
20 enum { OSPF6_LOG_ADJACENCY_CHANGES
= (1 << 0),
21 OSPF6_LOG_ADJACENCY_DETAIL
= (1 << 1),
22 OSPF6_SEND_EXTRA_DATA_TO_ZEBRA
= (1 << 2),
25 /* For processing route-map change update in the callback */
26 #define OSPF6_IS_RMAP_CHANGED 0x01
31 /* Redistribute metric info. */
33 int type
; /* External metric type (E1 or E2). */
34 int value
; /* Value for static metric (24-bit).
35 * -1 means metric value is not set.
39 /* For redistribute route map. */
42 struct route_map
*map
;
44 #define ROUTEMAP_NAME(R) (R->route_map.name)
45 #define ROUTEMAP(R) (R->route_map.map)
48 struct ospf6_gr_info
{
50 bool restart_in_progress
;
51 bool prepare_in_progress
;
52 bool finishing_restart
;
53 uint32_t grace_period
;
54 struct event
*t_grace_period
;
57 struct ospf6_gr_helper
{
58 /* Graceful restart Helper supported configs*/
59 /* Supported grace interval*/
60 uint32_t supported_grace_time
;
64 * Not Supported : False.
66 bool is_helper_supported
;
68 /* Support for strict LSA check.
69 * if it is set,Helper aborted
72 bool strict_lsa_check
;
74 /* Support as HELPER only for
77 bool only_planned_restart
;
79 /* This list contains the advertisement
80 * routerids for which Helper support is
83 struct hash
*enable_rtr_list
;
85 /* HELPER for number of active
88 int active_restarter_cnt
;
90 /* last HELPER exit reason */
91 uint32_t last_exit_reason
;
94 /* OSPFv3 top level data structure */
96 /* The relevant vrf_id */
99 char *name
; /* VRF name */
104 /* static router id */
105 in_addr_t router_id_static
;
107 in_addr_t router_id_zebra
;
110 struct timeval starttime
;
113 struct list
*area_list
;
114 struct ospf6_area
*backbone
;
116 /* AS scope link state database */
117 struct ospf6_lsdb
*lsdb
;
118 struct ospf6_lsdb
*lsdb_self
;
120 struct ospf6_route_table
*route_table
;
121 struct ospf6_route_table
*brouter_table
;
123 struct ospf6_route_table
*external_table
;
124 #define OSPF6_EXT_INIT_LS_ID 1
125 uint32_t external_id
;
127 /* OSPF6 redistribute configuration */
128 struct list
*redist
[ZEBRA_ROUTE_MAX
+ 1];
130 /* NSSA default-information-originate */
132 /* # of NSSA areas requesting default information */
136 * Whether a default route known through non-OSPF protocol is
137 * present in the RIB.
140 } nssa_default_import_check
;
143 #define OSPF6_FLAG_ABR 0x04
144 #define OSPF6_FLAG_ASBR 0x08
146 int redistribute
; /* Num of redistributed protocols. */
148 /* Configuration bitmask, refer to enum above */
149 uint8_t config_flags
;
150 int default_originate
; /* Default information originate. */
151 #define DEFAULT_ORIGINATE_NONE 0
152 #define DEFAULT_ORIGINATE_ZEBRA 1
153 #define DEFAULT_ORIGINATE_ALWAYS 2
154 /* LSA timer parameters */
155 unsigned int lsa_minarrival
; /* LSA minimum arrival in milliseconds. */
158 unsigned int spf_delay
; /* SPF delay time. */
159 unsigned int spf_holdtime
; /* SPF hold time. */
160 unsigned int spf_max_holdtime
; /* SPF maximum-holdtime */
162 spf_hold_multiplier
; /* Adaptive multiplier for hold time */
163 unsigned int spf_reason
; /* reason bits while scheduling SPF */
165 struct timeval ts_spf
; /* SPF calculation time stamp. */
166 struct timeval ts_spf_duration
; /* Execution time of last SPF */
167 unsigned int last_spf_reason
; /* Last SPF reason */
171 struct event
*t_spf_calc
; /* SPF calculation timer. */
172 struct event
*t_ase_calc
; /* ASE calculation timer. */
173 struct event
*maxage_remover
;
174 struct event
*t_distribute_update
; /* Distirbute update timer. */
175 struct event
*t_ospf6_receive
; /* OSPF6 receive timer */
176 struct event
*t_external_aggr
; /* OSPF6 aggregation timer */
177 #define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
178 struct event
*t_write
;
180 int write_oi_count
; /* Num of packets sent per thread invocation */
181 uint32_t ref_bandwidth
;
183 /* Distance parameters */
184 uint8_t distance_all
;
185 uint8_t distance_intra
;
186 uint8_t distance_inter
;
187 uint8_t distance_external
;
189 struct route_table
*distance_table
;
191 /* Used during ospf instance going down send LSDB
192 * update to neighbors immediatly */
193 uint8_t inst_shutdown
;
195 /* Max number of multiple paths
198 uint16_t max_multipath
;
200 /* OSPF Graceful Restart info (restarting mode) */
201 struct ospf6_gr_info gr_info
;
203 /*ospf6 Graceful restart helper info */
204 struct ospf6_gr_helper ospf6_helper_cfg
;
206 /* Count of NSSA areas */
208 struct event
*t_abr_task
; /* ABR task timer. */
209 struct list
*oi_write_q
;
211 uint32_t redist_count
;
213 /* Action for aggregation of external LSAs */
216 uint32_t seqnum_l
; /* lower order Sequence Number */
217 uint32_t seqnum_h
; /* higher order Sequence Number */
218 #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
219 /* For ASBR summary delay timer */
220 uint16_t aggr_delay_interval
;
221 /* Table of configured Aggregate addresses */
222 struct route_table
*rt_aggr_tbl
;
226 DECLARE_QOBJ_TYPE(ospf6
);
228 #define OSPF6_DISABLED 0x01
229 #define OSPF6_STUB_ROUTER 0x02
231 /* global pointer for OSPF top data structure */
232 extern struct ospf6
*ospf6
;
233 extern struct ospf6_master
*om6
;
236 extern void ospf6_master_init(struct thread_master
*master
);
237 extern void install_element_ospf6_clear_process(void);
238 extern void ospf6_top_init(void);
239 extern void ospf6_delete(struct ospf6
*o
);
240 extern bool ospf6_router_id_update(struct ospf6
*ospf6
, bool init
);
241 void ospf6_restart_spf(struct ospf6
*ospf6
);
243 extern void ospf6_maxage_remove(struct ospf6
*o
);
244 extern struct ospf6
*ospf6_instance_create(const char *name
);
245 void ospf6_vrf_link(struct ospf6
*ospf6
, struct vrf
*vrf
);
246 void ospf6_vrf_unlink(struct ospf6
*ospf6
, struct vrf
*vrf
);
247 struct ospf6
*ospf6_lookup_by_vrf_id(vrf_id_t vrf_id
);
248 struct ospf6
*ospf6_lookup_by_vrf_name(const char *name
);
249 const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id
);
250 void ospf6_vrf_init(void);
251 bool ospf6_is_valid_summary_addr(struct vty
*vty
, struct prefix
*p
);
252 #endif /* OSPF6_TOP_H */