2 * OSPF Interface functions.
3 * Copyright (C) 1999, 2000 Toshiaki Takada
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
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.
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
37 #include "ospfd/ospfd.h"
38 #include "ospfd/ospf_bfd.h"
39 #include "ospfd/ospf_spf.h"
40 #include "ospfd/ospf_interface.h"
41 #include "ospfd/ospf_ism.h"
42 #include "ospfd/ospf_asbr.h"
43 #include "ospfd/ospf_lsa.h"
44 #include "ospfd/ospf_lsdb.h"
45 #include "ospfd/ospf_neighbor.h"
46 #include "ospfd/ospf_nsm.h"
47 #include "ospfd/ospf_packet.h"
48 #include "ospfd/ospf_abr.h"
49 #include "ospfd/ospf_network.h"
50 #include "ospfd/ospf_dump.h"
51 #include "ospfd/ospf_ldp_sync.h"
52 #include "ospfd/ospf_route.h"
53 #include "ospfd/ospf_te.h"
55 DEFINE_QOBJ_TYPE(ospf_interface
);
56 DEFINE_HOOK(ospf_vl_add
, (struct ospf_vl_data
* vd
), (vd
));
57 DEFINE_HOOK(ospf_vl_delete
, (struct ospf_vl_data
* vd
), (vd
));
58 DEFINE_HOOK(ospf_if_update
, (struct interface
* ifp
), (ifp
));
59 DEFINE_HOOK(ospf_if_delete
, (struct interface
* ifp
), (ifp
));
61 int ospf_interface_neighbor_count(struct ospf_interface
*oi
)
64 struct route_node
*rn
;
65 struct ospf_neighbor
*nbr
= NULL
;
67 for (rn
= route_top(oi
->nbrs
); rn
; rn
= route_next(rn
)) {
70 /* Do not show myself. */
71 if (nbr
== oi
->nbr_self
)
73 /* Down state is not shown. */
74 if (nbr
->state
== NSM_Down
)
83 int ospf_if_get_output_cost(struct ospf_interface
*oi
)
85 /* If all else fails, use default OSPF cost */
89 /* if LDP-IGP Sync is running on interface set cost so interface
90 * is used only as last resort
92 if (ldp_sync_if_is_enabled(IF_DEF_PARAMS(oi
->ifp
)->ldp_sync_info
))
93 return (LDP_OSPF_LSINFINITY
);
95 /* ifp speed and bw can be 0 in some platforms, use ospf default bw
96 if bw is configured under interface it would be used.
98 if (!oi
->ifp
->bandwidth
&& oi
->ifp
->speed
)
101 bw
= oi
->ifp
->bandwidth
? oi
->ifp
->bandwidth
102 : OSPF_DEFAULT_BANDWIDTH
;
103 refbw
= oi
->ospf
->ref_bandwidth
;
105 /* A specifed ip ospf cost overrides a calculated one. */
106 if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(oi
->ifp
), output_cost_cmd
)
107 || OSPF_IF_PARAM_CONFIGURED(oi
->params
, output_cost_cmd
))
108 cost
= OSPF_IF_PARAM(oi
, output_cost_cmd
);
109 /* See if a cost can be calculated from the zebra processes
110 interface bandwidth field. */
112 cost
= (uint32_t)((double)refbw
/ (double)bw
+ (double)0.5);
115 else if (cost
> 65535)
122 void ospf_if_recalculate_output_cost(struct interface
*ifp
)
125 struct route_node
*rn
;
127 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
128 struct ospf_interface
*oi
;
130 if ((oi
= rn
->info
) == NULL
)
133 newcost
= ospf_if_get_output_cost(oi
);
135 /* Is actual output cost changed? */
136 if (oi
->output_cost
!= newcost
) {
137 oi
->output_cost
= newcost
;
138 ospf_router_lsa_update_area(oi
->area
);
143 /* Simulate down/up on the interface. This is needed, for example, when
145 void ospf_if_reset(struct interface
*ifp
)
147 struct route_node
*rn
;
149 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
150 struct ospf_interface
*oi
;
152 if ((oi
= rn
->info
) == NULL
)
160 void ospf_if_reset_variables(struct ospf_interface
*oi
)
162 /* Set default values. */
163 /* don't clear this flag. oi->flag = OSPF_IF_DISABLE; */
166 oi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
168 /* preserve network-type */
169 if (oi
->type
!= OSPF_IFTYPE_NBMA
)
170 oi
->type
= OSPF_IFTYPE_BROADCAST
;
172 oi
->state
= ISM_Down
;
174 oi
->crypt_seqnum
= 0;
176 /* This must be short, (less than RxmtInterval)
177 - RFC 2328 Section 13.5 para 3. Set to 1 second to avoid Acks being
178 held back for too long - MAG */
182 /* lookup oi for specified prefix/ifp */
183 struct ospf_interface
*ospf_if_table_lookup(struct interface
*ifp
,
184 struct prefix
*prefix
)
187 struct route_node
*rn
;
188 struct ospf_interface
*rninfo
= NULL
;
191 p
.prefixlen
= IPV4_MAX_BITLEN
;
193 /* route_node_get implicitely locks */
194 if ((rn
= route_node_lookup(IF_OIFS(ifp
), &p
))) {
195 rninfo
= (struct ospf_interface
*)rn
->info
;
196 route_unlock_node(rn
);
202 static void ospf_add_to_if(struct interface
*ifp
, struct ospf_interface
*oi
)
204 struct route_node
*rn
;
208 p
.prefixlen
= IPV4_MAX_BITLEN
;
211 rn
= route_node_get(IF_OIFS(ifp
), &p
);
212 /* rn->info should either be NULL or equal to this oi
213 * as route_node_get may return an existing node
215 assert(!rn
->info
|| rn
->info
== oi
);
219 static void ospf_delete_from_if(struct interface
*ifp
,
220 struct ospf_interface
*oi
)
222 struct route_node
*rn
;
226 p
.prefixlen
= IPV4_MAX_BITLEN
;
228 rn
= route_node_lookup(IF_OIFS(oi
->ifp
), &p
);
232 route_unlock_node(rn
);
233 route_unlock_node(rn
);
236 struct ospf_interface
*ospf_if_new(struct ospf
*ospf
, struct interface
*ifp
,
239 struct ospf_interface
*oi
;
241 oi
= ospf_if_table_lookup(ifp
, p
);
245 oi
= XCALLOC(MTYPE_OSPF_IF
, sizeof(struct ospf_interface
));
247 oi
->obuf
= ospf_fifo_new();
249 /* Set zebra interface pointer. */
253 ospf_add_to_if(ifp
, oi
);
254 listnode_add(ospf
->oiflist
, oi
);
256 /* Initialize neighbor list. */
257 oi
->nbrs
= route_table_init();
259 /* Initialize static neighbor list. */
260 oi
->nbr_nbma
= list_new();
262 /* Initialize Link State Acknowledgment list. */
263 oi
->ls_ack
= list_new();
264 oi
->ls_ack_direct
.ls_ack
= list_new();
266 /* Set default values. */
267 ospf_if_reset_variables(oi
);
269 /* Set pseudo neighbor to Null */
272 oi
->ls_upd_queue
= route_table_init();
273 oi
->t_ls_upd_event
= NULL
;
274 oi
->t_ls_ack_direct
= NULL
;
276 oi
->crypt_seqnum
= time(NULL
);
278 ospf_opaque_type9_lsa_init(oi
);
282 QOBJ_REG(oi
, ospf_interface
);
284 if (IS_DEBUG_OSPF_EVENT
)
285 zlog_debug("%s: ospf interface %s vrf %s id %u created",
286 __func__
, ifp
->name
, ospf_get_name(ospf
),
292 /* Restore an interface to its pre UP state
293 Used from ism_interface_down only */
294 void ospf_if_cleanup(struct ospf_interface
*oi
)
296 struct route_node
*rn
;
297 struct listnode
*node
, *nnode
;
298 struct ospf_neighbor
*nbr
;
299 struct ospf_nbr_nbma
*nbr_nbma
;
300 struct ospf_lsa
*lsa
;
302 /* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
303 /* delete all static neighbors attached to this interface */
304 for (ALL_LIST_ELEMENTS(oi
->nbr_nbma
, node
, nnode
, nbr_nbma
)) {
305 OSPF_POLL_TIMER_OFF(nbr_nbma
->t_poll
);
308 nbr_nbma
->nbr
->nbr_nbma
= NULL
;
309 nbr_nbma
->nbr
= NULL
;
314 listnode_delete(oi
->nbr_nbma
, nbr_nbma
);
317 /* send Neighbor event KillNbr to all associated neighbors. */
318 for (rn
= route_top(oi
->nbrs
); rn
; rn
= route_next(rn
))
319 if ((nbr
= rn
->info
) != NULL
)
320 if (nbr
!= oi
->nbr_self
)
321 OSPF_NSM_EVENT_EXECUTE(nbr
, NSM_KillNbr
);
323 /* Cleanup Link State Acknowlegdment list. */
324 for (ALL_LIST_ELEMENTS(oi
->ls_ack
, node
, nnode
, lsa
))
325 ospf_lsa_unlock(&lsa
); /* oi->ls_ack */
326 list_delete_all_node(oi
->ls_ack
);
328 oi
->crypt_seqnum
= 0;
330 /* Empty link state update queue */
331 ospf_ls_upd_queue_empty(oi
);
333 /* Reset pseudo neighbor. */
334 ospf_nbr_self_reset(oi
, oi
->ospf
->router_id
);
337 void ospf_if_free(struct ospf_interface
*oi
)
341 ospf_fifo_free(oi
->obuf
);
343 assert(oi
->state
== ISM_Down
);
345 ospf_opaque_type9_lsa_term(oi
);
349 /* Free Pseudo Neighbour */
350 ospf_nbr_delete(oi
->nbr_self
);
352 route_table_finish(oi
->nbrs
);
353 route_table_finish(oi
->ls_upd_queue
);
355 /* Free any lists that should be freed */
356 list_delete(&oi
->nbr_nbma
);
358 list_delete(&oi
->ls_ack
);
359 list_delete(&oi
->ls_ack_direct
.ls_ack
);
361 if (IS_DEBUG_OSPF_EVENT
)
362 zlog_debug("%s: ospf interface %s vrf %s id %u deleted",
363 __func__
, oi
->ifp
->name
, oi
->ifp
->vrf
->name
,
364 oi
->ifp
->vrf
->vrf_id
);
366 ospf_delete_from_if(oi
->ifp
, oi
);
368 listnode_delete(oi
->ospf
->oiflist
, oi
);
369 listnode_delete(oi
->area
->oiflist
, oi
);
371 thread_cancel_event(master
, oi
);
373 memset(oi
, 0, sizeof(*oi
));
374 XFREE(MTYPE_OSPF_IF
, oi
);
377 int ospf_if_is_up(struct ospf_interface
*oi
)
379 return if_is_up(oi
->ifp
);
382 struct ospf_interface
*ospf_if_exists(struct ospf_interface
*oic
)
384 struct listnode
*node
;
386 struct ospf_interface
*oi
;
395 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
402 /* Lookup OSPF interface by router LSA posistion */
403 struct ospf_interface
*ospf_if_lookup_by_lsa_pos(struct ospf_area
*area
,
406 struct listnode
*node
;
407 struct ospf_interface
*oi
;
409 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, node
, oi
)) {
410 if (lsa_pos
>= oi
->lsa_pos_beg
&& lsa_pos
< oi
->lsa_pos_end
)
416 struct ospf_interface
*ospf_if_lookup_by_local_addr(struct ospf
*ospf
,
417 struct interface
*ifp
,
418 struct in_addr address
)
420 struct listnode
*node
;
421 struct ospf_interface
*oi
;
423 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
424 if (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
) {
425 if (ifp
&& oi
->ifp
!= ifp
)
428 if (IPV4_ADDR_SAME(&address
, &oi
->address
->u
.prefix4
))
435 struct ospf_interface
*ospf_if_lookup_by_prefix(struct ospf
*ospf
,
436 struct prefix_ipv4
*p
)
438 struct listnode
*node
;
439 struct ospf_interface
*oi
;
441 /* Check each Interface. */
442 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
)) {
443 if (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
) {
446 prefix_copy(&ptmp
, CONNECTED_PREFIX(oi
->connected
));
448 if (prefix_same(&ptmp
, (struct prefix
*)p
))
455 /* determine receiving interface by ifp and source address */
456 struct ospf_interface
*ospf_if_lookup_recv_if(struct ospf
*ospf
,
458 struct interface
*ifp
)
460 struct route_node
*rn
;
461 struct prefix_ipv4 addr
;
462 struct ospf_interface
*oi
, *match
;
464 addr
.family
= AF_INET
;
466 addr
.prefixlen
= IPV4_MAX_BITLEN
;
470 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
473 if (!oi
) /* oi can be NULL for PtP aliases */
476 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
479 if (if_is_loopback(oi
->ifp
))
482 if (CHECK_FLAG(oi
->connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
484 else if (prefix_match(CONNECTED_PREFIX(oi
->connected
),
485 (struct prefix
*)&addr
)) {
486 if ((match
== NULL
) || (match
->address
->prefixlen
487 < oi
->address
->prefixlen
))
495 static void ospf_if_reset_stats(struct ospf_interface
*oi
)
497 oi
->hello_in
= oi
->hello_out
= 0;
498 oi
->db_desc_in
= oi
->db_desc_out
= 0;
499 oi
->ls_req_in
= oi
->ls_req_out
= 0;
500 oi
->ls_upd_in
= oi
->ls_upd_out
= 0;
501 oi
->ls_ack_in
= oi
->ls_ack_out
= 0;
504 void ospf_if_stream_unset(struct ospf_interface
*oi
)
506 struct ospf
*ospf
= oi
->ospf
;
508 /* flush the interface packet queue */
509 ospf_fifo_flush(oi
->obuf
);
510 /*reset protocol stats */
511 ospf_if_reset_stats(oi
);
513 if (oi
->on_write_q
) {
514 listnode_delete(ospf
->oi_write_q
, oi
);
515 if (list_isempty(ospf
->oi_write_q
))
516 OSPF_TIMER_OFF(ospf
->t_write
);
522 static struct ospf_if_params
*ospf_new_if_params(void)
524 struct ospf_if_params
*oip
;
526 oip
= XCALLOC(MTYPE_OSPF_IF_PARAMS
, sizeof(struct ospf_if_params
));
528 UNSET_IF_PARAM(oip
, output_cost_cmd
);
529 UNSET_IF_PARAM(oip
, transmit_delay
);
530 UNSET_IF_PARAM(oip
, retransmit_interval
);
531 UNSET_IF_PARAM(oip
, passive_interface
);
532 UNSET_IF_PARAM(oip
, v_hello
);
533 UNSET_IF_PARAM(oip
, fast_hello
);
534 UNSET_IF_PARAM(oip
, v_wait
);
535 UNSET_IF_PARAM(oip
, priority
);
536 UNSET_IF_PARAM(oip
, type
);
537 UNSET_IF_PARAM(oip
, auth_simple
);
538 UNSET_IF_PARAM(oip
, auth_crypt
);
539 UNSET_IF_PARAM(oip
, auth_type
);
540 UNSET_IF_PARAM(oip
, if_area
);
542 oip
->auth_crypt
= list_new();
544 oip
->network_lsa_seqnum
= htonl(OSPF_INITIAL_SEQUENCE_NUMBER
);
545 oip
->is_v_wait_set
= false;
552 static void ospf_del_if_params(struct interface
*ifp
,
553 struct ospf_if_params
*oip
)
555 list_delete(&oip
->auth_crypt
);
556 ospf_interface_disable_bfd(ifp
, oip
);
557 ldp_sync_info_free(&(oip
->ldp_sync_info
));
558 XFREE(MTYPE_OSPF_IF_PARAMS
, oip
);
561 void ospf_free_if_params(struct interface
*ifp
, struct in_addr addr
)
563 struct ospf_if_params
*oip
;
564 struct prefix_ipv4 p
;
565 struct route_node
*rn
;
568 p
.prefixlen
= IPV4_MAX_BITLEN
;
570 rn
= route_node_lookup(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
571 if (!rn
|| !rn
->info
)
575 route_unlock_node(rn
);
577 if (!OSPF_IF_PARAM_CONFIGURED(oip
, output_cost_cmd
)
578 && !OSPF_IF_PARAM_CONFIGURED(oip
, transmit_delay
)
579 && !OSPF_IF_PARAM_CONFIGURED(oip
, retransmit_interval
)
580 && !OSPF_IF_PARAM_CONFIGURED(oip
, passive_interface
)
581 && !OSPF_IF_PARAM_CONFIGURED(oip
, v_hello
)
582 && !OSPF_IF_PARAM_CONFIGURED(oip
, fast_hello
)
583 && !OSPF_IF_PARAM_CONFIGURED(oip
, v_wait
)
584 && !OSPF_IF_PARAM_CONFIGURED(oip
, priority
)
585 && !OSPF_IF_PARAM_CONFIGURED(oip
, type
)
586 && !OSPF_IF_PARAM_CONFIGURED(oip
, auth_simple
)
587 && !OSPF_IF_PARAM_CONFIGURED(oip
, auth_type
)
588 && !OSPF_IF_PARAM_CONFIGURED(oip
, if_area
)
589 && listcount(oip
->auth_crypt
) == 0) {
590 ospf_del_if_params(ifp
, oip
);
592 route_unlock_node(rn
);
596 struct ospf_if_params
*ospf_lookup_if_params(struct interface
*ifp
,
599 struct prefix_ipv4 p
;
600 struct route_node
*rn
;
603 p
.prefixlen
= IPV4_MAX_BITLEN
;
606 rn
= route_node_lookup(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
609 route_unlock_node(rn
);
616 struct ospf_if_params
*ospf_get_if_params(struct interface
*ifp
,
619 struct prefix_ipv4 p
;
620 struct route_node
*rn
;
623 p
.prefixlen
= IPV4_MAX_BITLEN
;
627 rn
= route_node_get(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
629 if (rn
->info
== NULL
)
630 rn
->info
= ospf_new_if_params();
632 route_unlock_node(rn
);
637 void ospf_if_update_params(struct interface
*ifp
, struct in_addr addr
)
639 struct route_node
*rn
;
640 struct ospf_interface
*oi
;
642 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
643 if ((oi
= rn
->info
) == NULL
)
646 if (IPV4_ADDR_SAME(&oi
->address
->u
.prefix4
, &addr
))
647 oi
->params
= ospf_lookup_if_params(
648 ifp
, oi
->address
->u
.prefix4
);
652 int ospf_if_new_hook(struct interface
*ifp
)
656 ifp
->info
= XCALLOC(MTYPE_OSPF_IF_INFO
, sizeof(struct ospf_if_info
));
658 IF_OIFS(ifp
) = route_table_init();
659 IF_OIFS_PARAMS(ifp
) = route_table_init();
661 IF_DEF_PARAMS(ifp
) = ospf_new_if_params();
663 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), transmit_delay
);
664 IF_DEF_PARAMS(ifp
)->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
666 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), retransmit_interval
);
667 IF_DEF_PARAMS(ifp
)->retransmit_interval
=
668 OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
670 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), priority
);
671 IF_DEF_PARAMS(ifp
)->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
673 IF_DEF_PARAMS(ifp
)->mtu_ignore
= OSPF_MTU_IGNORE_DEFAULT
;
675 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), v_hello
);
676 IF_DEF_PARAMS(ifp
)->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
678 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), fast_hello
);
679 IF_DEF_PARAMS(ifp
)->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
681 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), v_wait
);
682 IF_DEF_PARAMS(ifp
)->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
684 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), auth_simple
);
685 memset(IF_DEF_PARAMS(ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
687 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), auth_type
);
688 IF_DEF_PARAMS(ifp
)->auth_type
= OSPF_AUTH_NOTSET
;
690 rc
= ospf_opaque_new_if(ifp
);
694 static int ospf_if_delete_hook(struct interface
*ifp
)
697 struct route_node
*rn
;
698 rc
= ospf_opaque_del_if(ifp
);
701 * This function must be called before `route_table_finish` due to
702 * BFD integration need to iterate over the interface neighbors to
703 * remove all registrations.
705 ospf_del_if_params(ifp
, IF_DEF_PARAMS(ifp
));
707 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
709 ospf_del_if_params(ifp
, rn
->info
);
711 route_table_finish(IF_OIFS(ifp
));
712 route_table_finish(IF_OIFS_PARAMS(ifp
));
714 XFREE(MTYPE_OSPF_IF_INFO
, ifp
->info
);
719 int ospf_if_is_enable(struct ospf_interface
*oi
)
721 if (!(if_is_loopback(oi
->ifp
)))
722 if (if_is_up(oi
->ifp
))
728 void ospf_if_set_multicast(struct ospf_interface
*oi
)
730 if ((oi
->state
> ISM_Loopback
) && (oi
->type
!= OSPF_IFTYPE_LOOPBACK
)
731 && (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
)
732 && (OSPF_IF_PASSIVE_STATUS(oi
) == OSPF_IF_ACTIVE
)) {
733 /* The interface should belong to the OSPF-all-routers group. */
734 if (!OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
735 && (ospf_if_add_allspfrouters(oi
->ospf
, oi
->address
,
738 /* Set the flag only if the system call to join
740 OI_MEMBER_JOINED(oi
, MEMBER_ALLROUTERS
);
742 /* The interface should NOT belong to the OSPF-all-routers
744 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)) {
745 /* Only actually drop if this is the last reference */
746 if (OI_MEMBER_COUNT(oi
, MEMBER_ALLROUTERS
) == 1)
747 ospf_if_drop_allspfrouters(oi
->ospf
,
750 /* Unset the flag regardless of whether the system call
752 the group succeeded, since it's much safer to assume
754 we are not a member. */
755 OI_MEMBER_LEFT(oi
, MEMBER_ALLROUTERS
);
759 if (((oi
->type
== OSPF_IFTYPE_BROADCAST
)
760 || (oi
->type
== OSPF_IFTYPE_POINTOPOINT
))
761 && ((oi
->state
== ISM_DR
) || (oi
->state
== ISM_Backup
))
762 && (OSPF_IF_PASSIVE_STATUS(oi
) == OSPF_IF_ACTIVE
)) {
763 /* The interface should belong to the OSPF-designated-routers
765 if (!OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
)
766 && (ospf_if_add_alldrouters(oi
->ospf
, oi
->address
,
769 /* Set the flag only if the system call to join
771 OI_MEMBER_JOINED(oi
, MEMBER_DROUTERS
);
773 /* The interface should NOT belong to the
774 * OSPF-designated-routers group */
775 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
)) {
776 /* drop only if last reference */
777 if (OI_MEMBER_COUNT(oi
, MEMBER_DROUTERS
) == 1)
778 ospf_if_drop_alldrouters(oi
->ospf
, oi
->address
,
781 /* Unset the flag regardless of whether the system call
783 the group succeeded, since it's much safer to assume
785 we are not a member. */
786 OI_MEMBER_LEFT(oi
, MEMBER_DROUTERS
);
791 int ospf_if_up(struct ospf_interface
*oi
)
796 if (oi
->type
== OSPF_IFTYPE_LOOPBACK
)
797 OSPF_ISM_EVENT_SCHEDULE(oi
, ISM_LoopInd
);
799 OSPF_ISM_EVENT_SCHEDULE(oi
, ISM_InterfaceUp
);
805 int ospf_if_down(struct ospf_interface
*oi
)
808 struct route_node
*rn
;
809 struct ospf_route
*or;
811 struct ospf_path
*op
;
818 /* Cease the HELPER role for all the neighbours
821 if (ospf
->is_helper_supported
) {
822 struct route_node
*rn
= NULL
;
824 if (ospf_interface_neighbor_count(oi
)) {
825 for (rn
= route_top(oi
->nbrs
); rn
;
826 rn
= route_next(rn
)) {
827 struct ospf_neighbor
*nbr
= NULL
;
834 if (OSPF_GR_IS_ACTIVE_HELPER(nbr
))
836 nbr
, OSPF_GR_HELPER_TOPO_CHG
);
841 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
842 /* delete position in router LSA */
845 /* Shutdown packet reception and sending */
846 ospf_if_stream_unset(oi
);
848 if (!ospf
->new_table
)
850 for (rn
= route_top(ospf
->new_table
); rn
; rn
= route_next(rn
)) {
856 for (nh
= listhead(or->paths
); nh
;
857 nh
= listnextnode_unchecked(nh
)) {
858 op
= listgetdata(nh
);
859 if (op
->ifindex
== oi
->ifp
->ifindex
) {
870 /* Virtual Link related functions. */
872 struct ospf_vl_data
*ospf_vl_data_new(struct ospf_area
*area
,
873 struct in_addr vl_peer
)
875 struct ospf_vl_data
*vl_data
;
877 vl_data
= XCALLOC(MTYPE_OSPF_VL_DATA
, sizeof(struct ospf_vl_data
));
879 vl_data
->vl_peer
.s_addr
= vl_peer
.s_addr
;
880 vl_data
->vl_area_id
= area
->area_id
;
881 vl_data
->vl_area_id_fmt
= area
->area_id_fmt
;
886 void ospf_vl_data_free(struct ospf_vl_data
*vl_data
)
888 XFREE(MTYPE_OSPF_VL_DATA
, vl_data
);
891 unsigned int vlink_count
= 0;
893 struct ospf_interface
*ospf_vl_new(struct ospf
*ospf
,
894 struct ospf_vl_data
*vl_data
)
896 struct ospf_interface
*voi
;
897 struct interface
*vi
;
898 char ifname
[INTERFACE_NAMSIZ
];
899 struct ospf_area
*area
;
900 struct in_addr area_id
;
901 struct connected
*co
;
902 struct prefix_ipv4
*p
;
904 if (IS_DEBUG_OSPF_EVENT
)
905 zlog_debug("ospf_vl_new()(%s): Start", ospf_get_name(ospf
));
906 if (vlink_count
== OSPF_VL_MAX_COUNT
) {
907 if (IS_DEBUG_OSPF_EVENT
)
909 "ospf_vl_new(): Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links");
913 if (IS_DEBUG_OSPF_EVENT
)
915 "ospf_vl_new(): creating pseudo zebra interface vrf id %u",
918 snprintf(ifname
, sizeof(ifname
), "VLINK%u", vlink_count
);
919 vi
= if_get_by_name(ifname
, ospf
->vrf_id
, ospf
->name
);
921 * if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION
922 * virtual links don't need this.
924 UNSET_FLAG(vi
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
925 co
= connected_new();
927 listnode_add(vi
->connected
, co
);
929 p
= prefix_ipv4_new();
931 p
->prefix
.s_addr
= INADDR_ANY
;
934 co
->address
= (struct prefix
*)p
;
936 voi
= ospf_if_new(ospf
, vi
, co
->address
);
938 if (IS_DEBUG_OSPF_EVENT
)
940 "ospf_vl_new(): Alarm: OSPF int structure is not created");
944 voi
->vl_data
= vl_data
;
945 voi
->ifp
->mtu
= OSPF_VL_MTU
;
946 voi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
949 if (IS_DEBUG_OSPF_EVENT
)
950 zlog_debug("ospf_vl_new(): Created name: %s", ifname
);
951 if (IS_DEBUG_OSPF_EVENT
)
952 zlog_debug("ospf_vl_new(): set if->name to %s", vi
->name
);
954 area_id
.s_addr
= INADDR_ANY
;
955 area
= ospf_area_get(ospf
, area_id
);
958 if (IS_DEBUG_OSPF_EVENT
)
960 "ospf_vl_new(): set associated area to the backbone");
962 /* Add pseudo neighbor. */
963 ospf_nbr_self_reset(voi
, voi
->ospf
->router_id
);
965 ospf_area_add_if(voi
->area
, voi
);
967 if (IS_DEBUG_OSPF_EVENT
)
968 zlog_debug("ospf_vl_new(): Stop");
972 static void ospf_vl_if_delete(struct ospf_vl_data
*vl_data
)
974 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
975 struct vrf
*vrf
= ifp
->vrf
;
977 vl_data
->vl_oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
978 vl_data
->vl_oi
->address
->prefixlen
= 0;
979 ospf_if_free(vl_data
->vl_oi
);
981 if (!vrf_is_enabled(vrf
))
986 /* for a defined area, count the number of configured vl
988 int ospf_vl_count(struct ospf
*ospf
, struct ospf_area
*area
)
991 struct ospf_vl_data
*vl_data
;
992 struct listnode
*node
;
994 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
996 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1003 /* Look up vl_data for given peer, optionally qualified to be in the
1004 * specified area. NULL area returns first found..
1006 struct ospf_vl_data
*ospf_vl_lookup(struct ospf
*ospf
, struct ospf_area
*area
,
1007 struct in_addr vl_peer
)
1009 struct ospf_vl_data
*vl_data
;
1010 struct listnode
*node
;
1012 if (IS_DEBUG_OSPF_EVENT
) {
1013 zlog_debug("%s: Looking for %pI4", __func__
, &vl_peer
);
1015 zlog_debug("%s: in area %pI4", __func__
,
1019 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1020 if (IS_DEBUG_OSPF_EVENT
)
1021 zlog_debug("%s: VL %s, peer %pI4", __func__
,
1022 vl_data
->vl_oi
->ifp
->name
,
1026 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1029 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &vl_peer
))
1036 static void ospf_vl_shutdown(struct ospf_vl_data
*vl_data
)
1038 struct ospf_interface
*oi
;
1040 if ((oi
= vl_data
->vl_oi
) == NULL
)
1043 oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
1044 oi
->address
->prefixlen
= 0;
1046 UNSET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1047 /* OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceDown); */
1048 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
1051 void ospf_vl_add(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1053 listnode_add(ospf
->vlinks
, vl_data
);
1054 hook_call(ospf_vl_add
, vl_data
);
1057 void ospf_vl_delete(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1059 ospf_vl_shutdown(vl_data
);
1060 ospf_vl_if_delete(vl_data
);
1062 hook_call(ospf_vl_delete
, vl_data
);
1063 listnode_delete(ospf
->vlinks
, vl_data
);
1065 ospf_vl_data_free(vl_data
);
1068 static int ospf_vl_set_params(struct ospf_area
*area
,
1069 struct ospf_vl_data
*vl_data
, struct vertex
*v
)
1072 struct ospf_interface
*voi
;
1073 struct listnode
*node
;
1074 struct vertex_parent
*vp
= NULL
;
1076 struct router_lsa
*rl
;
1077 struct ospf_interface
*oi
;
1079 voi
= vl_data
->vl_oi
;
1081 if (voi
->output_cost
!= v
->distance
) {
1083 voi
->output_cost
= v
->distance
;
1087 for (ALL_LIST_ELEMENTS_RO(v
->parents
, node
, vp
)) {
1088 vl_data
->nexthop
.lsa_pos
= vp
->nexthop
->lsa_pos
;
1089 vl_data
->nexthop
.router
= vp
->nexthop
->router
;
1092 * Only deal with interface data when the local
1093 * (calculating) node is the SPF root node
1095 if (!area
->spf_dry_run
) {
1096 oi
= ospf_if_lookup_by_lsa_pos(
1097 area
, vl_data
->nexthop
.lsa_pos
);
1099 if (!IPV4_ADDR_SAME(&voi
->address
->u
.prefix4
,
1100 &oi
->address
->u
.prefix4
))
1103 voi
->address
->u
.prefix4
= oi
->address
->u
.prefix4
;
1104 voi
->address
->prefixlen
= oi
->address
->prefixlen
;
1107 break; /* We take the first interface. */
1110 rl
= (struct router_lsa
*)v
->lsa
;
1112 /* use SPF determined backlink index in struct vertex
1113 * for virtual link destination address
1115 if (vp
&& vp
->backlink
>= 0) {
1116 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1117 &rl
->link
[vp
->backlink
].link_data
))
1119 vl_data
->peer_addr
= rl
->link
[vp
->backlink
].link_data
;
1121 /* This is highly odd, there is no backlink index
1122 * there should be due to the ospf_spf_has_link() check
1123 * in SPF. Lets warn and try pick a link anyway.
1125 zlog_info("ospf_vl_set_params: No backlink for %s!",
1126 vl_data
->vl_oi
->ifp
->name
);
1127 for (i
= 0; i
< ntohs(rl
->links
); i
++) {
1128 switch (rl
->link
[i
].type
) {
1129 case LSA_LINK_TYPE_VIRTUALLINK
:
1130 if (IS_DEBUG_OSPF_EVENT
)
1132 "found back link through VL");
1134 case LSA_LINK_TYPE_TRANSIT
:
1135 case LSA_LINK_TYPE_POINTOPOINT
:
1136 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1137 &rl
->link
[i
].link_data
))
1139 vl_data
->peer_addr
= rl
->link
[i
].link_data
;
1144 if (IS_DEBUG_OSPF_EVENT
)
1145 zlog_debug("%s: %s peer address: %pI4, cost: %d,%schanged",
1146 __func__
, vl_data
->vl_oi
->ifp
->name
,
1147 &vl_data
->peer_addr
, voi
->output_cost
,
1148 (changed
? " " : " un"));
1154 void ospf_vl_up_check(struct ospf_area
*area
, struct in_addr rid
,
1157 struct ospf
*ospf
= area
->ospf
;
1158 struct listnode
*node
;
1159 struct ospf_vl_data
*vl_data
;
1160 struct ospf_interface
*oi
;
1162 if (IS_DEBUG_OSPF_EVENT
) {
1163 zlog_debug("ospf_vl_up_check(): Start");
1164 zlog_debug("ospf_vl_up_check(): Router ID is %pI4",
1166 zlog_debug("ospf_vl_up_check(): Area is %pI4",
1170 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1171 if (IS_DEBUG_OSPF_EVENT
) {
1172 zlog_debug("%s: considering VL, %s in area %pI4",
1173 __func__
, vl_data
->vl_oi
->ifp
->name
,
1174 &vl_data
->vl_area_id
);
1175 zlog_debug("%s: peer ID: %pI4", __func__
,
1179 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &rid
)
1180 && IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
)) {
1181 oi
= vl_data
->vl_oi
;
1182 SET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1184 if (IS_DEBUG_OSPF_EVENT
)
1186 "ospf_vl_up_check(): this VL matched");
1188 if (oi
->state
== ISM_Down
) {
1189 if (IS_DEBUG_OSPF_EVENT
)
1191 "ospf_vl_up_check(): VL is down, waking it up");
1192 SET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1193 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceUp
);
1196 if (ospf_vl_set_params(area
, vl_data
, v
)) {
1197 if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1199 "ospf_vl_up_check: VL cost change, scheduling router lsa refresh");
1201 ospf_router_lsa_update_area(
1203 else if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1205 "ospf_vl_up_check: VL cost change, no backbone!");
1211 void ospf_vl_unapprove(struct ospf
*ospf
)
1213 struct listnode
*node
;
1214 struct ospf_vl_data
*vl_data
;
1216 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
))
1217 UNSET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1220 void ospf_vl_shut_unapproved(struct ospf
*ospf
)
1222 struct listnode
*node
, *nnode
;
1223 struct ospf_vl_data
*vl_data
;
1225 for (ALL_LIST_ELEMENTS(ospf
->vlinks
, node
, nnode
, vl_data
))
1226 if (!CHECK_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
))
1227 ospf_vl_shutdown(vl_data
);
1230 int ospf_full_virtual_nbrs(struct ospf_area
*area
)
1232 if (IS_DEBUG_OSPF_EVENT
) {
1234 "counting fully adjacent virtual neighbors in area %pI4",
1236 zlog_debug("there are %d of them", area
->full_vls
);
1239 return area
->full_vls
;
1242 int ospf_vls_in_area(struct ospf_area
*area
)
1244 struct listnode
*node
;
1245 struct ospf_vl_data
*vl_data
;
1248 for (ALL_LIST_ELEMENTS_RO(area
->ospf
->vlinks
, node
, vl_data
))
1249 if (IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1256 struct crypt_key
*ospf_crypt_key_new(void)
1258 return XCALLOC(MTYPE_OSPF_CRYPT_KEY
, sizeof(struct crypt_key
));
1261 void ospf_crypt_key_add(struct list
*crypt
, struct crypt_key
*ck
)
1263 listnode_add(crypt
, ck
);
1266 struct crypt_key
*ospf_crypt_key_lookup(struct list
*auth_crypt
, uint8_t key_id
)
1268 struct listnode
*node
;
1269 struct crypt_key
*ck
;
1271 for (ALL_LIST_ELEMENTS_RO(auth_crypt
, node
, ck
))
1272 if (ck
->key_id
== key_id
)
1278 int ospf_crypt_key_delete(struct list
*auth_crypt
, uint8_t key_id
)
1280 struct listnode
*node
, *nnode
;
1281 struct crypt_key
*ck
;
1283 for (ALL_LIST_ELEMENTS(auth_crypt
, node
, nnode
, ck
)) {
1284 if (ck
->key_id
== key_id
) {
1285 listnode_delete(auth_crypt
, ck
);
1286 XFREE(MTYPE_OSPF_CRYPT_KEY
, ck
);
1294 uint8_t ospf_default_iftype(struct interface
*ifp
)
1296 if (if_is_pointopoint(ifp
))
1297 return OSPF_IFTYPE_POINTOPOINT
;
1298 else if (if_is_loopback(ifp
))
1299 return OSPF_IFTYPE_LOOPBACK
;
1301 return OSPF_IFTYPE_BROADCAST
;
1304 void ospf_if_interface(struct interface
*ifp
)
1306 hook_call(ospf_if_update
, ifp
);
1309 uint32_t ospf_if_count_area_params(struct interface
*ifp
)
1311 struct ospf_if_params
*params
;
1312 struct route_node
*rn
;
1315 params
= IF_DEF_PARAMS(ifp
);
1316 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1319 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
1320 if ((params
= rn
->info
)
1321 && OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1327 static int ospf_ifp_create(struct interface
*ifp
)
1329 struct ospf
*ospf
= NULL
;
1330 struct ospf_if_info
*oii
;
1332 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1334 "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
1335 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1336 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1337 ifp
->metric
, ifp
->mtu
, ifp
->speed
);
1342 oii
->curr_mtu
= ifp
->mtu
;
1344 if (IF_DEF_PARAMS(ifp
)
1345 && !OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp
), type
)) {
1346 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), type
);
1347 IF_DEF_PARAMS(ifp
)->type
= ospf_default_iftype(ifp
);
1350 ospf
= ifp
->vrf
->info
;
1354 if (ospf_if_count_area_params(ifp
) > 0)
1355 ospf_interface_area_set(ospf
, ifp
);
1357 ospf_if_recalculate_output_cost(ifp
);
1359 ospf_if_update(ospf
, ifp
);
1361 if (HAS_LINK_PARAMS(ifp
))
1362 ospf_mpls_te_update_if(ifp
);
1364 hook_call(ospf_if_update
, ifp
);
1369 static int ospf_ifp_up(struct interface
*ifp
)
1371 struct ospf_interface
*oi
;
1372 struct route_node
*rn
;
1373 struct ospf_if_info
*oii
= ifp
->info
;
1375 ospf_if_recalculate_output_cost(ifp
);
1377 if (oii
&& oii
->curr_mtu
!= ifp
->mtu
) {
1378 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1380 "Zebra: Interface[%s] MTU change %u -> %u.",
1381 ifp
->name
, oii
->curr_mtu
, ifp
->mtu
);
1383 oii
->curr_mtu
= ifp
->mtu
;
1384 /* Must reset the interface (simulate down/up) when MTU
1391 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1392 zlog_debug("Zebra: Interface[%s] state change to up.",
1395 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1396 if ((oi
= rn
->info
) == NULL
)
1402 if (HAS_LINK_PARAMS(ifp
))
1403 ospf_mpls_te_update_if(ifp
);
1408 static int ospf_ifp_down(struct interface
*ifp
)
1410 struct ospf_interface
*oi
;
1411 struct route_node
*node
;
1413 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1414 zlog_debug("Zebra: Interface[%s] state change to down.",
1417 for (node
= route_top(IF_OIFS(ifp
)); node
; node
= route_next(node
)) {
1418 if ((oi
= node
->info
) == NULL
)
1426 static int ospf_ifp_destroy(struct interface
*ifp
)
1429 struct route_node
*rn
;
1431 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1433 "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
1434 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1435 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1436 ifp
->metric
, ifp
->mtu
);
1438 hook_call(ospf_if_delete
, ifp
);
1440 ospf
= ifp
->vrf
->info
;
1442 if (ospf_if_count_area_params(ifp
) > 0)
1443 ospf_interface_area_unset(ospf
, ifp
);
1446 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
))
1448 ospf_if_free((struct ospf_interface
*)rn
->info
);
1453 /* Resetting ospf hello timer */
1454 void ospf_reset_hello_timer(struct interface
*ifp
, struct in_addr addr
,
1457 struct route_node
*rn
;
1461 struct ospf_interface
*oi
= NULL
;
1465 p
.prefixlen
= IPV4_MAX_BITLEN
;
1467 oi
= ospf_if_table_lookup(ifp
, &p
);
1470 /* Send hello before restart the hello timer
1471 * to avoid session flaps in case of bigger
1472 * hello interval configurations.
1474 ospf_hello_send(oi
);
1476 /* Restart hello timer for this interface */
1477 OSPF_ISM_TIMER_OFF(oi
->t_hello
);
1478 OSPF_HELLO_TIMER_ON(oi
);
1484 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1485 struct ospf_interface
*oi
= rn
->info
;
1490 /* If hello interval configured on this oi, don't restart. */
1491 if (OSPF_IF_PARAM_CONFIGURED(oi
->params
, v_hello
))
1494 /* Send hello before restart the hello timer
1495 * to avoid session flaps in case of bigger
1496 * hello interval configurations.
1498 ospf_hello_send(oi
);
1500 /* Restart the hello timer. */
1501 OSPF_ISM_TIMER_OFF(oi
->t_hello
);
1502 OSPF_HELLO_TIMER_ON(oi
);
1506 void ospf_if_init(void)
1508 if_zapi_callbacks(ospf_ifp_create
, ospf_ifp_up
,
1509 ospf_ifp_down
, ospf_ifp_destroy
);
1511 /* Initialize Zebra interface data structure. */
1512 hook_register_prio(if_add
, 0, ospf_if_new_hook
);
1513 hook_register_prio(if_del
, 0, ospf_if_delete_hook
);