]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospfd.h
Merge pull request #12845 from sri-mohan1/sri-mohan-ldp
[mirror_frr.git] / ospfd / ospfd.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * OSPFd main header.
4 * Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
5 */
6
7 #ifndef _ZEBRA_OSPFD_H
8 #define _ZEBRA_OSPFD_H
9
10 #include <zebra.h>
11 #include "typesafe.h"
12 #include "qobj.h"
13 #include "libospf.h"
14 #include "ldp_sync.h"
15
16 #include "filter.h"
17 #include "log.h"
18 #include "vrf.h"
19
20 #include "ospf_memory.h"
21 #include "ospf_dump_api.h"
22
23 #define OSPF_VERSION 2
24
25 /* VTY port number. */
26 #define OSPF_VTY_PORT 2604
27
28 /* IP TTL for OSPF protocol. */
29 #define OSPF_IP_TTL 1
30 #define OSPF_VL_IP_TTL 100
31
32 /* Default configuration file name for ospfd. */
33 #define OSPF_DEFAULT_CONFIG "ospfd.conf"
34
35 #define OSPF_NSSA_TRANS_STABLE_DEFAULT 40
36
37 #define OSPF_ALLSPFROUTERS 0xe0000005 /* 224.0.0.5 */
38 #define OSPF_ALLDROUTERS 0xe0000006 /* 224.0.0.6 */
39
40 /* OSPF Authentication Type. */
41 #define OSPF_AUTH_NULL 0
42 #define OSPF_AUTH_SIMPLE 1
43 #define OSPF_AUTH_CRYPTOGRAPHIC 2
44 /* For Interface authentication setting default */
45 #define OSPF_AUTH_NOTSET -1
46 /* For the consumption and sanity of the command handler */
47 /* DO NIOT REMOVE!!! Need to detect whether a value has
48 been given or not in VLink command handlers */
49 #define OSPF_AUTH_CMD_NOTSEEN -2
50
51 /* OSPF options. */
52 #define OSPF_OPTION_MT 0x01 /* M/T */
53 #define OSPF_OPTION_E 0x02
54 #define OSPF_OPTION_MC 0x04
55 #define OSPF_OPTION_NP 0x08
56 #define OSPF_OPTION_EA 0x10
57 #define OSPF_OPTION_DC 0x20
58 #define OSPF_OPTION_O 0x40
59 #define OSPF_OPTION_DN 0x80
60
61 /* OSPF Database Description flags. */
62 #define OSPF_DD_FLAG_MS 0x01
63 #define OSPF_DD_FLAG_M 0x02
64 #define OSPF_DD_FLAG_I 0x04
65 #define OSPF_DD_FLAG_ALL 0x07
66
67 #define OSPF_LS_REFRESH_SHIFT (60 * 15)
68 #define OSPF_LS_REFRESH_JITTER 60
69
70 struct ospf_external {
71 unsigned short instance;
72 struct route_table *external_info;
73 };
74
75 /* OSPF master for system wide configuration and variables. */
76 struct ospf_master {
77 /* OSPF instance. */
78 struct list *ospf;
79
80 /* OSPF thread master. */
81 struct thread_master *master;
82
83 /* Various OSPF global configuration. */
84 uint8_t options;
85 #define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */
86 };
87
88 struct ospf_redist {
89 unsigned short instance;
90
91 /* Redistribute metric info. */
92 struct {
93 int type; /* External metric type (E1 or E2). */
94 int value; /* Value for static metric (24-bit).
95 -1 means metric value is not set. */
96 } dmetric;
97
98 /* For redistribute route map. */
99 struct {
100 char *name;
101 struct route_map *map;
102 } route_map; /* +1 is for default-information */
103 #define ROUTEMAP_NAME(R) (R->route_map.name)
104 #define ROUTEMAP(R) (R->route_map.map)
105 };
106
107 /* ospf->config */
108 enum {
109 OSPF_RFC1583_COMPATIBLE = (1 << 0),
110 OSPF_OPAQUE_CAPABLE = (1 << 2),
111 OSPF_LOG_ADJACENCY_CHANGES = (1 << 3),
112 OSPF_LOG_ADJACENCY_DETAIL = (1 << 4),
113 OSPF_SEND_EXTRA_DATA_TO_ZEBRA = (1 << 5),
114 };
115
116 /* TI-LFA */
117 enum protection_type {
118 OSPF_TI_LFA_UNDEFINED_PROTECTION,
119 OSPF_TI_LFA_LINK_PROTECTION,
120 OSPF_TI_LFA_NODE_PROTECTION,
121 };
122
123 /* OSPF nonstop forwarding aka Graceful Restart */
124 struct ospf_gr_info {
125 bool restart_support;
126 bool restart_in_progress;
127 bool prepare_in_progress;
128 bool finishing_restart;
129 uint32_t grace_period;
130 struct thread *t_grace_period;
131 };
132
133 /* OSPF instance structure. */
134 struct ospf {
135 /* OSPF's running state based on the '[no] router ospf [<instance>]'
136 * config. */
137 uint8_t oi_running;
138
139 /* OSPF instance ID */
140 unsigned short instance;
141
142 /* OSPF Router ID. */
143 struct in_addr router_id; /* Configured automatically. */
144 struct in_addr router_id_static; /* Configured manually. */
145 struct in_addr router_id_zebra;
146
147 vrf_id_t vrf_id; /* VRF Id */
148 char *name; /* VRF name */
149
150 /* ABR/ASBR internal flags. */
151 uint8_t flags;
152 #define OSPF_FLAG_ABR 0x0001
153 #define OSPF_FLAG_ASBR 0x0002
154
155 /* ABR type. */
156 uint8_t abr_type;
157 #define OSPF_ABR_UNKNOWN 0
158 #define OSPF_ABR_STAND 1
159 #define OSPF_ABR_IBM 2
160 #define OSPF_ABR_CISCO 3
161 #define OSPF_ABR_SHORTCUT 4
162 #define OSPF_ABR_DEFAULT OSPF_ABR_CISCO
163
164 /* NSSA ABR */
165 uint8_t anyNSSA; /* Bump for every NSSA attached. */
166
167 /* Configuration bitmask, refer to enum above */
168 uint8_t config;
169
170 /* Opaque-LSA administrative flags. */
171 uint8_t opaque;
172 #define OPAQUE_OPERATION_READY_BIT (1 << 0)
173
174 /* RFC3137 stub router. Configured time to stay stub / max-metric */
175 unsigned int stub_router_startup_time; /* seconds */
176 unsigned int stub_router_shutdown_time; /* seconds */
177 #define OSPF_STUB_ROUTER_UNCONFIGURED 0
178 uint8_t stub_router_admin_set;
179 #define OSPF_STUB_ROUTER_ADMINISTRATIVE_SET 1
180 #define OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET 0
181
182 #define OSPF_STUB_MAX_METRIC_SUMMARY_COST 0x00ff0000
183
184 /* LSA timers */
185 unsigned int min_ls_interval; /* minimum delay between LSAs (in msec) */
186 unsigned int min_ls_arrival; /* minimum interarrival time between LSAs
187 (in msec) */
188
189 /* SPF parameters */
190 unsigned int spf_delay; /* SPF delay time. */
191 unsigned int spf_holdtime; /* SPF hold time. */
192 unsigned int spf_max_holdtime; /* SPF maximum-holdtime */
193 unsigned int
194 spf_hold_multiplier; /* Adaptive multiplier for hold time */
195
196 int default_originate; /* Default information originate. */
197 #define DEFAULT_ORIGINATE_NONE 0
198 #define DEFAULT_ORIGINATE_ZEBRA 1
199 #define DEFAULT_ORIGINATE_ALWAYS 2
200 uint32_t ref_bandwidth; /* Reference Bandwidth (Kbps). */
201 struct route_table *networks; /* OSPF config networks. */
202 struct list *vlinks; /* Configured Virtual-Links. */
203 struct list *areas; /* OSPF areas. */
204 struct route_table *nbr_nbma;
205 struct ospf_area *backbone; /* Pointer to the Backbone Area. */
206
207 struct list *oiflist; /* ospf interfaces */
208 uint8_t passive_interface_default; /* passive-interface default */
209
210 /* LSDB of AS-external-LSAs. */
211 struct ospf_lsdb *lsdb;
212
213 /* Flags. */
214 int ase_calc; /* ASE calculation flag. */
215
216 struct list *opaque_lsa_self; /* Type-11 Opaque-LSAs */
217
218 /* Routing tables. */
219 struct route_table *old_table; /* Old routing table. */
220 struct route_table *new_table; /* Current routing table. */
221
222 struct route_table *oall_rtrs; /* Old router RT. */
223 struct route_table *all_rtrs; /* New routers RT. */
224
225 struct route_table *old_rtrs; /* Old ABR/ASBR RT. */
226 struct route_table *new_rtrs; /* New ABR/ASBR RT. */
227
228 struct route_table *new_external_route; /* New External Route. */
229 struct route_table *old_external_route; /* Old External Route. */
230
231 struct route_table *external_lsas; /* Database of external LSAs,
232 prefix is LSA's adv. network*/
233
234 /* Time stamps */
235 struct timeval ts_spf; /* SPF calculation time stamp. */
236 struct timeval ts_spf_duration; /* Execution time of last SPF */
237
238 struct route_table *maxage_lsa; /* List of MaxAge LSA for deletion. */
239 int redistribute; /* Num of redistributed protocols. */
240
241 /* Threads. */
242 struct thread *t_abr_task; /* ABR task timer. */
243 struct thread *t_asbr_check; /* ASBR check timer. */
244 struct thread *t_asbr_nssa_redist_update; /* ASBR NSSA redistribution
245 update timer. */
246 struct thread *t_distribute_update; /* Distirbute list update timer. */
247 struct thread *t_spf_calc; /* SPF calculation timer. */
248 struct thread *t_ase_calc; /* ASE calculation timer. */
249 struct thread
250 *t_opaque_lsa_self; /* Type-11 Opaque-LSAs origin event. */
251 struct thread *t_sr_update; /* Segment Routing update timer */
252
253 unsigned int maxage_delay; /* Delay on Maxage remover timer, sec */
254 struct thread *t_maxage; /* MaxAge LSA remover timer. */
255 struct thread *t_maxage_walker; /* MaxAge LSA checking timer. */
256
257 struct thread
258 *t_deferred_shutdown; /* deferred/stub-router shutdown timer*/
259
260 struct thread *t_write;
261 #define OSPF_WRITE_INTERFACE_COUNT_DEFAULT 20
262 struct thread *t_default_routemap_timer;
263
264 int write_oi_count; /* Num of packets sent per thread invocation */
265 struct thread *t_read;
266 int fd;
267 struct stream *ibuf;
268 struct list *oi_write_q;
269
270 /* Distribute lists out of other route sources. */
271 struct {
272 char *name;
273 struct access_list *list;
274 } dlist[ZEBRA_ROUTE_MAX];
275 #define DISTRIBUTE_NAME(O,T) (O)->dlist[T].name
276 #define DISTRIBUTE_LIST(O,T) (O)->dlist[T].list
277
278 /* OSPF redistribute configuration */
279 struct list *redist[ZEBRA_ROUTE_MAX + 1];
280
281 /* Redistribute tag info. */
282 route_tag_t
283 dtag[ZEBRA_ROUTE_MAX + 1]; // Pending: cant configure as of now
284
285 int default_metric; /* Default metric for redistribute. */
286
287 #define OSPF_LSA_REFRESHER_GRANULARITY 10
288 #define OSPF_LSA_REFRESHER_SLOTS \
289 ((OSPF_LS_REFRESH_TIME + OSPF_LS_REFRESH_SHIFT) \
290 / OSPF_LSA_REFRESHER_GRANULARITY \
291 + 1)
292 struct {
293 uint16_t index;
294 struct list *qs[OSPF_LSA_REFRESHER_SLOTS];
295 } lsa_refresh_queue;
296
297 struct thread *t_lsa_refresher;
298 time_t lsa_refresher_started;
299 #define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10
300 uint16_t lsa_refresh_interval;
301 uint16_t lsa_refresh_timer;
302
303 /* Distance parameter. */
304 uint8_t distance_all;
305 uint8_t distance_intra;
306 uint8_t distance_inter;
307 uint8_t distance_external;
308
309 /* Statistics for LSA origination. */
310 uint32_t lsa_originate_count;
311
312 /* Statistics for LSA used for new instantiation. */
313 uint32_t rx_lsa_count;
314
315 struct route_table *distance_table;
316
317 /* Used during ospf instance going down send LSDB
318 * update to neighbors immediatly */
319 uint8_t inst_shutdown;
320
321 /* Enable or disable sending proactive ARP requests. */
322 bool proactive_arp;
323 #define OSPF_PROACTIVE_ARP_DEFAULT true
324
325 /* Redistributed external information. */
326 struct list *external[ZEBRA_ROUTE_MAX + 1];
327 #define EXTERNAL_INFO(E) (E->external_info)
328
329 /* Graceful restart Helper supported configs*/
330 /* Supported grace interval*/
331 uint32_t supported_grace_time;
332
333 /* Helper support
334 * Supported : True
335 * Not Supported : False.
336 */
337 bool is_helper_supported;
338
339 /* Support for strict LSA check.
340 * if it is set,Helper aborted
341 * upon a TOPO change.
342 */
343 bool strict_lsa_check;
344
345 /* Support as HELPER only for
346 * planned restarts.
347 */
348 bool only_planned_restart;
349
350 /* This list contains the advertisement
351 * routerids which are not support for HELPERs.
352 */
353 struct hash *enable_rtr_list;
354
355 /* HELPER for number of active
356 * RESTARTERs.
357 */
358 uint16_t active_restarter_cnt;
359
360 /* last HELPER exit reason */
361 uint32_t last_exit_reason;
362
363 /* delay timer to process external routes
364 * with summary address.
365 */
366 struct thread *t_external_aggr;
367
368 /* delay interval in seconds */
369 uint16_t aggr_delay_interval;
370
371 /* Table of configured Aggregate addresses */
372 struct route_table *rt_aggr_tbl;
373
374 /* used as argument for aggr delay
375 * timer thread.
376 */
377 int aggr_action;
378
379 /* Max number of multiple paths
380 * to support ECMP.
381 */
382 uint16_t max_multipath;
383
384 /* MPLS LDP-IGP Sync */
385 struct ldp_sync_info_cmd ldp_sync_cmd;
386
387 /* OSPF Graceful Restart info */
388 struct ospf_gr_info gr_info;
389
390 /* TI-LFA support for all interfaces. */
391 bool ti_lfa_enabled;
392 enum protection_type ti_lfa_protection_type;
393
394 QOBJ_FIELDS;
395 };
396 DECLARE_QOBJ_TYPE(ospf);
397
398 enum ospf_ti_lfa_p_q_space_adjacency {
399 OSPF_TI_LFA_P_Q_SPACE_ADJACENT,
400 OSPF_TI_LFA_P_Q_SPACE_NON_ADJACENT,
401 };
402
403 enum ospf_ti_lfa_node_type {
404 OSPF_TI_LFA_UNDEFINED_NODE,
405 OSPF_TI_LFA_PQ_NODE,
406 OSPF_TI_LFA_P_NODE,
407 OSPF_TI_LFA_Q_NODE,
408 };
409
410 struct ospf_ti_lfa_node_info {
411 struct vertex *node;
412 enum ospf_ti_lfa_node_type type;
413 struct in_addr nexthop;
414 };
415
416 struct ospf_ti_lfa_inner_backup_path_info {
417 struct ospf_ti_lfa_node_info p_node_info;
418 struct ospf_ti_lfa_node_info q_node_info;
419 struct mpls_label_stack *label_stack;
420 };
421
422 struct protected_resource {
423 enum protection_type type;
424
425 /* Link Protection */
426 struct router_lsa_link *link;
427
428 /* Node Protection */
429 struct in_addr router_id;
430 };
431
432 PREDECL_RBTREE_UNIQ(q_spaces);
433 struct q_space {
434 struct vertex *root;
435 struct list *vertex_list;
436 struct mpls_label_stack *label_stack;
437 struct in_addr nexthop;
438 struct list *pc_path;
439 struct ospf_ti_lfa_node_info *p_node_info;
440 struct ospf_ti_lfa_node_info *q_node_info;
441 struct q_spaces_item q_spaces_item;
442 };
443
444 PREDECL_RBTREE_UNIQ(p_spaces);
445 struct p_space {
446 struct vertex *root;
447 struct protected_resource *protected_resource;
448 struct q_spaces_head *q_spaces;
449 struct list *vertex_list;
450 struct vertex *pc_spf;
451 struct list *pc_vertex_list;
452 struct p_spaces_item p_spaces_item;
453 };
454
455 /* OSPF area structure. */
456 struct ospf_area {
457 /* OSPF instance. */
458 struct ospf *ospf;
459
460 /* Zebra interface list belonging to the area. */
461 struct list *oiflist;
462
463 /* Area ID. */
464 struct in_addr area_id;
465
466 /* Area ID format. */
467 int area_id_fmt;
468 #define OSPF_AREA_ID_FMT_DOTTEDQUAD 1
469 #define OSPF_AREA_ID_FMT_DECIMAL 2
470
471 /* Address range. */
472 struct list *address_range;
473
474 /* Configured variables. */
475 int external_routing; /* ExternalRoutingCapability. */
476 int no_summary; /* Don't inject summaries into stub.*/
477 int shortcut_configured; /* Area configured as shortcut. */
478 #define OSPF_SHORTCUT_DEFAULT 0
479 #define OSPF_SHORTCUT_ENABLE 1
480 #define OSPF_SHORTCUT_DISABLE 2
481 int shortcut_capability; /* Other ABRs agree on S-bit */
482 uint32_t default_cost; /* StubDefaultCost. */
483 int auth_type; /* Authentication type. */
484 int suppress_fa; /* Suppress forwarding address in NSSA ABR */
485
486 uint8_t NSSATranslatorRole; /* NSSA configured role */
487 #define OSPF_NSSA_ROLE_NEVER 0
488 #define OSPF_NSSA_ROLE_CANDIDATE 1
489 #define OSPF_NSSA_ROLE_ALWAYS 2
490 uint8_t NSSATranslatorState; /* NSSA operational role */
491 #define OSPF_NSSA_TRANSLATE_DISABLED 0
492 #define OSPF_NSSA_TRANSLATE_ENABLED 1
493 int NSSATranslatorStabilityInterval;
494
495 uint8_t transit; /* TransitCapability. */
496 #define OSPF_TRANSIT_FALSE 0
497 #define OSPF_TRANSIT_TRUE 1
498 struct route_table *ranges; /* Configured Area Ranges. */
499
500 /* RFC3137 stub router state flags for area */
501 uint8_t stub_router_state;
502 #define OSPF_AREA_ADMIN_STUB_ROUTED (1 << 0) /* admin stub-router set */
503 #define OSPF_AREA_IS_STUB_ROUTED (1 << 1) /* stub-router active */
504 #define OSPF_AREA_WAS_START_STUB_ROUTED (1 << 2) /* startup SR was done */
505 /* Area related LSDBs[Type1-4]. */
506 struct ospf_lsdb *lsdb;
507
508 /* Self-originated LSAs. */
509 struct ospf_lsa *router_lsa_self;
510 struct list *opaque_lsa_self; /* Type-10 Opaque-LSAs */
511
512 /* Area announce list. */
513 struct {
514 char *name;
515 struct access_list *list;
516 } _export;
517 #define EXPORT_NAME(A) (A)->_export.name
518 #define EXPORT_LIST(A) (A)->_export.list
519
520 /* Area acceptance list. */
521 struct {
522 char *name;
523 struct access_list *list;
524 } import;
525 #define IMPORT_NAME(A) (A)->import.name
526 #define IMPORT_LIST(A) (A)->import.list
527
528 /* Type 3 LSA Area prefix-list. */
529 struct {
530 char *name;
531 struct prefix_list *list;
532 } plist_in;
533 #define PREFIX_LIST_IN(A) (A)->plist_in.list
534 #define PREFIX_NAME_IN(A) (A)->plist_in.name
535
536 struct {
537 char *name;
538 struct prefix_list *list;
539 } plist_out;
540 #define PREFIX_LIST_OUT(A) (A)->plist_out.list
541 #define PREFIX_NAME_OUT(A) (A)->plist_out.name
542
543 /* Shortest Path Tree. */
544 struct vertex *spf;
545 struct list *spf_vertex_list;
546
547 bool spf_dry_run; /* flag for checking if the SPF calculation is
548 intended for the local RIB */
549 bool spf_root_node; /* flag for checking if the calculating node is the
550 root node of the SPF tree */
551
552 /* TI-LFA protected link for SPF calculations */
553 struct protected_resource *spf_protected_resource;
554
555 /* P/Q spaces for TI-LFA */
556 struct p_spaces_head *p_spaces;
557
558 /* Threads. */
559 struct thread *t_stub_router; /* Stub-router timer */
560 struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */
561
562 /* Statistics field. */
563 uint32_t spf_calculation; /* SPF Calculation Count. */
564
565 /* reverse SPF (used for TI-LFA Q spaces) */
566 bool spf_reversed;
567
568 /* Time stamps. */
569 struct timeval ts_spf; /* SPF calculation time stamp. */
570
571 /* Router count. */
572 uint32_t abr_count; /* ABR router in this area. */
573 uint32_t asbr_count; /* ASBR router in this area. */
574
575 /* Counters. */
576 uint32_t act_ints; /* Active interfaces. */
577 uint32_t full_nbrs; /* Fully adjacent neighbors. */
578 uint32_t full_vls; /* Fully adjacent virtual neighbors. */
579 };
580
581 /* OSPF config network structure. */
582 struct ospf_network {
583 /* Area ID. */
584 struct in_addr area_id;
585 int area_id_fmt;
586 };
587
588 /* OSPF NBMA neighbor structure. */
589 struct ospf_nbr_nbma {
590 /* Neighbor IP address. */
591 struct in_addr addr;
592
593 /* OSPF interface. */
594 struct ospf_interface *oi;
595
596 /* OSPF neighbor structure. */
597 struct ospf_neighbor *nbr;
598
599 /* Neighbor priority. */
600 uint8_t priority;
601
602 /* Poll timer value. */
603 uint32_t v_poll;
604
605 /* Poll timer thread. */
606 struct thread *t_poll;
607
608 /* State change. */
609 uint32_t state_change;
610 };
611
612 /* Macro. */
613 #define OSPF_AREA_SAME(X, Y) \
614 (memcmp((X->area_id), (Y->area_id), IPV4_MAX_BYTELEN) == 0)
615
616 #define IS_OSPF_ABR(O) ((O)->flags & OSPF_FLAG_ABR)
617 #define IS_OSPF_ASBR(O) ((O)->flags & OSPF_FLAG_ASBR)
618
619 #define OSPF_IS_AREA_ID_BACKBONE(I) ((I).s_addr == OSPF_AREA_BACKBONE)
620 #define OSPF_IS_AREA_BACKBONE(A) OSPF_IS_AREA_ID_BACKBONE ((A)->area_id)
621
622 #ifdef roundup
623 # define ROUNDUP(val, gran) roundup(val, gran)
624 #else /* roundup */
625 # define ROUNDUP(val, gran) (((val) - 1 | (gran) - 1) + 1)
626 #endif /* roundup */
627
628 #define LSA_OPTIONS_GET(area) \
629 (((area)->external_routing == OSPF_AREA_DEFAULT) ? OSPF_OPTION_E : 0)
630 #define LSA_OPTIONS_NSSA_GET(area) \
631 (((area)->external_routing == OSPF_AREA_NSSA) ? OSPF_OPTION_NP : 0)
632
633 #define OSPF_TIMER_ON(T,F,V) thread_add_timer (master,(F),ospf,(V),&(T))
634 #define OSPF_AREA_TIMER_ON(T,F,V) thread_add_timer (master, (F), area, (V), &(T))
635 #define OSPF_POLL_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr_nbma, (V), &(T))
636
637 /* Extern variables. */
638 extern struct ospf_master *om;
639 extern unsigned short ospf_instance;
640 extern const int ospf_redistributed_proto_max;
641 extern struct zclient *zclient;
642 extern struct thread_master *master;
643 extern int ospf_zlog;
644 extern struct zebra_privs_t ospfd_privs;
645
646 /* Prototypes. */
647 extern const char *ospf_redist_string(unsigned int route_type);
648 extern struct ospf *ospf_lookup_instance(unsigned short instance);
649 extern struct ospf *ospf_lookup(unsigned short instance, const char *name);
650 extern struct ospf *ospf_get(unsigned short instance, const char *name,
651 bool *created);
652 extern struct ospf *ospf_new_alloc(unsigned short instance, const char *name);
653 extern struct ospf *ospf_lookup_by_inst_name(unsigned short instance,
654 const char *name);
655 extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id);
656 extern uint32_t ospf_count_area_params(struct ospf *ospf);
657 extern void ospf_finish(struct ospf *ospf);
658 extern void ospf_process_refresh_data(struct ospf *ospf, bool reset);
659 extern void ospf_router_id_update(struct ospf *ospf);
660 extern void ospf_process_reset(struct ospf *ospf);
661 extern void ospf_neighbor_reset(struct ospf *ospf, struct in_addr nbr_id,
662 const char *nbr_str);
663 extern int ospf_network_set(struct ospf *ospf, struct prefix_ipv4 *p,
664 struct in_addr area_id, int df);
665 extern int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
666 struct in_addr aread_id);
667 extern int ospf_area_display_format_set(struct ospf *ospf,
668 struct ospf_area *area, int df);
669 extern int ospf_area_stub_set(struct ospf *ospf, struct in_addr area_id);
670 extern int ospf_area_stub_unset(struct ospf *ospf, struct in_addr area_id);
671 extern int ospf_area_no_summary_set(struct ospf *ospf, struct in_addr area_id);
672 extern int ospf_area_no_summary_unset(struct ospf *ospf,
673 struct in_addr area_id);
674 extern int ospf_area_nssa_set(struct ospf *ospf, struct in_addr area_id);
675 extern int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id,
676 int argc);
677 extern int ospf_area_nssa_suppress_fa_set(struct ospf *ospf,
678 struct in_addr area_id);
679 extern int ospf_area_nssa_suppress_fa_unset(struct ospf *ospf,
680 struct in_addr area_id);
681 extern int ospf_area_nssa_translator_role_set(struct ospf *ospf,
682 struct in_addr area_id, int role);
683 extern int ospf_area_export_list_set(struct ospf *ospf,
684 struct ospf_area *area_id,
685 const char *list_name);
686 extern int ospf_area_export_list_unset(struct ospf *ospf,
687 struct ospf_area *area_id);
688 extern int ospf_area_import_list_set(struct ospf *ospf,
689 struct ospf_area *area_id,
690 const char *name);
691 extern int ospf_area_import_list_unset(struct ospf *ospf,
692 struct ospf_area *area_id);
693 extern int ospf_area_shortcut_set(struct ospf *ospf, struct ospf_area *area_id,
694 int mode);
695 extern int ospf_area_shortcut_unset(struct ospf *ospf,
696 struct ospf_area *area_id);
697 extern int ospf_timers_refresh_set(struct ospf *ospf, int interval);
698 extern int ospf_timers_refresh_unset(struct ospf *ospf);
699 void ospf_area_lsdb_discard_delete(struct ospf_area *area);
700 extern int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr);
701 extern int ospf_nbr_nbma_unset(struct ospf *ospf, struct in_addr nbr_addr);
702 extern int ospf_nbr_nbma_priority_set(struct ospf *ospf,
703 struct in_addr nbr_addr,
704 uint8_t priority);
705 extern int ospf_nbr_nbma_priority_unset(struct ospf *ospf,
706 struct in_addr nbr_addr);
707 extern int ospf_nbr_nbma_poll_interval_set(struct ospf *ospf,
708 struct in_addr nbr_addr,
709 unsigned int interval);
710 extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *ospf,
711 struct in_addr addr);
712 extern void ospf_if_update(struct ospf *ospf, struct interface *ifp);
713 extern void ospf_ls_upd_queue_empty(struct ospf_interface *oi);
714 extern void ospf_terminate(void);
715 extern void ospf_nbr_nbma_if_update(struct ospf *ospf,
716 struct ospf_interface *oi);
717 extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *ospf,
718 struct in_addr nbr_addr);
719 extern int ospf_oi_count(struct interface *ifp);
720
721 extern struct ospf_area *ospf_area_new(struct ospf *ospf,
722 struct in_addr area_id);
723 extern struct ospf_area *ospf_area_get(struct ospf *ospf,
724 struct in_addr area_id);
725 extern void ospf_area_check_free(struct ospf *ospf, struct in_addr area_id);
726 extern struct ospf_area *ospf_area_lookup_by_area_id(struct ospf *ospf,
727 struct in_addr area_id);
728 extern void ospf_area_add_if(struct ospf_area *oa, struct ospf_interface *oi);
729 extern void ospf_area_del_if(struct ospf_area *oa, struct ospf_interface *oi);
730
731 extern void ospf_interface_area_set(struct ospf *ospf, struct interface *ifp);
732 extern void ospf_interface_area_unset(struct ospf *ospf, struct interface *ifp);
733
734 extern void ospf_route_map_init(void);
735
736 extern void ospf_master_init(struct thread_master *master);
737 extern void ospf_vrf_init(void);
738 extern void ospf_vrf_terminate(void);
739 extern void ospf_vrf_link(struct ospf *ospf, struct vrf *vrf);
740 extern void ospf_vrf_unlink(struct ospf *ospf, struct vrf *vrf);
741 const char *ospf_vrf_id_to_name(vrf_id_t vrf_id);
742 int ospf_area_nssa_no_summary_set(struct ospf *ospf, struct in_addr area_id);
743
744 const char *ospf_get_name(const struct ospf *ospf);
745 extern struct ospf_interface *add_ospf_interface(struct connected *co,
746 struct ospf_area *area);
747
748 extern int p_spaces_compare_func(const struct p_space *a,
749 const struct p_space *b);
750 extern int q_spaces_compare_func(const struct q_space *a,
751 const struct q_space *b);
752
753 #endif /* _ZEBRA_OSPFD_H */