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