1 /* OSPF version 2 daemon program.
2 Copyright (C) 1999, 2000 Toshiaki Takada
4 This file is part of GNU Zebra.
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
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.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #include "sockunion.h" /* for inet_aton () */
37 #include "ospfd/ospfd.h"
38 #include "ospfd/ospf_network.h"
39 #include "ospfd/ospf_interface.h"
40 #include "ospfd/ospf_ism.h"
41 #include "ospfd/ospf_asbr.h"
42 #include "ospfd/ospf_lsa.h"
43 #include "ospfd/ospf_lsdb.h"
44 #include "ospfd/ospf_neighbor.h"
45 #include "ospfd/ospf_nsm.h"
46 #include "ospfd/ospf_spf.h"
47 #include "ospfd/ospf_packet.h"
48 #include "ospfd/ospf_dump.h"
49 #include "ospfd/ospf_zebra.h"
50 #include "ospfd/ospf_abr.h"
51 #include "ospfd/ospf_flood.h"
52 #include "ospfd/ospf_route.h"
53 #include "ospfd/ospf_ase.h"
57 /* OSPF process wide configuration. */
58 static struct ospf_master ospf_master
;
60 /* OSPF process wide configuration pointer to export. */
61 struct ospf_master
*om
;
63 extern struct zclient
*zclient
;
64 extern struct in_addr router_id_zebra
;
67 void ospf_remove_vls_through_area (struct ospf
*, struct ospf_area
*);
68 void ospf_network_free (struct ospf
*, struct ospf_network
*);
69 void ospf_area_free (struct ospf_area
*);
70 void ospf_network_run (struct ospf
*, struct prefix
*, struct ospf_area
*);
72 #define OSPF_EXTERNAL_LSA_ORIGINATE_DELAY 1
75 ospf_router_id_update (struct ospf
*ospf
)
77 struct in_addr router_id
, router_id_old
;
78 struct ospf_interface
*oi
;
79 struct listnode
*node
;
81 if (IS_DEBUG_OSPF_EVENT
)
82 zlog_debug ("Router-ID[OLD:%s]: Update", inet_ntoa (ospf
->router_id
));
84 router_id_old
= ospf
->router_id
;
86 if (ospf
->router_id_static
.s_addr
!= 0)
87 router_id
= ospf
->router_id_static
;
89 router_id
= router_id_zebra
;
91 ospf
->router_id
= router_id
;
93 if (IS_DEBUG_OSPF_EVENT
)
94 zlog_debug ("Router-ID[NEW:%s]: Update", inet_ntoa (ospf
->router_id
));
96 if (!IPV4_ADDR_SAME (&router_id_old
, &router_id
))
98 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
99 /* Update self-neighbor's router_id. */
100 oi
->nbr_self
->router_id
= router_id
;
102 /* If AS-external-LSA is queued, then flush those LSAs. */
103 if (router_id_old
.s_addr
== 0 && ospf
->external_origin
)
106 /* Originate each redistributed external route. */
107 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
108 if (ospf
->external_origin
& (1 << type
))
109 thread_add_event (master
, ospf_external_lsa_originate_timer
,
111 /* Originate Deafult. */
112 if (ospf
->external_origin
& (1 << ZEBRA_ROUTE_MAX
))
113 thread_add_event (master
, ospf_default_originate_timer
,
114 &ospf
->default_originate
, 0);
116 ospf
->external_origin
= 0;
119 OSPF_TIMER_ON (ospf
->t_router_lsa_update
,
120 ospf_router_lsa_update_timer
, OSPF_LSA_UPDATE_DELAY
);
125 ospf_router_id_update_timer (struct thread
*thread
)
127 struct ospf
*ospf
= THREAD_ARG (thread
);
129 if (IS_DEBUG_OSPF_EVENT
)
130 zlog_debug ("Router-ID: Update timer fired!");
132 ospf
->t_router_id_update
= NULL
;
133 ospf_router_id_update (ospf
);
138 /* For OSPF area sort by area id. */
140 ospf_area_id_cmp (struct ospf_area
*a1
, struct ospf_area
*a2
)
142 if (ntohl (a1
->area_id
.s_addr
) > ntohl (a2
->area_id
.s_addr
))
144 if (ntohl (a1
->area_id
.s_addr
) < ntohl (a2
->area_id
.s_addr
))
149 /* Allocate new ospf structure. */
155 struct ospf
*new = XCALLOC (MTYPE_OSPF_TOP
, sizeof (struct ospf
));
157 new->router_id
.s_addr
= htonl (0);
158 new->router_id_static
.s_addr
= htonl (0);
160 new->abr_type
= OSPF_ABR_STAND
;
161 new->oiflist
= list_new ();
162 new->vlinks
= list_new ();
163 new->areas
= list_new ();
164 new->areas
->cmp
= (int (*)(void *, void *)) ospf_area_id_cmp
;
165 new->networks
= route_table_init ();
166 new->nbr_nbma
= route_table_init ();
168 new->lsdb
= ospf_lsdb_new ();
170 new->default_originate
= DEFAULT_ORIGINATE_NONE
;
172 new->new_external_route
= route_table_init ();
173 new->old_external_route
= route_table_init ();
174 new->external_lsas
= route_table_init ();
176 /* Distribute parameter init. */
177 for (i
= 0; i
<= ZEBRA_ROUTE_MAX
; i
++)
179 new->dmetric
[i
].type
= -1;
180 new->dmetric
[i
].value
= -1;
182 new->default_metric
= -1;
183 new->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
185 /* SPF timer value init. */
186 new->spf_delay
= OSPF_SPF_DELAY_DEFAULT
;
187 new->spf_holdtime
= OSPF_SPF_HOLDTIME_DEFAULT
;
190 new->maxage_lsa
= list_new ();
191 new->t_maxage_walker
=
192 thread_add_timer (master
, ospf_lsa_maxage_walker
,
193 new, OSPF_LSA_MAXAGE_CHECK_INTERVAL
);
195 /* Distance table init. */
196 new->distance_table
= route_table_init ();
198 new->lsa_refresh_queue
.index
= 0;
199 new->lsa_refresh_interval
= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
;
200 new->t_lsa_refresher
= thread_add_timer (master
, ospf_lsa_refresh_walker
,
201 new, new->lsa_refresh_interval
);
202 new->lsa_refresher_started
= time (NULL
);
204 if ((new->fd
= ospf_sock_init()) < 0)
206 zlog_err("ospf_new: fatal error: ospf_sock_init was unable to open "
210 if ((new->ibuf
= stream_new(OSPF_MAX_PACKET_SIZE
+1)) == NULL
)
212 zlog_err("ospf_new: fatal error: stream_new(%u) failed allocating ibuf",
213 OSPF_MAX_PACKET_SIZE
+1);
216 new->t_read
= thread_add_read (master
, ospf_read
, new, new->fd
);
217 new->oi_write_q
= list_new ();
225 if (listcount (om
->ospf
) == 0)
228 return listgetdata (listhead (om
->ospf
));
232 ospf_add (struct ospf
*ospf
)
234 listnode_add (om
->ospf
, ospf
);
238 ospf_delete (struct ospf
*ospf
)
240 listnode_delete (om
->ospf
, ospf
);
248 ospf
= ospf_lookup ();
254 if (ospf
->router_id_static
.s_addr
== 0)
255 ospf_router_id_update (ospf
);
257 #ifdef HAVE_OPAQUE_LSA
258 ospf_opaque_type11_lsa_init (ospf
);
259 #endif /* HAVE_OPAQUE_LSA */
266 ospf_finish (struct ospf
*ospf
)
268 struct route_node
*rn
;
269 struct ospf_nbr_nbma
*nbr_nbma
;
270 struct ospf_lsa
*lsa
;
271 struct ospf_interface
*oi
;
272 struct ospf_area
*area
;
273 struct ospf_vl_data
*vl_data
;
274 struct listnode
*node
, *nnode
;
277 #ifdef HAVE_OPAQUE_LSA
278 ospf_opaque_type11_lsa_term (ospf
);
279 #endif /* HAVE_OPAQUE_LSA */
281 /* Unredister redistribution */
282 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
283 ospf_redistribute_unset (ospf
, i
);
285 for (ALL_LIST_ELEMENTS (ospf
->areas
, node
, nnode
, area
))
286 ospf_remove_vls_through_area (ospf
, area
);
288 for (ALL_LIST_ELEMENTS (ospf
->vlinks
, node
, nnode
, vl_data
))
289 ospf_vl_delete (ospf
, vl_data
);
291 list_delete (ospf
->vlinks
);
293 /* Reset interface. */
294 for (ALL_LIST_ELEMENTS (ospf
->oiflist
, node
, nnode
, oi
))
297 /* Clear static neighbors */
298 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
299 if ((nbr_nbma
= rn
->info
))
301 OSPF_POLL_TIMER_OFF (nbr_nbma
->t_poll
);
305 nbr_nbma
->nbr
->nbr_nbma
= NULL
;
306 nbr_nbma
->nbr
= NULL
;
311 listnode_delete (nbr_nbma
->oi
->nbr_nbma
, nbr_nbma
);
315 XFREE (MTYPE_OSPF_NEIGHBOR_STATIC
, nbr_nbma
);
318 route_table_finish (ospf
->nbr_nbma
);
320 /* Clear networks and Areas. */
321 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
323 struct ospf_network
*network
;
325 if ((network
= rn
->info
) != NULL
)
327 ospf_network_free (ospf
, network
);
329 route_unlock_node (rn
);
333 for (ALL_LIST_ELEMENTS (ospf
->areas
, node
, nnode
, area
))
335 listnode_delete (ospf
->areas
, area
);
336 ospf_area_free (area
);
339 /* Cancel all timers. */
340 OSPF_TIMER_OFF (ospf
->t_external_lsa
);
341 OSPF_TIMER_OFF (ospf
->t_router_id_update
);
342 OSPF_TIMER_OFF (ospf
->t_router_lsa_update
);
343 OSPF_TIMER_OFF (ospf
->t_spf_calc
);
344 OSPF_TIMER_OFF (ospf
->t_ase_calc
);
345 OSPF_TIMER_OFF (ospf
->t_maxage
);
346 OSPF_TIMER_OFF (ospf
->t_maxage_walker
);
347 OSPF_TIMER_OFF (ospf
->t_abr_task
);
348 OSPF_TIMER_OFF (ospf
->t_distribute_update
);
349 OSPF_TIMER_OFF (ospf
->t_lsa_refresher
);
350 OSPF_TIMER_OFF (ospf
->t_read
);
351 OSPF_TIMER_OFF (ospf
->t_write
);
354 stream_free(ospf
->ibuf
);
356 #ifdef HAVE_OPAQUE_LSA
357 LSDB_LOOP (OPAQUE_AS_LSDB (ospf
), rn
, lsa
)
358 ospf_discard_from_db (ospf
, ospf
->lsdb
, lsa
);
359 #endif /* HAVE_OPAQUE_LSA */
360 LSDB_LOOP (EXTERNAL_LSDB (ospf
), rn
, lsa
)
361 ospf_discard_from_db (ospf
, ospf
->lsdb
, lsa
);
363 ospf_lsdb_delete_all (ospf
->lsdb
);
364 ospf_lsdb_free (ospf
->lsdb
);
366 for (ALL_LIST_ELEMENTS (ospf
->maxage_lsa
, node
, nnode
, lsa
))
367 ospf_lsa_unlock (lsa
);
369 list_delete (ospf
->maxage_lsa
);
372 ospf_route_table_free (ospf
->old_table
);
375 ospf_route_delete (ospf
->new_table
);
376 ospf_route_table_free (ospf
->new_table
);
379 ospf_rtrs_free (ospf
->old_rtrs
);
381 ospf_rtrs_free (ospf
->new_rtrs
);
382 if (ospf
->new_external_route
)
384 ospf_route_delete (ospf
->new_external_route
);
385 ospf_route_table_free (ospf
->new_external_route
);
387 if (ospf
->old_external_route
)
389 ospf_route_delete (ospf
->old_external_route
);
390 ospf_route_table_free (ospf
->old_external_route
);
392 if (ospf
->external_lsas
)
394 ospf_ase_external_lsas_finish (ospf
->external_lsas
);
397 list_delete (ospf
->areas
);
399 for (i
= ZEBRA_ROUTE_SYSTEM
; i
<= ZEBRA_ROUTE_MAX
; i
++)
400 if (EXTERNAL_INFO (i
) != NULL
)
401 for (rn
= route_top (EXTERNAL_INFO (i
)); rn
; rn
= route_next (rn
))
403 if (rn
->info
== NULL
)
406 XFREE (MTYPE_OSPF_EXTERNAL_INFO
, rn
->info
);
408 route_unlock_node (rn
);
411 ospf_distance_reset (ospf
);
412 route_table_finish (ospf
->distance_table
);
416 XFREE (MTYPE_OSPF_TOP
, ospf
);
420 /* allocate new OSPF Area object */
421 static struct ospf_area
*
422 ospf_area_new (struct ospf
*ospf
, struct in_addr area_id
)
424 struct ospf_area
*new;
426 /* Allocate new config_network. */
427 new = XCALLOC (MTYPE_OSPF_AREA
, sizeof (struct ospf_area
));
431 new->area_id
= area_id
;
433 new->external_routing
= OSPF_AREA_DEFAULT
;
434 new->default_cost
= 1;
435 new->auth_type
= OSPF_AUTH_NULL
;
438 new->lsdb
= ospf_lsdb_new ();
440 /* Self-originated LSAs initialize. */
441 new->router_lsa_self
= NULL
;
443 #ifdef HAVE_OPAQUE_LSA
444 ospf_opaque_type10_lsa_init (new);
445 #endif /* HAVE_OPAQUE_LSA */
447 new->oiflist
= list_new ();
448 new->ranges
= route_table_init ();
450 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
451 ospf
->backbone
= new;
457 ospf_area_free (struct ospf_area
*area
)
459 struct route_node
*rn
;
460 struct ospf_lsa
*lsa
;
463 LSDB_LOOP (ROUTER_LSDB (area
), rn
, lsa
)
464 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
465 LSDB_LOOP (NETWORK_LSDB (area
), rn
, lsa
)
466 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
467 LSDB_LOOP (SUMMARY_LSDB (area
), rn
, lsa
)
468 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
469 LSDB_LOOP (ASBR_SUMMARY_LSDB (area
), rn
, lsa
)
470 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
472 LSDB_LOOP (NSSA_LSDB (area
), rn
, lsa
)
473 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
474 #ifdef HAVE_OPAQUE_LSA
475 LSDB_LOOP (OPAQUE_AREA_LSDB (area
), rn
, lsa
)
476 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
477 LSDB_LOOP (OPAQUE_LINK_LSDB (area
), rn
, lsa
)
478 ospf_discard_from_db (area
->ospf
, area
->lsdb
, lsa
);
479 #endif /* HAVE_OPAQUE_LSA */
481 ospf_lsdb_delete_all (area
->lsdb
);
482 ospf_lsdb_free (area
->lsdb
);
484 ospf_lsa_unlock (area
->router_lsa_self
);
486 route_table_finish (area
->ranges
);
487 list_delete (area
->oiflist
);
489 if (EXPORT_NAME (area
))
490 free (EXPORT_NAME (area
));
492 if (IMPORT_NAME (area
))
493 free (IMPORT_NAME (area
));
496 OSPF_TIMER_OFF (area
->t_router_lsa_self
);
498 if (OSPF_IS_AREA_BACKBONE (area
))
499 area
->ospf
->backbone
= NULL
;
501 XFREE (MTYPE_OSPF_AREA
, area
);
505 ospf_area_check_free (struct ospf
*ospf
, struct in_addr area_id
)
507 struct ospf_area
*area
;
509 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
511 listcount (area
->oiflist
) == 0 &&
512 area
->ranges
->top
== NULL
&&
513 area
->shortcut_configured
== OSPF_SHORTCUT_DEFAULT
&&
514 area
->external_routing
== OSPF_AREA_DEFAULT
&&
515 area
->no_summary
== 0 &&
516 area
->default_cost
== 1 &&
517 EXPORT_NAME (area
) == NULL
&&
518 IMPORT_NAME (area
) == NULL
&&
519 area
->auth_type
== OSPF_AUTH_NULL
)
521 listnode_delete (ospf
->areas
, area
);
522 ospf_area_free (area
);
527 ospf_area_get (struct ospf
*ospf
, struct in_addr area_id
, int format
)
529 struct ospf_area
*area
;
531 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
534 area
= ospf_area_new (ospf
, area_id
);
535 area
->format
= format
;
536 listnode_add_sort (ospf
->areas
, area
);
537 ospf_check_abr_status (ospf
);
544 ospf_area_lookup_by_area_id (struct ospf
*ospf
, struct in_addr area_id
)
546 struct ospf_area
*area
;
547 struct listnode
*node
;
549 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
550 if (IPV4_ADDR_SAME (&area
->area_id
, &area_id
))
557 ospf_area_add_if (struct ospf_area
*area
, struct ospf_interface
*oi
)
559 listnode_add (area
->oiflist
, oi
);
563 ospf_area_del_if (struct ospf_area
*area
, struct ospf_interface
*oi
)
565 listnode_delete (area
->oiflist
, oi
);
569 /* Config network statement related functions. */
570 static struct ospf_network
*
571 ospf_network_new (struct in_addr area_id
, int format
)
573 struct ospf_network
*new;
574 new = XCALLOC (MTYPE_OSPF_NETWORK
, sizeof (struct ospf_network
));
576 new->area_id
= area_id
;
577 new->format
= format
;
583 ospf_network_free (struct ospf
*ospf
, struct ospf_network
*network
)
585 ospf_area_check_free (ospf
, network
->area_id
);
586 ospf_schedule_abr_task (ospf
);
587 XFREE (MTYPE_OSPF_NETWORK
, network
);
591 ospf_network_set (struct ospf
*ospf
, struct prefix_ipv4
*p
,
592 struct in_addr area_id
)
594 struct ospf_network
*network
;
595 struct ospf_area
*area
;
596 struct route_node
*rn
;
597 struct external_info
*ei
;
598 int ret
= OSPF_AREA_ID_FORMAT_ADDRESS
;
600 rn
= route_node_get (ospf
->networks
, (struct prefix
*)p
);
603 /* There is already same network statement. */
604 route_unlock_node (rn
);
608 rn
->info
= network
= ospf_network_new (area_id
, ret
);
609 area
= ospf_area_get (ospf
, area_id
, ret
);
611 /* Run network config now. */
612 ospf_network_run (ospf
, (struct prefix
*)p
, area
);
614 /* Update connected redistribute. */
615 if (ospf_is_type_redistributed (ZEBRA_ROUTE_CONNECT
))
616 if (EXTERNAL_INFO (ZEBRA_ROUTE_CONNECT
))
617 for (rn
= route_top (EXTERNAL_INFO (ZEBRA_ROUTE_CONNECT
));
618 rn
; rn
= route_next (rn
))
619 if ((ei
= rn
->info
) != NULL
)
620 if (ospf_external_info_find_lsa (ospf
, &ei
->p
))
621 if (!ospf_distribute_check_connected (ospf
, ei
))
622 ospf_external_lsa_flush (ospf
, ei
->type
, &ei
->p
,
623 ei
->ifindex
, ei
->nexthop
);
625 ospf_area_check_free (ospf
, area_id
);
631 ospf_network_unset (struct ospf
*ospf
, struct prefix_ipv4
*p
,
632 struct in_addr area_id
)
634 struct route_node
*rn
;
635 struct ospf_network
*network
;
636 struct external_info
*ei
;
638 rn
= route_node_lookup (ospf
->networks
, (struct prefix
*)p
);
643 if (!IPV4_ADDR_SAME (&area_id
, &network
->area_id
))
646 ospf_network_free (ospf
, rn
->info
);
648 route_unlock_node (rn
);
650 ospf_if_update (ospf
);
652 /* Update connected redistribute. */
653 if (ospf_is_type_redistributed (ZEBRA_ROUTE_CONNECT
))
654 if (EXTERNAL_INFO (ZEBRA_ROUTE_CONNECT
))
655 for (rn
= route_top (EXTERNAL_INFO (ZEBRA_ROUTE_CONNECT
));
656 rn
; rn
= route_next (rn
))
657 if ((ei
= rn
->info
) != NULL
)
658 if (!ospf_external_info_find_lsa (ospf
, &ei
->p
))
659 if (ospf_distribute_check_connected (ospf
, ei
))
660 ospf_external_lsa_originate (ospf
, ei
);
665 /* Check whether interface matches given network
666 * returns: 1, true. 0, false
669 ospf_network_match_iface(struct connected
*co
, struct prefix
*net
)
671 /* Behaviour to match both Cisco where:
672 * iface address lies within network specified -> ospf
673 * and zebra 0.9[2ish-3]:
674 * PtP special case: network specified == iface peer addr -> ospf
677 /* For PtP, match if peer address matches network address exactly.
678 * This can be addr/32 or addr/p for p < 32, but the addr must match
679 * exactly; this is not a test for falling within the prefix. This
680 * test is solely for compatibility with zebra.
682 if (if_is_pointopoint (co
->ifp
) && co
->destination
&&
683 IPV4_ADDR_SAME ( &(co
->destination
->u
.prefix4
), &(net
->u
.prefix4
)))
687 /* Decline to accept PtP if dst address does not match the
688 * prefix. (ifdefed out because this is a workaround, not the
689 * desired behavior.) */
690 if (if_is_pointopoint (co
->ifp
) &&
691 ! prefix_match (net
, co
->destination
))
695 /* If the address is within the prefix, accept. Note that this
696 * applies to PtP as well as other types.
698 if (prefix_match (net
, co
->address
))
701 return 0; /* no match */
705 ospf_network_run (struct ospf
*ospf
, struct prefix
*p
, struct ospf_area
*area
)
707 struct interface
*ifp
;
708 struct connected
*co
;
709 struct listnode
*node
;
711 /* Schedule Router ID Update. */
712 if (ospf
->router_id_static
.s_addr
== 0)
713 if (ospf
->t_router_id_update
== NULL
)
715 OSPF_TIMER_ON (ospf
->t_router_id_update
, ospf_router_id_update_timer
,
716 OSPF_ROUTER_ID_UPDATE_DELAY
);
719 /* Get target interface. */
720 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
722 struct listnode
*cnode
;
724 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
727 /* if interface prefix is match specified prefix,
728 then create socket and join multicast group. */
729 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, cnode
, co
))
733 if (CHECK_FLAG(co
->flags
,ZEBRA_IFA_SECONDARY
))
736 if (CONNECTED_POINTOPOINT_HOST(co
))
737 addr
= co
->destination
;
741 if (p
->family
== co
->address
->family
742 && ! ospf_if_is_configured (ospf
, &(addr
->u
.prefix4
))
743 && ospf_network_match_iface(co
,p
))
745 struct ospf_interface
*oi
;
747 oi
= ospf_if_new (ospf
, ifp
, co
->address
);
750 oi
->nbr_self
->address
= *oi
->address
;
754 oi
->params
= ospf_lookup_if_params (ifp
, oi
->address
->u
.prefix4
);
755 oi
->output_cost
= ospf_if_get_output_cost (oi
);
757 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
758 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
759 oi
->nbr_self
->priority
= OSPF_IF_PARAM (oi
, priority
);
761 /* Add pseudo neighbor. */
762 ospf_nbr_add_self (oi
);
764 /* Make sure pseudo neighbor's router_id. */
765 oi
->nbr_self
->router_id
= ospf
->router_id
;
766 oi
->nbr_self
->src
= oi
->address
->u
.prefix4
;
768 /* Relate ospf interface to ospf instance. */
771 /* update network type as interface flag */
772 /* If network type is specified previously,
773 skip network type setting. */
774 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
777 switch (area
->external_routing
)
779 case OSPF_AREA_DEFAULT
:
780 SET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
783 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
786 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
787 SET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_NP
);
791 ospf_area_add_if (oi
->area
, oi
);
793 if (if_is_operative (ifp
))
803 ospf_ls_upd_queue_empty (struct ospf_interface
*oi
)
805 struct route_node
*rn
;
806 struct listnode
*node
, *nnode
;
808 struct ospf_lsa
*lsa
;
810 /* empty ls update queue */
811 for (rn
= route_top (oi
->ls_upd_queue
); rn
;
812 rn
= route_next (rn
))
813 if ((lst
= (struct list
*) rn
->info
))
815 for (ALL_LIST_ELEMENTS (lst
, node
, nnode
, lsa
))
816 ospf_lsa_unlock (lsa
);
821 /* remove update event */
822 if (oi
->t_ls_upd_event
)
824 thread_cancel (oi
->t_ls_upd_event
);
825 oi
->t_ls_upd_event
= NULL
;
830 ospf_if_update (struct ospf
*ospf
)
832 struct route_node
*rn
;
833 struct listnode
*node
, *nnode
;
834 struct ospf_network
*network
;
835 struct ospf_area
*area
;
836 struct ospf_interface
*oi
;
840 /* Update Router ID scheduled. */
841 if (ospf
->router_id_static
.s_addr
== 0)
842 if (ospf
->t_router_id_update
== NULL
)
844 OSPF_TIMER_ON (ospf
->t_router_id_update
,
845 ospf_router_id_update_timer
,
846 OSPF_ROUTER_ID_UPDATE_DELAY
);
849 /* Find interfaces that not configured already. */
850 for (ALL_LIST_ELEMENTS (ospf
->oiflist
, node
, nnode
, oi
))
853 struct connected
*co
= oi
->connected
;
855 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
858 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
860 if (rn
->info
== NULL
)
863 if (ospf_network_match_iface(co
,&rn
->p
))
866 route_unlock_node (rn
);
875 /* Run each interface. */
876 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
877 if (rn
->info
!= NULL
)
879 network
= (struct ospf_network
*) rn
->info
;
880 area
= ospf_area_get (ospf
, network
->area_id
, network
->format
);
881 ospf_network_run (ospf
, &rn
->p
, area
);
887 ospf_remove_vls_through_area (struct ospf
*ospf
, struct ospf_area
*area
)
889 struct listnode
*node
, *nnode
;
890 struct ospf_vl_data
*vl_data
;
892 for (ALL_LIST_ELEMENTS (ospf
->vlinks
, node
, nnode
, vl_data
))
893 if (IPV4_ADDR_SAME (&vl_data
->vl_area_id
, &area
->area_id
))
894 ospf_vl_delete (ospf
, vl_data
);
898 struct message ospf_area_type_msg
[] =
900 { OSPF_AREA_DEFAULT
, "Default" },
901 { OSPF_AREA_STUB
, "Stub" },
902 { OSPF_AREA_NSSA
, "NSSA" },
904 int ospf_area_type_msg_max
= OSPF_AREA_TYPE_MAX
;
907 ospf_area_type_set (struct ospf_area
*area
, int type
)
909 struct listnode
*node
;
910 struct ospf_interface
*oi
;
912 if (area
->external_routing
== type
)
914 if (IS_DEBUG_OSPF_EVENT
)
915 zlog_debug ("Area[%s]: Types are the same, ignored.",
916 inet_ntoa (area
->area_id
));
920 area
->external_routing
= type
;
922 if (IS_DEBUG_OSPF_EVENT
)
923 zlog_debug ("Area[%s]: Configured as %s", inet_ntoa (area
->area_id
),
924 LOOKUP (ospf_area_type_msg
, type
));
926 switch (area
->external_routing
)
928 case OSPF_AREA_DEFAULT
:
929 for (ALL_LIST_ELEMENTS_RO (area
->oiflist
, node
, oi
))
930 if (oi
->nbr_self
!= NULL
)
932 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_NP
);
933 SET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
937 for (ALL_LIST_ELEMENTS_RO (area
->oiflist
, node
, oi
))
938 if (oi
->nbr_self
!= NULL
)
940 if (IS_DEBUG_OSPF_EVENT
)
941 zlog_debug ("setting options on %s accordingly", IF_NAME (oi
));
942 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_NP
);
943 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
944 if (IS_DEBUG_OSPF_EVENT
)
945 zlog_debug ("options set on %s: %x",
946 IF_NAME (oi
), OPTIONS (oi
));
950 for (ALL_LIST_ELEMENTS_RO (area
->oiflist
, node
, oi
))
951 if (oi
->nbr_self
!= NULL
)
953 zlog_debug ("setting nssa options on %s accordingly", IF_NAME (oi
));
954 UNSET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_E
);
955 SET_FLAG (oi
->nbr_self
->options
, OSPF_OPTION_NP
);
956 zlog_debug ("options set on %s: %x", IF_NAME (oi
), OPTIONS (oi
));
963 ospf_router_lsa_timer_add (area
);
964 ospf_schedule_abr_task (area
->ospf
);
968 ospf_area_shortcut_set (struct ospf
*ospf
, struct ospf_area
*area
, int mode
)
970 if (area
->shortcut_configured
== mode
)
973 area
->shortcut_configured
= mode
;
974 ospf_router_lsa_timer_add (area
);
975 ospf_schedule_abr_task (ospf
);
977 ospf_area_check_free (ospf
, area
->area_id
);
983 ospf_area_shortcut_unset (struct ospf
*ospf
, struct ospf_area
*area
)
985 area
->shortcut_configured
= OSPF_SHORTCUT_DEFAULT
;
986 ospf_router_lsa_timer_add (area
);
987 ospf_area_check_free (ospf
, area
->area_id
);
988 ospf_schedule_abr_task (ospf
);
994 ospf_area_vlink_count (struct ospf
*ospf
, struct ospf_area
*area
)
996 struct ospf_vl_data
*vl
;
997 struct listnode
*node
;
1000 for (ALL_LIST_ELEMENTS_RO (ospf
->vlinks
, node
, vl
))
1001 if (IPV4_ADDR_SAME (&vl
->vl_area_id
, &area
->area_id
))
1008 ospf_area_stub_set (struct ospf
*ospf
, struct in_addr area_id
)
1010 struct ospf_area
*area
;
1011 int format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
1013 area
= ospf_area_get (ospf
, area_id
, format
);
1014 if (ospf_area_vlink_count (ospf
, area
))
1017 if (area
->external_routing
!= OSPF_AREA_STUB
)
1018 ospf_area_type_set (area
, OSPF_AREA_STUB
);
1024 ospf_area_stub_unset (struct ospf
*ospf
, struct in_addr area_id
)
1026 struct ospf_area
*area
;
1028 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1032 if (area
->external_routing
== OSPF_AREA_STUB
)
1033 ospf_area_type_set (area
, OSPF_AREA_DEFAULT
);
1035 ospf_area_check_free (ospf
, area_id
);
1041 ospf_area_no_summary_set (struct ospf
*ospf
, struct in_addr area_id
)
1043 struct ospf_area
*area
;
1044 int format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
1046 area
= ospf_area_get (ospf
, area_id
, format
);
1047 area
->no_summary
= 1;
1053 ospf_area_no_summary_unset (struct ospf
*ospf
, struct in_addr area_id
)
1055 struct ospf_area
*area
;
1057 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1061 area
->no_summary
= 0;
1062 ospf_area_check_free (ospf
, area_id
);
1068 ospf_area_nssa_set (struct ospf
*ospf
, struct in_addr area_id
)
1070 struct ospf_area
*area
;
1071 int format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
1073 area
= ospf_area_get (ospf
, area_id
, format
);
1074 if (ospf_area_vlink_count (ospf
, area
))
1077 if (area
->external_routing
!= OSPF_AREA_NSSA
)
1079 ospf_area_type_set (area
, OSPF_AREA_NSSA
);
1083 /* set NSSA area defaults */
1084 area
->no_summary
= 0;
1085 area
->NSSATranslatorRole
= OSPF_NSSA_ROLE_CANDIDATE
;
1086 area
->NSSATranslatorState
= OSPF_NSSA_TRANSLATE_DISABLED
;
1087 area
->NSSATranslatorStabilityInterval
= OSPF_NSSA_TRANS_STABLE_DEFAULT
;
1093 ospf_area_nssa_unset (struct ospf
*ospf
, struct in_addr area_id
)
1095 struct ospf_area
*area
;
1097 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1101 if (area
->external_routing
== OSPF_AREA_NSSA
)
1104 ospf_area_type_set (area
, OSPF_AREA_DEFAULT
);
1107 ospf_area_check_free (ospf
, area_id
);
1113 ospf_area_nssa_translator_role_set (struct ospf
*ospf
, struct in_addr area_id
,
1116 struct ospf_area
*area
;
1118 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1122 area
->NSSATranslatorRole
= role
;
1127 /* XXX: unused? Leave for symmetry? */
1129 ospf_area_nssa_translator_role_unset (struct ospf
*ospf
,
1130 struct in_addr area_id
)
1132 struct ospf_area
*area
;
1134 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1138 area
->NSSATranslatorRole
= OSPF_NSSA_ROLE_CANDIDATE
;
1140 ospf_area_check_free (ospf
, area_id
);
1146 ospf_area_export_list_set (struct ospf
*ospf
,
1147 struct ospf_area
*area
, const char *list_name
)
1149 struct access_list
*list
;
1150 list
= access_list_lookup (AFI_IP
, list_name
);
1152 EXPORT_LIST (area
) = list
;
1154 if (EXPORT_NAME (area
))
1155 free (EXPORT_NAME (area
));
1157 EXPORT_NAME (area
) = strdup (list_name
);
1158 ospf_schedule_abr_task (ospf
);
1164 ospf_area_export_list_unset (struct ospf
*ospf
, struct ospf_area
* area
)
1167 EXPORT_LIST (area
) = 0;
1169 if (EXPORT_NAME (area
))
1170 free (EXPORT_NAME (area
));
1172 EXPORT_NAME (area
) = NULL
;
1174 ospf_area_check_free (ospf
, area
->area_id
);
1176 ospf_schedule_abr_task (ospf
);
1182 ospf_area_import_list_set (struct ospf
*ospf
, struct ospf_area
*area
,
1185 struct access_list
*list
;
1186 list
= access_list_lookup (AFI_IP
, name
);
1188 IMPORT_LIST (area
) = list
;
1190 if (IMPORT_NAME (area
))
1191 free (IMPORT_NAME (area
));
1193 IMPORT_NAME (area
) = strdup (name
);
1194 ospf_schedule_abr_task (ospf
);
1200 ospf_area_import_list_unset (struct ospf
*ospf
, struct ospf_area
* area
)
1202 IMPORT_LIST (area
) = 0;
1204 if (IMPORT_NAME (area
))
1205 free (IMPORT_NAME (area
));
1207 IMPORT_NAME (area
) = NULL
;
1208 ospf_area_check_free (ospf
, area
->area_id
);
1210 ospf_schedule_abr_task (ospf
);
1216 ospf_timers_spf_set (struct ospf
*ospf
, u_int32_t delay
, u_int32_t hold
)
1218 ospf
->spf_delay
= delay
;
1219 ospf
->spf_holdtime
= hold
;
1225 ospf_timers_spf_unset (struct ospf
*ospf
)
1227 ospf
->spf_delay
= OSPF_SPF_DELAY_DEFAULT
;
1228 ospf
->spf_holdtime
= OSPF_SPF_HOLDTIME_DEFAULT
;
1234 ospf_timers_refresh_set (struct ospf
*ospf
, int interval
)
1238 if (ospf
->lsa_refresh_interval
== interval
)
1241 time_left
= ospf
->lsa_refresh_interval
-
1242 (time (NULL
) - ospf
->lsa_refresher_started
);
1244 if (time_left
> interval
)
1246 OSPF_TIMER_OFF (ospf
->t_lsa_refresher
);
1247 ospf
->t_lsa_refresher
=
1248 thread_add_timer (master
, ospf_lsa_refresh_walker
, ospf
, interval
);
1250 ospf
->lsa_refresh_interval
= interval
;
1256 ospf_timers_refresh_unset (struct ospf
*ospf
)
1260 time_left
= ospf
->lsa_refresh_interval
-
1261 (time (NULL
) - ospf
->lsa_refresher_started
);
1263 if (time_left
> OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
1265 OSPF_TIMER_OFF (ospf
->t_lsa_refresher
);
1266 ospf
->t_lsa_refresher
=
1267 thread_add_timer (master
, ospf_lsa_refresh_walker
, ospf
,
1268 OSPF_LSA_REFRESH_INTERVAL_DEFAULT
);
1271 ospf
->lsa_refresh_interval
= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
;
1277 static struct ospf_nbr_nbma
*
1278 ospf_nbr_nbma_new (void)
1280 struct ospf_nbr_nbma
*nbr_nbma
;
1282 nbr_nbma
= XMALLOC (MTYPE_OSPF_NEIGHBOR_STATIC
,
1283 sizeof (struct ospf_nbr_nbma
));
1284 memset (nbr_nbma
, 0, sizeof (struct ospf_nbr_nbma
));
1286 nbr_nbma
->priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
1287 nbr_nbma
->v_poll
= OSPF_POLL_INTERVAL_DEFAULT
;
1293 ospf_nbr_nbma_free (struct ospf_nbr_nbma
*nbr_nbma
)
1295 XFREE (MTYPE_OSPF_NEIGHBOR_STATIC
, nbr_nbma
);
1299 ospf_nbr_nbma_delete (struct ospf
*ospf
, struct ospf_nbr_nbma
*nbr_nbma
)
1301 struct route_node
*rn
;
1302 struct prefix_ipv4 p
;
1305 p
.prefix
= nbr_nbma
->addr
;
1306 p
.prefixlen
= IPV4_MAX_BITLEN
;
1308 rn
= route_node_lookup (ospf
->nbr_nbma
, (struct prefix
*)&p
);
1311 ospf_nbr_nbma_free (rn
->info
);
1313 route_unlock_node (rn
);
1314 route_unlock_node (rn
);
1319 ospf_nbr_nbma_down (struct ospf_nbr_nbma
*nbr_nbma
)
1321 OSPF_TIMER_OFF (nbr_nbma
->t_poll
);
1325 nbr_nbma
->nbr
->nbr_nbma
= NULL
;
1326 OSPF_NSM_EVENT_EXECUTE (nbr_nbma
->nbr
, NSM_KillNbr
);
1330 listnode_delete (nbr_nbma
->oi
->nbr_nbma
, nbr_nbma
);
1334 ospf_nbr_nbma_add (struct ospf_nbr_nbma
*nbr_nbma
,
1335 struct ospf_interface
*oi
)
1337 struct ospf_neighbor
*nbr
;
1338 struct route_node
*rn
;
1341 if (oi
->type
!= OSPF_IFTYPE_NBMA
)
1344 if (nbr_nbma
->nbr
!= NULL
)
1347 if (IPV4_ADDR_SAME (&oi
->nbr_self
->address
.u
.prefix4
, &nbr_nbma
->addr
))
1351 listnode_add (oi
->nbr_nbma
, nbr_nbma
);
1353 /* Get neighbor information from table. */
1355 p
.prefixlen
= IPV4_MAX_BITLEN
;
1356 p
.u
.prefix4
= nbr_nbma
->addr
;
1358 rn
= route_node_get (oi
->nbrs
, (struct prefix
*)&p
);
1362 nbr
->nbr_nbma
= nbr_nbma
;
1363 nbr_nbma
->nbr
= nbr
;
1365 route_unlock_node (rn
);
1369 nbr
= rn
->info
= ospf_nbr_new (oi
);
1370 nbr
->state
= NSM_Down
;
1371 nbr
->src
= nbr_nbma
->addr
;
1372 nbr
->nbr_nbma
= nbr_nbma
;
1373 nbr
->priority
= nbr_nbma
->priority
;
1376 nbr_nbma
->nbr
= nbr
;
1378 OSPF_NSM_EVENT_EXECUTE (nbr
, NSM_Start
);
1383 ospf_nbr_nbma_if_update (struct ospf
*ospf
, struct ospf_interface
*oi
)
1385 struct ospf_nbr_nbma
*nbr_nbma
;
1386 struct route_node
*rn
;
1387 struct prefix_ipv4 p
;
1389 if (oi
->type
!= OSPF_IFTYPE_NBMA
)
1392 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
1393 if ((nbr_nbma
= rn
->info
))
1394 if (nbr_nbma
->oi
== NULL
&& nbr_nbma
->nbr
== NULL
)
1397 p
.prefix
= nbr_nbma
->addr
;
1398 p
.prefixlen
= IPV4_MAX_BITLEN
;
1400 if (prefix_match (oi
->address
, (struct prefix
*)&p
))
1401 ospf_nbr_nbma_add (nbr_nbma
, oi
);
1405 struct ospf_nbr_nbma
*
1406 ospf_nbr_nbma_lookup (struct ospf
*ospf
, struct in_addr nbr_addr
)
1408 struct route_node
*rn
;
1409 struct prefix_ipv4 p
;
1412 p
.prefix
= nbr_addr
;
1413 p
.prefixlen
= IPV4_MAX_BITLEN
;
1415 rn
= route_node_lookup (ospf
->nbr_nbma
, (struct prefix
*)&p
);
1418 route_unlock_node (rn
);
1424 struct ospf_nbr_nbma
*
1425 ospf_nbr_nbma_lookup_next (struct ospf
*ospf
, struct in_addr
*addr
, int first
)
1428 struct ospf_nbr_nbma
*nbr_nbma
;
1429 struct listnode
*node
;
1436 for (ALL_LIST_ELEMENTS_RO (ospf
->nbr_nbma
, node
, nbr_nbma
))
1440 *addr
= nbr_nbma
->addr
;
1443 else if (ntohl (nbr_nbma
->addr
.s_addr
) > ntohl (addr
->s_addr
))
1445 *addr
= nbr_nbma
->addr
;
1454 ospf_nbr_nbma_set (struct ospf
*ospf
, struct in_addr nbr_addr
)
1456 struct ospf_nbr_nbma
*nbr_nbma
;
1457 struct ospf_interface
*oi
;
1458 struct prefix_ipv4 p
;
1459 struct route_node
*rn
;
1460 struct listnode
*node
;
1462 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, nbr_addr
);
1466 nbr_nbma
= ospf_nbr_nbma_new ();
1467 nbr_nbma
->addr
= nbr_addr
;
1470 p
.prefix
= nbr_addr
;
1471 p
.prefixlen
= IPV4_MAX_BITLEN
;
1473 rn
= route_node_get (ospf
->nbr_nbma
, (struct prefix
*)&p
);
1474 rn
->info
= nbr_nbma
;
1476 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
1478 if (oi
->type
== OSPF_IFTYPE_NBMA
)
1479 if (prefix_match (oi
->address
, (struct prefix
*)&p
))
1481 ospf_nbr_nbma_add (nbr_nbma
, oi
);
1490 ospf_nbr_nbma_unset (struct ospf
*ospf
, struct in_addr nbr_addr
)
1492 struct ospf_nbr_nbma
*nbr_nbma
;
1494 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, nbr_addr
);
1495 if (nbr_nbma
== NULL
)
1498 ospf_nbr_nbma_down (nbr_nbma
);
1499 ospf_nbr_nbma_delete (ospf
, nbr_nbma
);
1505 ospf_nbr_nbma_priority_set (struct ospf
*ospf
, struct in_addr nbr_addr
,
1508 struct ospf_nbr_nbma
*nbr_nbma
;
1510 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, nbr_addr
);
1511 if (nbr_nbma
== NULL
)
1514 if (nbr_nbma
->priority
!= priority
)
1515 nbr_nbma
->priority
= priority
;
1521 ospf_nbr_nbma_priority_unset (struct ospf
*ospf
, struct in_addr nbr_addr
)
1523 struct ospf_nbr_nbma
*nbr_nbma
;
1525 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, nbr_addr
);
1526 if (nbr_nbma
== NULL
)
1529 if (nbr_nbma
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
1530 nbr_nbma
->priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
1536 ospf_nbr_nbma_poll_interval_set (struct ospf
*ospf
, struct in_addr nbr_addr
,
1537 unsigned int interval
)
1539 struct ospf_nbr_nbma
*nbr_nbma
;
1541 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, nbr_addr
);
1542 if (nbr_nbma
== NULL
)
1545 if (nbr_nbma
->v_poll
!= interval
)
1547 nbr_nbma
->v_poll
= interval
;
1548 if (nbr_nbma
->oi
&& ospf_if_is_up (nbr_nbma
->oi
))
1550 OSPF_TIMER_OFF (nbr_nbma
->t_poll
);
1551 OSPF_POLL_TIMER_ON (nbr_nbma
->t_poll
, ospf_poll_timer
,
1560 ospf_nbr_nbma_poll_interval_unset (struct ospf
*ospf
, struct in_addr addr
)
1562 struct ospf_nbr_nbma
*nbr_nbma
;
1564 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, addr
);
1565 if (nbr_nbma
== NULL
)
1568 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
1569 nbr_nbma
->v_poll
= OSPF_POLL_INTERVAL_DEFAULT
;
1577 memset (&ospf_master
, 0, sizeof (struct ospf_master
));
1580 om
->ospf
= list_new ();
1581 om
->master
= thread_master_create ();
1582 om
->start_time
= time (NULL
);