]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_top.h
Merge pull request #9644 from opensourcerouting/ospf-opaque-attrs
[mirror_frr.git] / ospf6d / ospf6_top.h
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
3 *
4 * This file is part of GNU Zebra.
5 *
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
9 * later version.
10 *
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.
15 *
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
19 */
20
21 #ifndef OSPF6_TOP_H
22 #define OSPF6_TOP_H
23
24 #include "qobj.h"
25 #include "routemap.h"
26 struct ospf6_master {
27
28 /* OSPFv3 instance. */
29 struct list *ospf6;
30 /* OSPFv3 thread master. */
31 struct thread_master *master;
32 };
33
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),
38 };
39
40 /* For processing route-map change update in the callback */
41 #define OSPF6_IS_RMAP_CHANGED 0x01
42 struct ospf6_redist {
43 uint8_t instance;
44
45 uint8_t flag;
46 /* Redistribute metric info. */
47 struct {
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.
51 */
52 } dmetric;
53
54 /* For redistribute route map. */
55 struct {
56 char *name;
57 struct route_map *map;
58 } route_map;
59 #define ROUTEMAP_NAME(R) (R->route_map.name)
60 #define ROUTEMAP(R) (R->route_map.map)
61 };
62
63 struct ospf6_gr_info {
64 bool restart_support;
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;
70 };
71
72 struct ospf6_gr_helper {
73 /* Gracefull restart Helper supported configs*/
74 /* Supported grace interval*/
75 uint32_t supported_grace_time;
76
77 /* Helper support
78 * Supported : True
79 * Not Supported : False.
80 */
81 bool is_helper_supported;
82
83 /* Support for strict LSA check.
84 * if it is set,Helper aborted
85 * upon a TOPO change.
86 */
87 bool strict_lsa_check;
88
89 /* Support as HELPER only for
90 * planned restarts.
91 */
92 bool only_planned_restart;
93
94 /* This list contains the advertisement
95 * routerids for which Helper support is
96 * enabled.
97 */
98 struct hash *enable_rtr_list;
99
100 /* HELPER for number of active
101 * RESTARTERs.
102 */
103 int active_restarter_cnt;
104
105 /* last HELPER exit reason */
106 uint32_t last_exit_reason;
107 };
108
109 /* OSPFv3 top level data structure */
110 struct ospf6 {
111 /* The relevant vrf_id */
112 vrf_id_t vrf_id;
113
114 char *name; /* VRF name */
115
116 /* my router id */
117 in_addr_t router_id;
118
119 /* static router id */
120 in_addr_t router_id_static;
121
122 in_addr_t router_id_zebra;
123
124 /* start time */
125 struct timeval starttime;
126
127 /* list of areas */
128 struct list *area_list;
129 struct ospf6_area *backbone;
130
131 /* AS scope link state database */
132 struct ospf6_lsdb *lsdb;
133 struct ospf6_lsdb *lsdb_self;
134
135 struct ospf6_route_table *route_table;
136 struct ospf6_route_table *brouter_table;
137
138 struct ospf6_route_table *external_table;
139 #define OSPF6_EXT_INIT_LS_ID 1
140 uint32_t external_id;
141
142 /* OSPF6 redistribute configuration */
143 struct list *redist[ZEBRA_ROUTE_MAX + 1];
144
145 /* NSSA default-information-originate */
146 struct {
147 /* # of NSSA areas requesting default information */
148 uint16_t refcnt;
149
150 /*
151 * Whether a default route known through non-OSPF protocol is
152 * present in the RIB.
153 */
154 bool status;
155 } nssa_default_import_check;
156
157 uint8_t flag;
158 #define OSPF6_FLAG_ABR 0x04
159 #define OSPF6_FLAG_ASBR 0x08
160
161 int redistribute; /* Num of redistributed protocols. */
162
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. */
171
172 /* SPF parameters */
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 */
176 unsigned int
177 spf_hold_multiplier; /* Adaptive multiplier for hold time */
178 unsigned int spf_reason; /* reason bits while scheduling SPF */
179
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 */
183
184 int fd;
185 /* Threads */
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;
194
195 int write_oi_count; /* Num of packets sent per thread invocation */
196 uint32_t ref_bandwidth;
197
198 /* Distance parameters */
199 uint8_t distance_all;
200 uint8_t distance_intra;
201 uint8_t distance_inter;
202 uint8_t distance_external;
203
204 struct route_table *distance_table;
205
206 /* Used during ospf instance going down send LSDB
207 * update to neighbors immediatly */
208 uint8_t inst_shutdown;
209
210 /* Max number of multiple paths
211 * to support ECMP.
212 */
213 uint16_t max_multipath;
214
215 /* OSPF Graceful Restart info (restarting mode) */
216 struct ospf6_gr_info gr_info;
217
218 /*ospf6 Graceful restart helper info */
219 struct ospf6_gr_helper ospf6_helper_cfg;
220
221 /* Count of NSSA areas */
222 uint8_t anyNSSA;
223 struct thread *t_abr_task; /* ABR task timer. */
224 struct list *oi_write_q;
225
226 uint32_t redist_count;
227
228 /* Action for aggregation of external LSAs */
229 int aggr_action;
230
231 #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
232 /* For ASBR summary delay timer */
233 int aggr_delay_interval;
234 /* Table of configured Aggregate addresses */
235 struct route_table *rt_aggr_tbl;
236
237 QOBJ_FIELDS;
238 };
239 DECLARE_QOBJ_TYPE(ospf6);
240
241 #define OSPF6_DISABLED 0x01
242 #define OSPF6_STUB_ROUTER 0x02
243
244 /* global pointer for OSPF top data structure */
245 extern struct ospf6 *ospf6;
246 extern struct ospf6_master *om6;
247
248 /* prototypes */
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);
254
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 */