]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * OSPFd main header. | |
3 | * Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada | |
4 | * | |
5 | * This file is part of GNU Zebra. | |
6 | * | |
7 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2, or (at your option) any | |
10 | * later version. | |
11 | * | |
12 | * GNU Zebra is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with GNU Zebra; see the file COPYING. If not, write to the Free | |
19 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
20 | * 02111-1307, USA. | |
21 | */ | |
22 | ||
23 | #ifndef _ZEBRA_OSPFD_H | |
24 | #define _ZEBRA_OSPFD_H | |
25 | ||
26 | #include "filter.h" | |
343f5cc7 | 27 | #include "log.h" |
718e3744 | 28 | |
29 | #define OSPF_VERSION 2 | |
30 | ||
31 | /* Default protocol, port number. */ | |
32 | #ifndef IPPROTO_OSPFIGP | |
33 | #define IPPROTO_OSPFIGP 89 | |
34 | #endif /* IPPROTO_OSPFIGP */ | |
35 | ||
68980084 | 36 | /* IP precedence. */ |
37 | #ifndef IPTOS_PREC_INTERNETCONTROL | |
38 | #define IPTOS_PREC_INTERNETCONTROL 0xC0 | |
39 | #endif /* IPTOS_PREC_INTERNETCONTROL */ | |
40 | ||
718e3744 | 41 | /* VTY port number. */ |
42 | #define OSPF_VTY_PORT 2604 | |
718e3744 | 43 | |
44 | /* IP TTL for OSPF protocol. */ | |
45 | #define OSPF_IP_TTL 1 | |
46 | #define OSPF_VL_IP_TTL 100 | |
47 | ||
48 | /* Default configuration file name for ospfd. */ | |
49 | #define OSPF_DEFAULT_CONFIG "ospfd.conf" | |
50 | ||
51 | /* Architectual Constants */ | |
52 | #ifdef DEBUG | |
53 | #define OSPF_LS_REFRESH_TIME 60 | |
54 | #else | |
55 | #define OSPF_LS_REFRESH_TIME 1800 | |
56 | #endif | |
57 | #define OSPF_MIN_LS_INTERVAL 5 | |
58 | #define OSPF_MIN_LS_ARRIVAL 1 | |
59 | #define OSPF_LSA_MAXAGE 3600 | |
60 | #define OSPF_CHECK_AGE 300 | |
61 | #define OSPF_LSA_MAXAGE_DIFF 900 | |
62 | #define OSPF_LS_INFINITY 0xffffff | |
63 | #define OSPF_DEFAULT_DESTINATION 0x00000000 /* 0.0.0.0 */ | |
64 | #define OSPF_INITIAL_SEQUENCE_NUMBER 0x80000001 | |
65 | #define OSPF_MAX_SEQUENCE_NUMBER 0x7fffffff | |
66 | ||
67 | #define OSPF_LSA_MAXAGE_CHECK_INTERVAL 30 | |
464c8204 | 68 | #define OSPF_NSSA_TRANS_STABLE_DEFAULT 40 |
718e3744 | 69 | |
70 | #define OSPF_ALLSPFROUTERS 0xe0000005 /* 224.0.0.5 */ | |
71 | #define OSPF_ALLDROUTERS 0xe0000006 /* 224.0.0.6 */ | |
72 | ||
beebba75 | 73 | /* XXX Where is this used? And why it was used only if compiled with |
74 | * NSSA support. */ | |
718e3744 | 75 | #define OSPF_LOOPer 0x7f000000 /* 127.0.0.0 */ |
718e3744 | 76 | |
77 | #define OSPF_AREA_BACKBONE 0x00000000 /* 0.0.0.0 */ | |
78 | ||
79 | /* OSPF Authentication Type. */ | |
80 | #define OSPF_AUTH_NULL 0 | |
81 | #define OSPF_AUTH_SIMPLE 1 | |
82 | #define OSPF_AUTH_CRYPTOGRAPHIC 2 | |
83 | /* For Interface authentication setting default */ | |
84 | #define OSPF_AUTH_NOTSET -1 | |
85 | /* For the consumption and sanity of the command handler */ | |
86 | /* DO NIOT REMOVE!!! Need to detect whether a value has | |
87 | been given or not in VLink command handlers */ | |
88 | #define OSPF_AUTH_CMD_NOTSEEN -2 | |
89 | ||
90 | /* OSPF SPF timer values. */ | |
d24f6e2a | 91 | #define OSPF_SPF_DELAY_DEFAULT 200 |
92 | #define OSPF_SPF_HOLDTIME_DEFAULT 1000 | |
93 | #define OSPF_SPF_MAX_HOLDTIME_DEFAULT 10000 | |
718e3744 | 94 | |
95 | /* OSPF interface default values. */ | |
96 | #define OSPF_OUTPUT_COST_DEFAULT 10 | |
88d6cf37 | 97 | #define OSPF_OUTPUT_COST_INFINITE UINT16_MAX |
718e3744 | 98 | #define OSPF_ROUTER_DEAD_INTERVAL_DEFAULT 40 |
f9ad937f | 99 | #define OSPF_ROUTER_DEAD_INTERVAL_MINIMAL 1 |
718e3744 | 100 | #define OSPF_HELLO_INTERVAL_DEFAULT 10 |
101 | #define OSPF_ROUTER_PRIORITY_DEFAULT 1 | |
102 | #define OSPF_RETRANSMIT_INTERVAL_DEFAULT 5 | |
103 | #define OSPF_TRANSMIT_DELAY_DEFAULT 1 | |
104 | #define OSPF_DEFAULT_BANDWIDTH 10000 /* Kbps */ | |
105 | ||
106 | #define OSPF_DEFAULT_REF_BANDWIDTH 100000 /* Kbps */ | |
107 | ||
108 | #define OSPF_POLL_INTERVAL_DEFAULT 60 | |
109 | #define OSPF_NEIGHBOR_PRIORITY_DEFAULT 0 | |
110 | ||
ba682537 | 111 | #define OSPF_MTU_IGNORE_DEFAULT 0 |
f9ad937f | 112 | #define OSPF_FAST_HELLO_DEFAULT 0 |
ba682537 | 113 | |
718e3744 | 114 | /* OSPF options. */ |
115 | #define OSPF_OPTION_T 0x01 /* TOS. */ | |
116 | #define OSPF_OPTION_E 0x02 | |
117 | #define OSPF_OPTION_MC 0x04 | |
118 | #define OSPF_OPTION_NP 0x08 | |
119 | #define OSPF_OPTION_EA 0x10 | |
120 | #define OSPF_OPTION_DC 0x20 | |
121 | #define OSPF_OPTION_O 0x40 | |
122 | ||
123 | /* OSPF Database Description flags. */ | |
124 | #define OSPF_DD_FLAG_MS 0x01 | |
125 | #define OSPF_DD_FLAG_M 0x02 | |
126 | #define OSPF_DD_FLAG_I 0x04 | |
127 | #define OSPF_DD_FLAG_ALL 0x07 | |
128 | ||
718e3744 | 129 | #define OSPF_LS_REFRESH_SHIFT (60 * 15) |
130 | #define OSPF_LS_REFRESH_JITTER 60 | |
131 | ||
020709f9 | 132 | /* OSPF master for system wide configuration and variables. */ |
133 | struct ospf_master | |
134 | { | |
135 | /* OSPF instance. */ | |
136 | struct list *ospf; | |
137 | ||
138 | /* OSPF thread master. */ | |
139 | struct thread_master *master; | |
140 | ||
141 | /* Zebra interface list. */ | |
142 | struct list *iflist; | |
143 | ||
144 | /* Redistributed external information. */ | |
145 | struct route_table *external_info[ZEBRA_ROUTE_MAX + 1]; | |
146 | #define EXTERNAL_INFO(T) om->external_info[T] | |
147 | ||
148 | /* OSPF start time. */ | |
149 | time_t start_time; | |
150 | ||
151 | /* Various OSPF global configuration. */ | |
152 | u_char options; | |
c9c93d50 | 153 | #define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */ |
020709f9 | 154 | }; |
155 | ||
718e3744 | 156 | /* OSPF instance structure. */ |
157 | struct ospf | |
158 | { | |
159 | /* OSPF Router ID. */ | |
160 | struct in_addr router_id; /* Configured automatically. */ | |
161 | struct in_addr router_id_static; /* Configured manually. */ | |
162 | ||
163 | /* ABR/ASBR internal flags. */ | |
164 | u_char flags; | |
165 | #define OSPF_FLAG_ABR 0x0001 | |
166 | #define OSPF_FLAG_ASBR 0x0002 | |
167 | ||
168 | /* ABR type. */ | |
169 | u_char abr_type; | |
170 | #define OSPF_ABR_UNKNOWN 0 | |
171 | #define OSPF_ABR_STAND 1 | |
172 | #define OSPF_ABR_IBM 2 | |
173 | #define OSPF_ABR_CISCO 3 | |
174 | #define OSPF_ABR_SHORTCUT 4 | |
d57834f6 | 175 | #define OSPF_ABR_DEFAULT OSPF_ABR_CISCO |
718e3744 | 176 | |
177 | /* NSSA ABR */ | |
178 | u_char anyNSSA; /* Bump for every NSSA attached. */ | |
179 | ||
180 | /* Configured variables. */ | |
181 | u_char config; | |
182 | #define OSPF_RFC1583_COMPATIBLE (1 << 0) | |
183 | #define OSPF_OPAQUE_CAPABLE (1 << 2) | |
184 | ||
185 | #ifdef HAVE_OPAQUE_LSA | |
186 | /* Opaque-LSA administrative flags. */ | |
187 | u_char opaque; | |
188 | #define OPAQUE_OPERATION_READY_BIT (1 << 0) | |
189 | #define OPAQUE_BLOCK_TYPE_09_LSA_BIT (1 << 1) | |
190 | #define OPAQUE_BLOCK_TYPE_10_LSA_BIT (1 << 2) | |
191 | #define OPAQUE_BLOCK_TYPE_11_LSA_BIT (1 << 3) | |
192 | #endif /* HAVE_OPAQUE_LSA */ | |
193 | ||
88d6cf37 | 194 | /* RFC3137 stub router. Configured time to stay stub / max-metric */ |
195 | unsigned int stub_router_startup_time; /* seconds */ | |
196 | unsigned int stub_router_shutdown_time; /* seconds */ | |
197 | #define OSPF_STUB_ROUTER_UNCONFIGURED 0 | |
88d6cf37 | 198 | |
199 | /* SPF parameters */ | |
200 | unsigned int spf_delay; /* SPF delay time. */ | |
201 | unsigned int spf_holdtime; /* SPF hold time. */ | |
202 | unsigned int spf_max_holdtime; /* SPF maximum-holdtime */ | |
203 | unsigned int spf_hold_multiplier; /* Adaptive multiplier for hold time */ | |
204 | ||
718e3744 | 205 | int default_originate; /* Default information originate. */ |
206 | #define DEFAULT_ORIGINATE_NONE 0 | |
207 | #define DEFAULT_ORIGINATE_ZEBRA 1 | |
208 | #define DEFAULT_ORIGINATE_ALWAYS 2 | |
209 | u_int32_t ref_bandwidth; /* Reference Bandwidth (Kbps). */ | |
210 | struct route_table *networks; /* OSPF config networks. */ | |
52dc7ee6 | 211 | struct list *vlinks; /* Configured Virtual-Links. */ |
212 | struct list *areas; /* OSPF areas. */ | |
718e3744 | 213 | struct route_table *nbr_nbma; |
214 | struct ospf_area *backbone; /* Pointer to the Backbone Area. */ | |
215 | ||
52dc7ee6 | 216 | struct list *oiflist; /* ospf interfaces */ |
718e3744 | 217 | |
218 | /* LSDB of AS-external-LSAs. */ | |
219 | struct ospf_lsdb *lsdb; | |
220 | ||
718e3744 | 221 | /* Flags. */ |
222 | int external_origin; /* AS-external-LSA origin flag. */ | |
223 | int ase_calc; /* ASE calculation flag. */ | |
224 | ||
225 | #ifdef HAVE_OPAQUE_LSA | |
52dc7ee6 | 226 | struct list *opaque_lsa_self; /* Type-11 Opaque-LSAs */ |
718e3744 | 227 | #endif /* HAVE_OPAQUE_LSA */ |
228 | ||
229 | /* Routing tables. */ | |
230 | struct route_table *old_table; /* Old routing table. */ | |
231 | struct route_table *new_table; /* Current routing table. */ | |
232 | ||
233 | struct route_table *old_rtrs; /* Old ABR/ASBR RT. */ | |
234 | struct route_table *new_rtrs; /* New ABR/ASBR RT. */ | |
235 | ||
236 | struct route_table *new_external_route; /* New External Route. */ | |
237 | struct route_table *old_external_route; /* Old External Route. */ | |
238 | ||
239 | struct route_table *external_lsas; /* Database of external LSAs, | |
240 | prefix is LSA's adv. network*/ | |
241 | ||
242 | /* Time stamps. */ | |
d24f6e2a | 243 | struct timeval ts_spf; /* SPF calculation time stamp. */ |
718e3744 | 244 | |
52dc7ee6 | 245 | struct list *maxage_lsa; /* List of MaxAge LSA for deletion. */ |
718e3744 | 246 | int redistribute; /* Num of redistributed protocols. */ |
247 | ||
248 | /* Threads. */ | |
718e3744 | 249 | struct thread *t_router_lsa_update; /* router-LSA update timer. */ |
250 | struct thread *t_abr_task; /* ABR task timer. */ | |
251 | struct thread *t_asbr_check; /* ASBR check timer. */ | |
252 | struct thread *t_distribute_update; /* Distirbute list update timer. */ | |
253 | struct thread *t_spf_calc; /* SPF calculation timer. */ | |
254 | struct thread *t_ase_calc; /* ASE calculation timer. */ | |
255 | struct thread *t_external_lsa; /* AS-external-LSA origin timer. */ | |
256 | #ifdef HAVE_OPAQUE_LSA | |
257 | struct thread *t_opaque_lsa_self; /* Type-11 Opaque-LSAs origin event. */ | |
258 | #endif /* HAVE_OPAQUE_LSA */ | |
259 | struct thread *t_maxage; /* MaxAge LSA remover timer. */ | |
260 | struct thread *t_maxage_walker; /* MaxAge LSA checking timer. */ | |
c9c93d50 | 261 | struct thread *t_deferred_shutdown; /* deferred/stub-router shutdown timer*/ |
718e3744 | 262 | |
263 | struct thread *t_write; | |
264 | struct thread *t_read; | |
265 | int fd; | |
5c33349b | 266 | struct stream *ibuf; |
52dc7ee6 | 267 | struct list *oi_write_q; |
718e3744 | 268 | |
269 | /* Distribute lists out of other route sources. */ | |
270 | struct | |
271 | { | |
272 | char *name; | |
273 | struct access_list *list; | |
274 | } dlist[ZEBRA_ROUTE_MAX]; | |
020709f9 | 275 | #define DISTRIBUTE_NAME(O,T) (O)->dlist[T].name |
276 | #define DISTRIBUTE_LIST(O,T) (O)->dlist[T].list | |
718e3744 | 277 | |
278 | /* Redistribute metric info. */ | |
279 | struct | |
280 | { | |
281 | int type; /* External metric type (E1 or E2). */ | |
282 | int value; /* Value for static metric (24-bit). | |
283 | -1 means metric value is not set. */ | |
284 | } dmetric [ZEBRA_ROUTE_MAX + 1]; | |
285 | ||
286 | /* For redistribute route map. */ | |
287 | struct | |
288 | { | |
289 | char *name; | |
290 | struct route_map *map; | |
291 | } route_map [ZEBRA_ROUTE_MAX + 1]; /* +1 is for default-information */ | |
020709f9 | 292 | #define ROUTEMAP_NAME(O,T) (O)->route_map[T].name |
293 | #define ROUTEMAP(O,T) (O)->route_map[T].map | |
718e3744 | 294 | |
295 | int default_metric; /* Default metric for redistribute. */ | |
296 | ||
297 | #define OSPF_LSA_REFRESHER_GRANULARITY 10 | |
298 | #define OSPF_LSA_REFRESHER_SLOTS ((OSPF_LS_REFRESH_TIME + \ | |
299 | OSPF_LS_REFRESH_SHIFT)/10 + 1) | |
300 | struct | |
301 | { | |
302 | u_int16_t index; | |
52dc7ee6 | 303 | struct list *qs[OSPF_LSA_REFRESHER_SLOTS]; |
718e3744 | 304 | } lsa_refresh_queue; |
305 | ||
306 | struct thread *t_lsa_refresher; | |
307 | time_t lsa_refresher_started; | |
308 | #define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10 | |
309 | u_int16_t lsa_refresh_interval; | |
310 | ||
311 | /* Distance parameter. */ | |
312 | u_char distance_all; | |
313 | u_char distance_intra; | |
314 | u_char distance_inter; | |
315 | u_char distance_external; | |
316 | ||
317 | /* Statistics for LSA origination. */ | |
318 | u_int32_t lsa_originate_count; | |
319 | ||
320 | /* Statistics for LSA used for new instantiation. */ | |
321 | u_int32_t rx_lsa_count; | |
322 | ||
323 | struct route_table *distance_table; | |
324 | }; | |
325 | ||
326 | /* OSPF area structure. */ | |
327 | struct ospf_area | |
328 | { | |
329 | /* OSPF instance. */ | |
68980084 | 330 | struct ospf *ospf; |
718e3744 | 331 | |
332 | /* Zebra interface list belonging to the area. */ | |
52dc7ee6 | 333 | struct list *oiflist; |
718e3744 | 334 | |
335 | /* Area ID. */ | |
336 | struct in_addr area_id; | |
337 | ||
338 | /* Area ID format. */ | |
339 | char format; | |
340 | #define OSPF_AREA_ID_FORMAT_ADDRESS 1 | |
341 | #define OSPF_AREA_ID_FORMAT_DECIMAL 2 | |
342 | ||
343 | /* Address range. */ | |
52dc7ee6 | 344 | struct list *address_range; |
718e3744 | 345 | |
346 | /* Configured variables. */ | |
347 | int external_routing; /* ExternalRoutingCapability. */ | |
348 | #define OSPF_AREA_DEFAULT 0 | |
349 | #define OSPF_AREA_STUB 1 | |
350 | #define OSPF_AREA_NSSA 2 | |
351 | #define OSPF_AREA_TYPE_MAX 3 | |
352 | int no_summary; /* Don't inject summaries into stub.*/ | |
353 | int shortcut_configured; /* Area configured as shortcut. */ | |
354 | #define OSPF_SHORTCUT_DEFAULT 0 | |
355 | #define OSPF_SHORTCUT_ENABLE 1 | |
356 | #define OSPF_SHORTCUT_DISABLE 2 | |
357 | int shortcut_capability; /* Other ABRs agree on S-bit */ | |
358 | u_int32_t default_cost; /* StubDefaultCost. */ | |
359 | int auth_type; /* Authentication type. */ | |
88d6cf37 | 360 | |
718e3744 | 361 | |
464c8204 | 362 | u_char NSSATranslatorRole; /* NSSA configured role */ |
718e3744 | 363 | #define OSPF_NSSA_ROLE_NEVER 0 |
d4a53d58 | 364 | #define OSPF_NSSA_ROLE_CANDIDATE 1 |
365 | #define OSPF_NSSA_ROLE_ALWAYS 2 | |
464c8204 | 366 | u_char NSSATranslatorState; /* NSSA operational role */ |
d4a53d58 | 367 | #define OSPF_NSSA_TRANSLATE_DISABLED 0 |
368 | #define OSPF_NSSA_TRANSLATE_ENABLED 1 | |
464c8204 | 369 | int NSSATranslatorStabilityInterval; |
370 | ||
718e3744 | 371 | u_char transit; /* TransitCapability. */ |
372 | #define OSPF_TRANSIT_FALSE 0 | |
373 | #define OSPF_TRANSIT_TRUE 1 | |
374 | struct route_table *ranges; /* Configured Area Ranges. */ | |
88d6cf37 | 375 | |
376 | /* RFC3137 stub router state flags for area */ | |
377 | u_char stub_router_state; | |
378 | #define OSPF_AREA_ADMIN_STUB_ROUTED (1 << 0) /* admin stub-router set */ | |
379 | #define OSPF_AREA_IS_STUB_ROUTED (1 << 1) /* stub-router active */ | |
380 | #define OSPF_AREA_WAS_START_STUB_ROUTED (1 << 2) /* startup SR was done */ | |
381 | ||
718e3744 | 382 | /* Area related LSDBs[Type1-4]. */ |
383 | struct ospf_lsdb *lsdb; | |
384 | ||
385 | /* Self-originated LSAs. */ | |
386 | struct ospf_lsa *router_lsa_self; | |
387 | #ifdef HAVE_OPAQUE_LSA | |
52dc7ee6 | 388 | struct list *opaque_lsa_self; /* Type-10 Opaque-LSAs */ |
718e3744 | 389 | #endif /* HAVE_OPAQUE_LSA */ |
390 | ||
391 | /* Area announce list. */ | |
392 | struct | |
393 | { | |
394 | char *name; | |
395 | struct access_list *list; | |
396 | } export; | |
397 | #define EXPORT_NAME(A) (A)->export.name | |
398 | #define EXPORT_LIST(A) (A)->export.list | |
399 | ||
400 | /* Area acceptance list. */ | |
401 | struct | |
402 | { | |
403 | char *name; | |
404 | struct access_list *list; | |
405 | } import; | |
406 | #define IMPORT_NAME(A) (A)->import.name | |
407 | #define IMPORT_LIST(A) (A)->import.list | |
408 | ||
409 | /* Type 3 LSA Area prefix-list. */ | |
410 | struct | |
411 | { | |
412 | char *name; | |
413 | struct prefix_list *list; | |
414 | } plist_in; | |
415 | #define PREFIX_LIST_IN(A) (A)->plist_in.list | |
416 | #define PREFIX_NAME_IN(A) (A)->plist_in.name | |
417 | ||
418 | struct | |
419 | { | |
420 | char *name; | |
421 | struct prefix_list *list; | |
422 | } plist_out; | |
423 | #define PREFIX_LIST_OUT(A) (A)->plist_out.list | |
424 | #define PREFIX_NAME_OUT(A) (A)->plist_out.name | |
425 | ||
426 | /* Shortest Path Tree. */ | |
427 | struct vertex *spf; | |
428 | ||
429 | /* Threads. */ | |
430 | struct thread *t_router_lsa_self;/* Self-originated router-LSA timer. */ | |
88d6cf37 | 431 | struct thread *t_stub_router; /* Stub-router timer */ |
718e3744 | 432 | #ifdef HAVE_OPAQUE_LSA |
433 | struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */ | |
434 | #endif /* HAVE_OPAQUE_LSA */ | |
435 | ||
436 | /* Statistics field. */ | |
437 | u_int32_t spf_calculation; /* SPF Calculation Count. */ | |
438 | ||
439 | /* Router count. */ | |
440 | u_int32_t abr_count; /* ABR router in this area. */ | |
441 | u_int32_t asbr_count; /* ASBR router in this area. */ | |
442 | ||
443 | /* Counters. */ | |
444 | u_int32_t act_ints; /* Active interfaces. */ | |
445 | u_int32_t full_nbrs; /* Fully adjacent neighbors. */ | |
446 | u_int32_t full_vls; /* Fully adjacent virtual neighbors. */ | |
447 | }; | |
448 | ||
449 | /* OSPF config network structure. */ | |
450 | struct ospf_network | |
451 | { | |
452 | /* Area ID. */ | |
453 | struct in_addr area_id; | |
454 | int format; | |
455 | }; | |
456 | ||
457 | /* OSPF NBMA neighbor structure. */ | |
458 | struct ospf_nbr_nbma | |
459 | { | |
460 | /* Neighbor IP address. */ | |
461 | struct in_addr addr; | |
462 | ||
463 | /* OSPF interface. */ | |
464 | struct ospf_interface *oi; | |
465 | ||
466 | /* OSPF neighbor structure. */ | |
467 | struct ospf_neighbor *nbr; | |
468 | ||
469 | /* Neighbor priority. */ | |
470 | u_char priority; | |
471 | ||
472 | /* Poll timer value. */ | |
473 | u_int32_t v_poll; | |
474 | ||
475 | /* Poll timer thread. */ | |
476 | struct thread *t_poll; | |
477 | ||
478 | /* State change. */ | |
479 | u_int32_t state_change; | |
480 | }; | |
481 | ||
482 | /* Macro. */ | |
483 | #define OSPF_AREA_SAME(X,Y) \ | |
484 | (memcmp ((X->area_id), (Y->area_id), IPV4_MAX_BYTELEN) == 0) | |
485 | ||
020709f9 | 486 | #define IS_OSPF_ABR(O) ((O)->flags & OSPF_FLAG_ABR) |
487 | #define IS_OSPF_ASBR(O) ((O)->flags & OSPF_FLAG_ASBR) | |
718e3744 | 488 | |
489 | #define OSPF_IS_AREA_ID_BACKBONE(I) ((I).s_addr == OSPF_AREA_BACKBONE) | |
490 | #define OSPF_IS_AREA_BACKBONE(A) OSPF_IS_AREA_ID_BACKBONE ((A)->area_id) | |
491 | ||
492 | #ifdef roundup | |
493 | # define ROUNDUP(val, gran) roundup(val, gran) | |
494 | #else /* roundup */ | |
495 | # define ROUNDUP(val, gran) (((val) - 1 | (gran) - 1) + 1) | |
496 | #endif /* roundup */ | |
497 | ||
498 | #define LSA_OPTIONS_GET(area) \ | |
499 | (((area)->external_routing == OSPF_AREA_DEFAULT) ? OSPF_OPTION_E : 0) | |
d4a53d58 | 500 | #define LSA_OPTIONS_NSSA_GET(area) \ |
501 | (((area)->external_routing == OSPF_AREA_NSSA) ? OSPF_OPTION_NP : 0) | |
718e3744 | 502 | |
503 | #define OSPF_TIMER_ON(T,F,V) \ | |
504 | do { \ | |
505 | if (!(T)) \ | |
68980084 | 506 | (T) = thread_add_timer (master, (F), ospf, (V)); \ |
718e3744 | 507 | } while (0) |
508 | ||
509 | #define OSPF_AREA_TIMER_ON(T,F,V) \ | |
510 | do { \ | |
511 | if (!(T)) \ | |
512 | (T) = thread_add_timer (master, (F), area, (V)); \ | |
513 | } while (0) | |
514 | ||
515 | #define OSPF_POLL_TIMER_ON(T,F,V) \ | |
516 | do { \ | |
517 | if (!(T)) \ | |
518 | (T) = thread_add_timer (master, (F), nbr_nbma, (V)); \ | |
519 | } while (0) | |
520 | ||
521 | #define OSPF_POLL_TIMER_OFF(X) OSPF_TIMER_OFF((X)) | |
522 | ||
523 | #define OSPF_TIMER_OFF(X) \ | |
524 | do { \ | |
525 | if (X) \ | |
526 | { \ | |
527 | thread_cancel (X); \ | |
528 | (X) = NULL; \ | |
529 | } \ | |
530 | } while (0) | |
531 | ||
020709f9 | 532 | /* Extern variables. */ |
533 | extern struct ospf_master *om; | |
718e3744 | 534 | extern struct message ospf_ism_state_msg[]; |
535 | extern struct message ospf_nsm_state_msg[]; | |
536 | extern struct message ospf_lsa_type_msg[]; | |
537 | extern struct message ospf_link_state_id_type_msg[]; | |
718e3744 | 538 | extern struct message ospf_network_type_msg[]; |
539 | extern int ospf_ism_state_msg_max; | |
540 | extern int ospf_nsm_state_msg_max; | |
541 | extern int ospf_lsa_type_msg_max; | |
542 | extern int ospf_link_state_id_type_msg_max; | |
543 | extern int ospf_redistributed_proto_max; | |
544 | extern int ospf_network_type_msg_max; | |
545 | extern struct zclient *zclient; | |
546 | extern struct thread_master *master; | |
718e3744 | 547 | extern int ospf_zlog; |
548 | ||
549 | /* Prototypes. */ | |
f52d13cb | 550 | extern const char *ospf_redist_string(u_int route_type); |
4dadc291 | 551 | extern struct ospf *ospf_lookup (void); |
552 | extern struct ospf *ospf_get (void); | |
553 | extern void ospf_finish (struct ospf *); | |
4dadc291 | 554 | extern void ospf_router_id_update (struct ospf *ospf); |
555 | extern int ospf_network_match_iface (struct connected *, struct prefix *); | |
556 | extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *, | |
557 | struct in_addr); | |
558 | extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, | |
559 | struct in_addr); | |
560 | extern int ospf_area_stub_set (struct ospf *, struct in_addr); | |
561 | extern int ospf_area_stub_unset (struct ospf *, struct in_addr); | |
562 | extern int ospf_area_no_summary_set (struct ospf *, struct in_addr); | |
563 | extern int ospf_area_no_summary_unset (struct ospf *, struct in_addr); | |
564 | extern int ospf_area_nssa_set (struct ospf *, struct in_addr); | |
565 | extern int ospf_area_nssa_unset (struct ospf *, struct in_addr); | |
566 | extern int ospf_area_nssa_translator_role_set (struct ospf *, struct in_addr, | |
567 | int); | |
568 | extern int ospf_area_export_list_set (struct ospf *, struct ospf_area *, | |
569 | const char *); | |
570 | extern int ospf_area_export_list_unset (struct ospf *, struct ospf_area *); | |
571 | extern int ospf_area_import_list_set (struct ospf *, struct ospf_area *, | |
572 | const char *); | |
573 | extern int ospf_area_import_list_unset (struct ospf *, struct ospf_area *); | |
574 | extern int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int); | |
575 | extern int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *); | |
4dadc291 | 576 | extern int ospf_timers_refresh_set (struct ospf *, int); |
577 | extern int ospf_timers_refresh_unset (struct ospf *); | |
578 | extern int ospf_nbr_nbma_set (struct ospf *, struct in_addr); | |
579 | extern int ospf_nbr_nbma_unset (struct ospf *, struct in_addr); | |
580 | extern int ospf_nbr_nbma_priority_set (struct ospf *, struct in_addr, u_char); | |
581 | extern int ospf_nbr_nbma_priority_unset (struct ospf *, struct in_addr); | |
582 | extern int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr, | |
583 | unsigned int); | |
584 | extern int ospf_nbr_nbma_poll_interval_unset (struct ospf *, struct in_addr); | |
585 | extern void ospf_prefix_list_update (struct prefix_list *); | |
586 | extern void ospf_init (void); | |
587 | extern void ospf_if_update (struct ospf *); | |
588 | extern void ospf_ls_upd_queue_empty (struct ospf_interface *); | |
589 | extern void ospf_terminate (void); | |
590 | extern void ospf_nbr_nbma_if_update (struct ospf *, struct ospf_interface *); | |
591 | extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup (struct ospf *, | |
592 | struct in_addr); | |
593 | extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *, | |
594 | struct in_addr *, | |
595 | int); | |
596 | extern int ospf_oi_count (struct interface *); | |
597 | ||
598 | extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int); | |
599 | extern void ospf_area_check_free (struct ospf *, struct in_addr); | |
600 | extern struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *, | |
601 | struct in_addr); | |
602 | extern void ospf_area_add_if (struct ospf_area *, struct ospf_interface *); | |
603 | extern void ospf_area_del_if (struct ospf_area *, struct ospf_interface *); | |
604 | ||
605 | extern void ospf_route_map_init (void); | |
606 | extern void ospf_snmp_init (void); | |
607 | ||
608 | extern void ospf_master_init (void); | |
020709f9 | 609 | |
718e3744 | 610 | #endif /* _ZEBRA_OSPFD_H */ |