]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
718e3744 | 2 | /* |
508e53e2 | 3 | * Copyright (C) 2003 Yasuhiro Ohara |
718e3744 | 4 | */ |
5 | ||
6 | #ifndef OSPF6_TOP_H | |
7 | #define OSPF6_TOP_H | |
8 | ||
ae19c240 | 9 | #include "qobj.h" |
718e3744 | 10 | #include "routemap.h" |
78c6ba61 CS |
11 | struct ospf6_master { |
12 | ||
beadc736 | 13 | /* OSPFv3 instance. */ |
14 | struct list *ospf6; | |
15 | /* OSPFv3 thread master. */ | |
cd9d0537 | 16 | struct event_loop *master; |
78c6ba61 CS |
17 | }; |
18 | ||
c572fbfe | 19 | /* ospf6->config_flags */ |
5b5d66c4 RW |
20 | enum { OSPF6_LOG_ADJACENCY_CHANGES = (1 << 0), |
21 | OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1), | |
22 | OSPF6_SEND_EXTRA_DATA_TO_ZEBRA = (1 << 2), | |
c572fbfe DL |
23 | }; |
24 | ||
2f43e34d MR |
25 | /* For processing route-map change update in the callback */ |
26 | #define OSPF6_IS_RMAP_CHANGED 0x01 | |
a069482f K |
27 | struct ospf6_redist { |
28 | uint8_t instance; | |
b19502d3 | 29 | |
2f43e34d | 30 | uint8_t flag; |
b19502d3 YR |
31 | /* Redistribute metric info. */ |
32 | struct { | |
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. | |
36 | */ | |
37 | } dmetric; | |
38 | ||
a069482f K |
39 | /* For redistribute route map. */ |
40 | struct { | |
41 | char *name; | |
42 | struct route_map *map; | |
43 | } route_map; | |
44 | #define ROUTEMAP_NAME(R) (R->route_map.name) | |
45 | #define ROUTEMAP(R) (R->route_map.map) | |
46 | }; | |
47 | ||
71165098 RW |
48 | struct ospf6_gr_info { |
49 | bool restart_support; | |
50 | bool restart_in_progress; | |
51 | bool prepare_in_progress; | |
52 | bool finishing_restart; | |
53 | uint32_t grace_period; | |
88b3d5e5 RW |
54 | int reason; |
55 | char *exit_reason; | |
e6685141 | 56 | struct event *t_grace_period; |
71165098 RW |
57 | }; |
58 | ||
91c169f7 | 59 | struct ospf6_gr_helper { |
17be83bf | 60 | /* Graceful restart Helper supported configs*/ |
91c169f7 | 61 | /* Supported grace interval*/ |
62 | uint32_t supported_grace_time; | |
63 | ||
64 | /* Helper support | |
65 | * Supported : True | |
66 | * Not Supported : False. | |
67 | */ | |
68 | bool is_helper_supported; | |
69 | ||
70 | /* Support for strict LSA check. | |
71 | * if it is set,Helper aborted | |
72 | * upon a TOPO change. | |
73 | */ | |
74 | bool strict_lsa_check; | |
75 | ||
76 | /* Support as HELPER only for | |
77 | * planned restarts. | |
78 | */ | |
79 | bool only_planned_restart; | |
80 | ||
81 | /* This list contains the advertisement | |
82 | * routerids for which Helper support is | |
83 | * enabled. | |
84 | */ | |
85 | struct hash *enable_rtr_list; | |
86 | ||
87 | /* HELPER for number of active | |
88 | * RESTARTERs. | |
89 | */ | |
90 | int active_restarter_cnt; | |
91 | ||
92 | /* last HELPER exit reason */ | |
93 | uint32_t last_exit_reason; | |
94 | }; | |
95 | ||
508e53e2 | 96 | /* OSPFv3 top level data structure */ |
d62a17ae | 97 | struct ospf6 { |
cf319495 DS |
98 | /* The relevant vrf_id */ |
99 | vrf_id_t vrf_id; | |
100 | ||
7df1f362 K |
101 | char *name; /* VRF name */ |
102 | ||
d62a17ae | 103 | /* my router id */ |
858f9c08 | 104 | in_addr_t router_id; |
718e3744 | 105 | |
d62a17ae | 106 | /* static router id */ |
858f9c08 | 107 | in_addr_t router_id_static; |
c8a440ec | 108 | |
3c5122c5 | 109 | in_addr_t router_id_zebra; |
d6927cf3 | 110 | |
d62a17ae | 111 | /* start time */ |
112 | struct timeval starttime; | |
718e3744 | 113 | |
d62a17ae | 114 | /* list of areas */ |
115 | struct list *area_list; | |
116 | struct ospf6_area *backbone; | |
718e3744 | 117 | |
d62a17ae | 118 | /* AS scope link state database */ |
119 | struct ospf6_lsdb *lsdb; | |
120 | struct ospf6_lsdb *lsdb_self; | |
718e3744 | 121 | |
d62a17ae | 122 | struct ospf6_route_table *route_table; |
123 | struct ospf6_route_table *brouter_table; | |
508e53e2 | 124 | |
d62a17ae | 125 | struct ospf6_route_table *external_table; |
4dc43886 | 126 | #define OSPF6_EXT_INIT_LS_ID 1 |
d7c0a89a | 127 | uint32_t external_id; |
508e53e2 | 128 | |
a069482f | 129 | /* OSPF6 redistribute configuration */ |
b19502d3 | 130 | struct list *redist[ZEBRA_ROUTE_MAX + 1]; |
718e3744 | 131 | |
6735622c RW |
132 | /* NSSA default-information-originate */ |
133 | struct { | |
134 | /* # of NSSA areas requesting default information */ | |
135 | uint16_t refcnt; | |
136 | ||
137 | /* | |
138 | * Whether a default route known through non-OSPF protocol is | |
139 | * present in the RIB. | |
140 | */ | |
141 | bool status; | |
142 | } nssa_default_import_check; | |
143 | ||
d7c0a89a | 144 | uint8_t flag; |
ad500b22 K |
145 | #define OSPF6_FLAG_ABR 0x04 |
146 | #define OSPF6_FLAG_ASBR 0x08 | |
718e3744 | 147 | |
b8212e03 YR |
148 | int redistribute; /* Num of redistributed protocols. */ |
149 | ||
c572fbfe | 150 | /* Configuration bitmask, refer to enum above */ |
d7c0a89a | 151 | uint8_t config_flags; |
b19502d3 YR |
152 | int default_originate; /* Default information originate. */ |
153 | #define DEFAULT_ORIGINATE_NONE 0 | |
154 | #define DEFAULT_ORIGINATE_ZEBRA 1 | |
155 | #define DEFAULT_ORIGINATE_ALWAYS 2 | |
d62a17ae | 156 | /* LSA timer parameters */ |
157 | unsigned int lsa_minarrival; /* LSA minimum arrival in milliseconds. */ | |
b6927875 | 158 | |
d62a17ae | 159 | /* SPF parameters */ |
160 | unsigned int spf_delay; /* SPF delay time. */ | |
161 | unsigned int spf_holdtime; /* SPF hold time. */ | |
162 | unsigned int spf_max_holdtime; /* SPF maximum-holdtime */ | |
163 | unsigned int | |
164 | spf_hold_multiplier; /* Adaptive multiplier for hold time */ | |
165 | unsigned int spf_reason; /* reason bits while scheduling SPF */ | |
3810e06e | 166 | |
d62a17ae | 167 | struct timeval ts_spf; /* SPF calculation time stamp. */ |
168 | struct timeval ts_spf_duration; /* Execution time of last SPF */ | |
169 | unsigned int last_spf_reason; /* Last SPF reason */ | |
3810e06e | 170 | |
7df1f362 | 171 | int fd; |
d62a17ae | 172 | /* Threads */ |
e6685141 DS |
173 | struct event *t_spf_calc; /* SPF calculation timer. */ |
174 | struct event *t_ase_calc; /* ASE calculation timer. */ | |
175 | struct event *maxage_remover; | |
176 | struct event *t_distribute_update; /* Distirbute update timer. */ | |
177 | struct event *t_ospf6_receive; /* OSPF6 receive timer */ | |
178 | struct event *t_external_aggr; /* OSPF6 aggregation timer */ | |
3d968031 | 179 | #define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20 |
e6685141 | 180 | struct event *t_write; |
fd500689 | 181 | |
78156066 | 182 | int write_oi_count; /* Num of packets sent per thread invocation */ |
d7c0a89a | 183 | uint32_t ref_bandwidth; |
baff583e | 184 | |
d62a17ae | 185 | /* Distance parameters */ |
d7c0a89a QY |
186 | uint8_t distance_all; |
187 | uint8_t distance_intra; | |
188 | uint8_t distance_inter; | |
189 | uint8_t distance_external; | |
baff583e | 190 | |
d62a17ae | 191 | struct route_table *distance_table; |
ae19c240 | 192 | |
76249532 CS |
193 | /* Used during ospf instance going down send LSDB |
194 | * update to neighbors immediatly */ | |
195 | uint8_t inst_shutdown; | |
196 | ||
1958143e MR |
197 | /* Max number of multiple paths |
198 | * to support ECMP. | |
199 | */ | |
200 | uint16_t max_multipath; | |
91c169f7 | 201 | |
71165098 RW |
202 | /* OSPF Graceful Restart info (restarting mode) */ |
203 | struct ospf6_gr_info gr_info; | |
204 | ||
91c169f7 | 205 | /*ospf6 Graceful restart helper info */ |
206 | struct ospf6_gr_helper ospf6_helper_cfg; | |
207 | ||
ad500b22 K |
208 | /* Count of NSSA areas */ |
209 | uint8_t anyNSSA; | |
e6685141 | 210 | struct event *t_abr_task; /* ABR task timer. */ |
4f7bf1ab | 211 | struct list *oi_write_q; |
1958143e | 212 | |
ad500b22 | 213 | uint32_t redist_count; |
4dc43886 MR |
214 | |
215 | /* Action for aggregation of external LSAs */ | |
216 | int aggr_action; | |
217 | ||
6cb85350 AR |
218 | uint32_t seqnum_l; /* lower order Sequence Number */ |
219 | uint32_t seqnum_h; /* higher order Sequence Number */ | |
4dc43886 MR |
220 | #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5 |
221 | /* For ASBR summary delay timer */ | |
74e8311e | 222 | uint16_t aggr_delay_interval; |
4dc43886 MR |
223 | /* Table of configured Aggregate addresses */ |
224 | struct route_table *rt_aggr_tbl; | |
225 | ||
96244aca | 226 | QOBJ_FIELDS; |
718e3744 | 227 | }; |
96244aca | 228 | DECLARE_QOBJ_TYPE(ospf6); |
718e3744 | 229 | |
508e53e2 | 230 | #define OSPF6_DISABLED 0x01 |
f41b4a02 | 231 | #define OSPF6_STUB_ROUTER 0x02 |
718e3744 | 232 | |
508e53e2 | 233 | /* global pointer for OSPF top data structure */ |
234 | extern struct ospf6 *ospf6; | |
78c6ba61 | 235 | extern struct ospf6_master *om6; |
718e3744 | 236 | |
508e53e2 | 237 | /* prototypes */ |
cd9d0537 | 238 | extern void ospf6_master_init(struct event_loop *master); |
f71ed6df | 239 | extern void install_element_ospf6_clear_process(void); |
d62a17ae | 240 | extern void ospf6_top_init(void); |
241 | extern void ospf6_delete(struct ospf6 *o); | |
a3049476 | 242 | extern bool ospf6_router_id_update(struct ospf6 *ospf6, bool init); |
fcd45026 | 243 | void ospf6_restart_spf(struct ospf6 *ospf6); |
718e3744 | 244 | |
d62a17ae | 245 | extern void ospf6_maxage_remove(struct ospf6 *o); |
beadc736 | 246 | extern struct ospf6 *ospf6_instance_create(const char *name); |
247 | void ospf6_vrf_link(struct ospf6 *ospf6, struct vrf *vrf); | |
248 | void ospf6_vrf_unlink(struct ospf6 *ospf6, struct vrf *vrf); | |
249 | struct ospf6 *ospf6_lookup_by_vrf_id(vrf_id_t vrf_id); | |
250 | struct ospf6 *ospf6_lookup_by_vrf_name(const char *name); | |
251 | const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id); | |
4e8ccd92 | 252 | void ospf6_vrf_init(void); |
4dc43886 | 253 | bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p); |
718e3744 | 254 | #endif /* OSPF6_TOP_H */ |