2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 /* OSPFv3 instance. */
30 /* OSPFv3 thread master. */
31 struct thread_master
*master
;
34 /* ospf6->config_flags */
35 enum { OSPF6_LOG_ADJACENCY_CHANGES
= (1 << 0),
36 OSPF6_LOG_ADJACENCY_DETAIL
= (1 << 1),
37 OSPF6_SEND_EXTRA_DATA_TO_ZEBRA
= (1 << 2),
40 /* For processing route-map change update in the callback */
41 #define OSPF6_IS_RMAP_CHANGED 0x01
46 /* Redistribute metric info. */
48 int type
; /* External metric type (E1 or E2). */
49 int value
; /* Value for static metric (24-bit).
50 * -1 means metric value is not set.
54 /* For redistribute route map. */
57 struct route_map
*map
;
59 #define ROUTEMAP_NAME(R) (R->route_map.name)
60 #define ROUTEMAP(R) (R->route_map.map)
63 struct ospf6_gr_info
{
65 bool restart_in_progress
;
66 bool prepare_in_progress
;
67 bool finishing_restart
;
68 uint32_t grace_period
;
69 struct thread
*t_grace_period
;
72 struct ospf6_gr_helper
{
73 /* Gracefull restart Helper supported configs*/
74 /* Supported grace interval*/
75 uint32_t supported_grace_time
;
79 * Not Supported : False.
81 bool is_helper_supported
;
83 /* Support for strict LSA check.
84 * if it is set,Helper aborted
87 bool strict_lsa_check
;
89 /* Support as HELPER only for
92 bool only_planned_restart
;
94 /* This list contains the advertisement
95 * routerids for which Helper support is
98 struct hash
*enable_rtr_list
;
100 /* HELPER for number of active
103 int active_restarter_cnt
;
105 /* last HELPER exit reason */
106 uint32_t last_exit_reason
;
109 /* OSPFv3 top level data structure */
111 /* The relevant vrf_id */
114 char *name
; /* VRF name */
119 /* static router id */
120 in_addr_t router_id_static
;
122 in_addr_t router_id_zebra
;
125 struct timeval starttime
;
128 struct list
*area_list
;
129 struct ospf6_area
*backbone
;
131 /* AS scope link state database */
132 struct ospf6_lsdb
*lsdb
;
133 struct ospf6_lsdb
*lsdb_self
;
135 struct ospf6_route_table
*route_table
;
136 struct ospf6_route_table
*brouter_table
;
138 struct ospf6_route_table
*external_table
;
139 #define OSPF6_EXT_INIT_LS_ID 1
140 uint32_t external_id
;
142 /* OSPF6 redistribute configuration */
143 struct list
*redist
[ZEBRA_ROUTE_MAX
+ 1];
145 /* NSSA default-information-originate */
147 /* # of NSSA areas requesting default information */
151 * Whether a default route known through non-OSPF protocol is
152 * present in the RIB.
155 } nssa_default_import_check
;
158 #define OSPF6_FLAG_ABR 0x04
159 #define OSPF6_FLAG_ASBR 0x08
161 int redistribute
; /* Num of redistributed protocols. */
163 /* Configuration bitmask, refer to enum above */
164 uint8_t config_flags
;
165 int default_originate
; /* Default information originate. */
166 #define DEFAULT_ORIGINATE_NONE 0
167 #define DEFAULT_ORIGINATE_ZEBRA 1
168 #define DEFAULT_ORIGINATE_ALWAYS 2
169 /* LSA timer parameters */
170 unsigned int lsa_minarrival
; /* LSA minimum arrival in milliseconds. */
173 unsigned int spf_delay
; /* SPF delay time. */
174 unsigned int spf_holdtime
; /* SPF hold time. */
175 unsigned int spf_max_holdtime
; /* SPF maximum-holdtime */
177 spf_hold_multiplier
; /* Adaptive multiplier for hold time */
178 unsigned int spf_reason
; /* reason bits while scheduling SPF */
180 struct timeval ts_spf
; /* SPF calculation time stamp. */
181 struct timeval ts_spf_duration
; /* Execution time of last SPF */
182 unsigned int last_spf_reason
; /* Last SPF reason */
186 struct thread
*t_spf_calc
; /* SPF calculation timer. */
187 struct thread
*t_ase_calc
; /* ASE calculation timer. */
188 struct thread
*maxage_remover
;
189 struct thread
*t_distribute_update
; /* Distirbute update timer. */
190 struct thread
*t_ospf6_receive
; /* OSPF6 receive timer */
191 struct thread
*t_external_aggr
; /* OSPF6 aggregation timer */
192 #define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
193 struct thread
*t_write
;
195 int write_oi_count
; /* Num of packets sent per thread invocation */
196 uint32_t ref_bandwidth
;
198 /* Distance parameters */
199 uint8_t distance_all
;
200 uint8_t distance_intra
;
201 uint8_t distance_inter
;
202 uint8_t distance_external
;
204 struct route_table
*distance_table
;
206 /* Used during ospf instance going down send LSDB
207 * update to neighbors immediatly */
208 uint8_t inst_shutdown
;
210 /* Max number of multiple paths
213 uint16_t max_multipath
;
215 /* OSPF Graceful Restart info (restarting mode) */
216 struct ospf6_gr_info gr_info
;
218 /*ospf6 Graceful restart helper info */
219 struct ospf6_gr_helper ospf6_helper_cfg
;
221 /* Count of NSSA areas */
223 struct thread
*t_abr_task
; /* ABR task timer. */
224 struct list
*oi_write_q
;
226 uint32_t redist_count
;
228 /* Action for aggregation of external LSAs */
231 #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
232 /* For ASBR summary delay timer */
233 uint16_t aggr_delay_interval
;
234 /* Table of configured Aggregate addresses */
235 struct route_table
*rt_aggr_tbl
;
239 DECLARE_QOBJ_TYPE(ospf6
);
241 #define OSPF6_DISABLED 0x01
242 #define OSPF6_STUB_ROUTER 0x02
244 /* global pointer for OSPF top data structure */
245 extern struct ospf6
*ospf6
;
246 extern struct ospf6_master
*om6
;
249 extern void ospf6_master_init(struct thread_master
*master
);
250 extern void install_element_ospf6_clear_process(void);
251 extern void ospf6_top_init(void);
252 extern void ospf6_delete(struct ospf6
*o
);
253 extern bool ospf6_router_id_update(struct ospf6
*ospf6
, bool init
);
255 extern void ospf6_maxage_remove(struct ospf6
*o
);
256 extern struct ospf6
*ospf6_instance_create(const char *name
);
257 void ospf6_vrf_link(struct ospf6
*ospf6
, struct vrf
*vrf
);
258 void ospf6_vrf_unlink(struct ospf6
*ospf6
, struct vrf
*vrf
);
259 struct ospf6
*ospf6_lookup_by_vrf_id(vrf_id_t vrf_id
);
260 struct ospf6
*ospf6_lookup_by_vrf_name(const char *name
);
261 const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id
);
262 void ospf6_vrf_init(void);
263 bool ospf6_is_valid_summary_addr(struct vty
*vty
, struct prefix
*p
);
264 #endif /* OSPF6_TOP_H */