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