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
)) {
72 /* Do not show myself. */
73 if (nbr
== oi
->nbr_self
)
75 /* Down state is not shown. */
76 if (nbr
->state
== NSM_Down
)
84 int ospf_if_get_output_cost(struct ospf_interface
*oi
)
86 /* If all else fails, use default OSPF cost */
90 /* if LDP-IGP Sync is running on interface set cost so interface
91 * is used only as last resort
93 if (ldp_sync_if_is_enabled(IF_DEF_PARAMS(oi
->ifp
)->ldp_sync_info
))
94 return (LDP_OSPF_LSINFINITY
);
96 /* ifp speed and bw can be 0 in some platforms, use ospf default bw
97 if bw is configured under interface it would be used.
99 if (!oi
->ifp
->bandwidth
&& oi
->ifp
->speed
)
102 bw
= oi
->ifp
->bandwidth
? oi
->ifp
->bandwidth
103 : OSPF_DEFAULT_BANDWIDTH
;
104 refbw
= oi
->ospf
->ref_bandwidth
;
106 /* A specified ip ospf cost overrides a calculated one. */
107 if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(oi
->ifp
), output_cost_cmd
)
108 || OSPF_IF_PARAM_CONFIGURED(oi
->params
, output_cost_cmd
))
109 cost
= OSPF_IF_PARAM(oi
, output_cost_cmd
);
110 /* See if a cost can be calculated from the zebra processes
111 interface bandwidth field. */
113 cost
= (uint32_t)((double)refbw
/ (double)bw
+ (double)0.5);
116 else if (cost
> 65535)
123 void ospf_if_recalculate_output_cost(struct interface
*ifp
)
126 struct route_node
*rn
;
128 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
129 struct ospf_interface
*oi
;
131 if ((oi
= rn
->info
) == NULL
)
134 newcost
= ospf_if_get_output_cost(oi
);
136 /* Is actual output cost changed? */
137 if (oi
->output_cost
!= newcost
) {
138 oi
->output_cost
= newcost
;
139 ospf_router_lsa_update_area(oi
->area
);
144 /* Simulate down/up on the interface. This is needed, for example, when
146 void ospf_if_reset(struct interface
*ifp
)
148 struct route_node
*rn
;
150 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
151 struct ospf_interface
*oi
;
153 if ((oi
= rn
->info
) == NULL
)
161 void ospf_if_reset_variables(struct ospf_interface
*oi
)
163 /* Set default values. */
164 /* don't clear this flag. oi->flag = OSPF_IF_DISABLE; */
167 oi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
169 /* preserve network-type */
170 if (oi
->type
!= OSPF_IFTYPE_NBMA
)
171 oi
->type
= OSPF_IFTYPE_BROADCAST
;
173 oi
->state
= ISM_Down
;
175 oi
->crypt_seqnum
= 0;
177 /* This must be short, (less than RxmtInterval)
178 - RFC 2328 Section 13.5 para 3. Set to 1 second to avoid Acks being
179 held back for too long - MAG */
183 /* lookup oi for specified prefix/ifp */
184 struct ospf_interface
*ospf_if_table_lookup(struct interface
*ifp
,
185 struct prefix
*prefix
)
188 struct route_node
*rn
;
189 struct ospf_interface
*rninfo
= NULL
;
192 p
.prefixlen
= IPV4_MAX_BITLEN
;
194 /* route_node_get implicitely locks */
195 if ((rn
= route_node_lookup(IF_OIFS(ifp
), &p
))) {
196 rninfo
= (struct ospf_interface
*)rn
->info
;
197 route_unlock_node(rn
);
203 static void ospf_add_to_if(struct interface
*ifp
, struct ospf_interface
*oi
)
205 struct route_node
*rn
;
209 p
.prefixlen
= IPV4_MAX_BITLEN
;
212 rn
= route_node_get(IF_OIFS(ifp
), &p
);
213 /* rn->info should either be NULL or equal to this oi
214 * as route_node_get may return an existing node
216 assert(!rn
->info
|| rn
->info
== oi
);
220 static void ospf_delete_from_if(struct interface
*ifp
,
221 struct ospf_interface
*oi
)
223 struct route_node
*rn
;
227 p
.prefixlen
= IPV4_MAX_BITLEN
;
229 rn
= route_node_lookup(IF_OIFS(oi
->ifp
), &p
);
233 route_unlock_node(rn
);
234 route_unlock_node(rn
);
237 struct ospf_interface
*ospf_if_new(struct ospf
*ospf
, struct interface
*ifp
,
240 struct ospf_interface
*oi
;
242 oi
= ospf_if_table_lookup(ifp
, p
);
246 oi
= XCALLOC(MTYPE_OSPF_IF
, sizeof(struct ospf_interface
));
248 oi
->obuf
= ospf_fifo_new();
250 /* Set zebra interface pointer. */
254 ospf_add_to_if(ifp
, oi
);
255 listnode_add(ospf
->oiflist
, oi
);
257 /* Initialize neighbor list. */
258 oi
->nbrs
= route_table_init();
260 /* Initialize static neighbor list. */
261 oi
->nbr_nbma
= list_new();
263 /* Initialize Link State Acknowledgment list. */
264 oi
->ls_ack
= list_new();
265 oi
->ls_ack_direct
.ls_ack
= list_new();
267 /* Set default values. */
268 ospf_if_reset_variables(oi
);
270 /* Set pseudo neighbor to Null */
273 oi
->ls_upd_queue
= route_table_init();
274 oi
->t_ls_upd_event
= NULL
;
275 oi
->t_ls_ack_direct
= NULL
;
277 oi
->crypt_seqnum
= time(NULL
);
279 ospf_opaque_type9_lsa_init(oi
);
283 QOBJ_REG(oi
, ospf_interface
);
285 if (IS_DEBUG_OSPF_EVENT
)
286 zlog_debug("%s: ospf interface %s vrf %s id %u created",
287 __func__
, ifp
->name
, ospf_get_name(ospf
),
293 /* Restore an interface to its pre UP state
294 Used from ism_interface_down only */
295 void ospf_if_cleanup(struct ospf_interface
*oi
)
297 struct route_node
*rn
;
298 struct listnode
*node
, *nnode
;
299 struct ospf_neighbor
*nbr
;
300 struct ospf_nbr_nbma
*nbr_nbma
;
301 struct ospf_lsa
*lsa
;
303 /* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
304 /* delete all static neighbors attached to this interface */
305 for (ALL_LIST_ELEMENTS(oi
->nbr_nbma
, node
, nnode
, nbr_nbma
)) {
306 THREAD_OFF(nbr_nbma
->t_poll
);
309 nbr_nbma
->nbr
->nbr_nbma
= NULL
;
310 nbr_nbma
->nbr
= NULL
;
315 listnode_delete(oi
->nbr_nbma
, nbr_nbma
);
318 /* send Neighbor event KillNbr to all associated neighbors. */
319 for (rn
= route_top(oi
->nbrs
); rn
; rn
= route_next(rn
)) {
320 if ((nbr
= rn
->info
) != NULL
)
321 if (nbr
!= oi
->nbr_self
)
322 OSPF_NSM_EVENT_EXECUTE(nbr
, NSM_KillNbr
);
325 /* Cleanup Link State Acknowlegdment list. */
326 for (ALL_LIST_ELEMENTS(oi
->ls_ack
, node
, nnode
, lsa
))
327 ospf_lsa_unlock(&lsa
); /* oi->ls_ack */
328 list_delete_all_node(oi
->ls_ack
);
330 oi
->crypt_seqnum
= 0;
332 /* Empty link state update queue */
333 ospf_ls_upd_queue_empty(oi
);
335 /* Reset pseudo neighbor. */
336 ospf_nbr_self_reset(oi
, oi
->ospf
->router_id
);
339 void ospf_if_free(struct ospf_interface
*oi
)
343 ospf_fifo_free(oi
->obuf
);
345 assert(oi
->state
== ISM_Down
);
347 ospf_opaque_type9_lsa_term(oi
);
351 /* Free Pseudo Neighbour */
352 ospf_nbr_delete(oi
->nbr_self
);
354 route_table_finish(oi
->nbrs
);
355 route_table_finish(oi
->ls_upd_queue
);
357 /* Free any lists that should be freed */
358 list_delete(&oi
->nbr_nbma
);
360 list_delete(&oi
->ls_ack
);
361 list_delete(&oi
->ls_ack_direct
.ls_ack
);
363 if (IS_DEBUG_OSPF_EVENT
)
364 zlog_debug("%s: ospf interface %s vrf %s id %u deleted",
365 __func__
, oi
->ifp
->name
, oi
->ifp
->vrf
->name
,
366 oi
->ifp
->vrf
->vrf_id
);
368 ospf_delete_from_if(oi
->ifp
, oi
);
370 listnode_delete(oi
->ospf
->oiflist
, oi
);
371 listnode_delete(oi
->area
->oiflist
, oi
);
373 thread_cancel_event(master
, oi
);
375 memset(oi
, 0, sizeof(*oi
));
376 XFREE(MTYPE_OSPF_IF
, oi
);
379 int ospf_if_is_up(struct ospf_interface
*oi
)
381 return if_is_up(oi
->ifp
);
384 struct ospf_interface
*ospf_if_exists(struct ospf_interface
*oic
)
386 struct listnode
*node
;
388 struct ospf_interface
*oi
;
397 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
404 /* Lookup OSPF interface by router LSA posistion */
405 struct ospf_interface
*ospf_if_lookup_by_lsa_pos(struct ospf_area
*area
,
408 struct listnode
*node
;
409 struct ospf_interface
*oi
;
411 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, node
, oi
)) {
412 if (lsa_pos
>= oi
->lsa_pos_beg
&& lsa_pos
< oi
->lsa_pos_end
)
418 struct ospf_interface
*ospf_if_lookup_by_local_addr(struct ospf
*ospf
,
419 struct interface
*ifp
,
420 struct in_addr address
)
422 struct listnode
*node
;
423 struct ospf_interface
*oi
;
425 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
426 if (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
) {
427 if (ifp
&& oi
->ifp
!= ifp
)
430 if (IPV4_ADDR_SAME(&address
, &oi
->address
->u
.prefix4
))
437 struct ospf_interface
*ospf_if_lookup_by_prefix(struct ospf
*ospf
,
438 struct prefix_ipv4
*p
)
440 struct listnode
*node
;
441 struct ospf_interface
*oi
;
443 /* Check each Interface. */
444 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
)) {
445 if (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
) {
448 prefix_copy(&ptmp
, CONNECTED_PREFIX(oi
->connected
));
450 if (prefix_same(&ptmp
, (struct prefix
*)p
))
457 /* determine receiving interface by ifp and source address */
458 struct ospf_interface
*ospf_if_lookup_recv_if(struct ospf
*ospf
,
460 struct interface
*ifp
)
462 struct route_node
*rn
;
463 struct prefix_ipv4 addr
;
464 struct ospf_interface
*oi
, *match
;
466 addr
.family
= AF_INET
;
468 addr
.prefixlen
= IPV4_MAX_BITLEN
;
472 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
475 if (!oi
) /* oi can be NULL for PtP aliases */
478 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
481 if (if_is_loopback(oi
->ifp
))
484 if (CHECK_FLAG(oi
->connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
486 else if (prefix_match(CONNECTED_PREFIX(oi
->connected
),
487 (struct prefix
*)&addr
)) {
488 if ((match
== NULL
) || (match
->address
->prefixlen
489 < oi
->address
->prefixlen
))
497 void ospf_interface_fifo_flush(struct ospf_interface
*oi
)
499 struct ospf
*ospf
= oi
->ospf
;
501 ospf_fifo_flush(oi
->obuf
);
503 if (oi
->on_write_q
) {
504 listnode_delete(ospf
->oi_write_q
, oi
);
505 if (list_isempty(ospf
->oi_write_q
))
506 THREAD_OFF(ospf
->t_write
);
511 static void ospf_if_reset_stats(struct ospf_interface
*oi
)
513 oi
->hello_in
= oi
->hello_out
= 0;
514 oi
->db_desc_in
= oi
->db_desc_out
= 0;
515 oi
->ls_req_in
= oi
->ls_req_out
= 0;
516 oi
->ls_upd_in
= oi
->ls_upd_out
= 0;
517 oi
->ls_ack_in
= oi
->ls_ack_out
= 0;
520 void ospf_if_stream_unset(struct ospf_interface
*oi
)
522 /* flush the interface packet queue */
523 ospf_interface_fifo_flush(oi
);
524 /*reset protocol stats */
525 ospf_if_reset_stats(oi
);
529 static struct ospf_if_params
*ospf_new_if_params(void)
531 struct ospf_if_params
*oip
;
533 oip
= XCALLOC(MTYPE_OSPF_IF_PARAMS
, sizeof(struct ospf_if_params
));
535 UNSET_IF_PARAM(oip
, output_cost_cmd
);
536 UNSET_IF_PARAM(oip
, transmit_delay
);
537 UNSET_IF_PARAM(oip
, retransmit_interval
);
538 UNSET_IF_PARAM(oip
, passive_interface
);
539 UNSET_IF_PARAM(oip
, v_hello
);
540 UNSET_IF_PARAM(oip
, fast_hello
);
541 UNSET_IF_PARAM(oip
, v_wait
);
542 UNSET_IF_PARAM(oip
, priority
);
543 UNSET_IF_PARAM(oip
, type
);
544 UNSET_IF_PARAM(oip
, auth_simple
);
545 UNSET_IF_PARAM(oip
, auth_crypt
);
546 UNSET_IF_PARAM(oip
, auth_type
);
547 UNSET_IF_PARAM(oip
, if_area
);
549 oip
->auth_crypt
= list_new();
551 oip
->network_lsa_seqnum
= htonl(OSPF_INITIAL_SEQUENCE_NUMBER
);
552 oip
->is_v_wait_set
= false;
559 static void ospf_del_if_params(struct interface
*ifp
,
560 struct ospf_if_params
*oip
)
562 list_delete(&oip
->auth_crypt
);
563 ospf_interface_disable_bfd(ifp
, oip
);
564 ldp_sync_info_free(&(oip
->ldp_sync_info
));
565 XFREE(MTYPE_OSPF_IF_PARAMS
, oip
);
568 void ospf_free_if_params(struct interface
*ifp
, struct in_addr addr
)
570 struct ospf_if_params
*oip
;
571 struct prefix_ipv4 p
;
572 struct route_node
*rn
;
575 p
.prefixlen
= IPV4_MAX_BITLEN
;
577 rn
= route_node_lookup(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
578 if (!rn
|| !rn
->info
)
582 route_unlock_node(rn
);
584 if (!OSPF_IF_PARAM_CONFIGURED(oip
, output_cost_cmd
)
585 && !OSPF_IF_PARAM_CONFIGURED(oip
, transmit_delay
)
586 && !OSPF_IF_PARAM_CONFIGURED(oip
, retransmit_interval
)
587 && !OSPF_IF_PARAM_CONFIGURED(oip
, passive_interface
)
588 && !OSPF_IF_PARAM_CONFIGURED(oip
, v_hello
)
589 && !OSPF_IF_PARAM_CONFIGURED(oip
, fast_hello
)
590 && !OSPF_IF_PARAM_CONFIGURED(oip
, v_wait
)
591 && !OSPF_IF_PARAM_CONFIGURED(oip
, priority
)
592 && !OSPF_IF_PARAM_CONFIGURED(oip
, type
)
593 && !OSPF_IF_PARAM_CONFIGURED(oip
, auth_simple
)
594 && !OSPF_IF_PARAM_CONFIGURED(oip
, auth_type
)
595 && !OSPF_IF_PARAM_CONFIGURED(oip
, if_area
)
596 && listcount(oip
->auth_crypt
) == 0) {
597 ospf_del_if_params(ifp
, oip
);
599 route_unlock_node(rn
);
603 struct ospf_if_params
*ospf_lookup_if_params(struct interface
*ifp
,
606 struct prefix_ipv4 p
;
607 struct route_node
*rn
;
610 p
.prefixlen
= IPV4_MAX_BITLEN
;
613 rn
= route_node_lookup(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
616 route_unlock_node(rn
);
623 struct ospf_if_params
*ospf_get_if_params(struct interface
*ifp
,
626 struct prefix_ipv4 p
;
627 struct route_node
*rn
;
630 p
.prefixlen
= IPV4_MAX_BITLEN
;
634 rn
= route_node_get(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
636 if (rn
->info
== NULL
)
637 rn
->info
= ospf_new_if_params();
639 route_unlock_node(rn
);
644 void ospf_if_update_params(struct interface
*ifp
, struct in_addr addr
)
646 struct route_node
*rn
;
647 struct ospf_interface
*oi
;
649 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
650 if ((oi
= rn
->info
) == NULL
)
653 if (IPV4_ADDR_SAME(&oi
->address
->u
.prefix4
, &addr
))
654 oi
->params
= ospf_lookup_if_params(
655 ifp
, oi
->address
->u
.prefix4
);
659 int ospf_if_new_hook(struct interface
*ifp
)
663 ifp
->info
= XCALLOC(MTYPE_OSPF_IF_INFO
, sizeof(struct ospf_if_info
));
665 IF_OIFS(ifp
) = route_table_init();
666 IF_OIFS_PARAMS(ifp
) = route_table_init();
668 IF_DEF_PARAMS(ifp
) = ospf_new_if_params();
670 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), transmit_delay
);
671 IF_DEF_PARAMS(ifp
)->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
673 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), retransmit_interval
);
674 IF_DEF_PARAMS(ifp
)->retransmit_interval
=
675 OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
677 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), priority
);
678 IF_DEF_PARAMS(ifp
)->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
680 IF_DEF_PARAMS(ifp
)->mtu_ignore
= OSPF_MTU_IGNORE_DEFAULT
;
682 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), v_hello
);
683 IF_DEF_PARAMS(ifp
)->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
685 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), fast_hello
);
686 IF_DEF_PARAMS(ifp
)->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
688 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), v_wait
);
689 IF_DEF_PARAMS(ifp
)->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
691 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), auth_simple
);
692 memset(IF_DEF_PARAMS(ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
694 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), auth_type
);
695 IF_DEF_PARAMS(ifp
)->auth_type
= OSPF_AUTH_NOTSET
;
697 rc
= ospf_opaque_new_if(ifp
);
701 static int ospf_if_delete_hook(struct interface
*ifp
)
704 struct route_node
*rn
;
705 rc
= ospf_opaque_del_if(ifp
);
708 * This function must be called before `route_table_finish` due to
709 * BFD integration need to iterate over the interface neighbors to
710 * remove all registrations.
712 ospf_del_if_params(ifp
, IF_DEF_PARAMS(ifp
));
714 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
716 ospf_del_if_params(ifp
, rn
->info
);
718 route_table_finish(IF_OIFS(ifp
));
719 route_table_finish(IF_OIFS_PARAMS(ifp
));
721 XFREE(MTYPE_OSPF_IF_INFO
, ifp
->info
);
726 int ospf_if_is_enable(struct ospf_interface
*oi
)
728 if (!(if_is_loopback(oi
->ifp
)))
729 if (if_is_up(oi
->ifp
))
735 void ospf_if_set_multicast(struct ospf_interface
*oi
)
737 if ((oi
->state
> ISM_Loopback
) && (oi
->type
!= OSPF_IFTYPE_LOOPBACK
)
738 && (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
)
739 && (OSPF_IF_PASSIVE_STATUS(oi
) == OSPF_IF_ACTIVE
)) {
740 /* The interface should belong to the OSPF-all-routers group. */
741 if (!OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
742 && (ospf_if_add_allspfrouters(oi
->ospf
, oi
->address
,
745 /* Set the flag only if the system call to join
747 OI_MEMBER_JOINED(oi
, MEMBER_ALLROUTERS
);
749 /* The interface should NOT belong to the OSPF-all-routers
751 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)) {
752 /* Only actually drop if this is the last reference */
753 if (OI_MEMBER_COUNT(oi
, MEMBER_ALLROUTERS
) == 1)
754 ospf_if_drop_allspfrouters(oi
->ospf
,
757 /* Unset the flag regardless of whether the system call
759 the group succeeded, since it's much safer to assume
761 we are not a member. */
762 OI_MEMBER_LEFT(oi
, MEMBER_ALLROUTERS
);
766 if (((oi
->type
== OSPF_IFTYPE_BROADCAST
)
767 || (oi
->type
== OSPF_IFTYPE_POINTOPOINT
))
768 && ((oi
->state
== ISM_DR
) || (oi
->state
== ISM_Backup
))
769 && (OSPF_IF_PASSIVE_STATUS(oi
) == OSPF_IF_ACTIVE
)) {
770 /* The interface should belong to the OSPF-designated-routers
772 if (!OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
)
773 && (ospf_if_add_alldrouters(oi
->ospf
, oi
->address
,
776 /* Set the flag only if the system call to join
778 OI_MEMBER_JOINED(oi
, MEMBER_DROUTERS
);
780 /* The interface should NOT belong to the
781 * OSPF-designated-routers group */
782 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
)) {
783 /* drop only if last reference */
784 if (OI_MEMBER_COUNT(oi
, MEMBER_DROUTERS
) == 1)
785 ospf_if_drop_alldrouters(oi
->ospf
, oi
->address
,
788 /* Unset the flag regardless of whether the system call
790 the group succeeded, since it's much safer to assume
792 we are not a member. */
793 OI_MEMBER_LEFT(oi
, MEMBER_DROUTERS
);
798 int ospf_if_up(struct ospf_interface
*oi
)
803 if (oi
->type
== OSPF_IFTYPE_LOOPBACK
)
804 OSPF_ISM_EVENT_SCHEDULE(oi
, ISM_LoopInd
);
806 OSPF_ISM_EVENT_SCHEDULE(oi
, ISM_InterfaceUp
);
812 int ospf_if_down(struct ospf_interface
*oi
)
815 struct route_node
*rn
;
816 struct ospf_route
*or;
818 struct ospf_path
*op
;
825 /* Cease the HELPER role for all the neighbours
828 if (ospf
->is_helper_supported
) {
829 struct route_node
*rn
= NULL
;
831 if (ospf_interface_neighbor_count(oi
)) {
832 for (rn
= route_top(oi
->nbrs
); rn
;
833 rn
= route_next(rn
)) {
834 struct ospf_neighbor
*nbr
= NULL
;
841 if (OSPF_GR_IS_ACTIVE_HELPER(nbr
))
843 nbr
, OSPF_GR_HELPER_TOPO_CHG
);
848 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
849 /* delete position in router LSA */
852 /* Shutdown packet reception and sending */
853 ospf_if_stream_unset(oi
);
855 if (!ospf
->new_table
)
857 for (rn
= route_top(ospf
->new_table
); rn
; rn
= route_next(rn
)) {
863 for (nh
= listhead(or->paths
); nh
;
864 nh
= listnextnode_unchecked(nh
)) {
865 op
= listgetdata(nh
);
866 if (op
->ifindex
== oi
->ifp
->ifindex
) {
877 /* Virtual Link related functions. */
879 struct ospf_vl_data
*ospf_vl_data_new(struct ospf_area
*area
,
880 struct in_addr vl_peer
)
882 struct ospf_vl_data
*vl_data
;
884 vl_data
= XCALLOC(MTYPE_OSPF_VL_DATA
, sizeof(struct ospf_vl_data
));
886 vl_data
->vl_peer
.s_addr
= vl_peer
.s_addr
;
887 vl_data
->vl_area_id
= area
->area_id
;
888 vl_data
->vl_area_id_fmt
= area
->area_id_fmt
;
893 void ospf_vl_data_free(struct ospf_vl_data
*vl_data
)
895 XFREE(MTYPE_OSPF_VL_DATA
, vl_data
);
898 unsigned int vlink_count
= 0;
900 struct ospf_interface
*ospf_vl_new(struct ospf
*ospf
,
901 struct ospf_vl_data
*vl_data
)
903 struct ospf_interface
*voi
;
904 struct interface
*vi
;
905 char ifname
[INTERFACE_NAMSIZ
];
906 struct ospf_area
*area
;
907 struct in_addr area_id
;
908 struct connected
*co
;
909 struct prefix_ipv4
*p
;
911 if (IS_DEBUG_OSPF_EVENT
)
912 zlog_debug("%s: (%s): Start", __func__
, ospf_get_name(ospf
));
913 if (vlink_count
== OSPF_VL_MAX_COUNT
) {
914 if (IS_DEBUG_OSPF_EVENT
)
916 "%s: Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links",
922 if (IS_DEBUG_OSPF_EVENT
)
923 zlog_debug("%s: creating pseudo zebra interface vrf id %u",
924 __func__
, ospf
->vrf_id
);
926 snprintf(ifname
, sizeof(ifname
), "VLINK%u", vlink_count
);
927 vi
= if_get_by_name(ifname
, ospf
->vrf_id
, ospf
->name
);
929 * if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION
930 * virtual links don't need this.
932 UNSET_FLAG(vi
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
933 co
= connected_new();
935 listnode_add(vi
->connected
, co
);
937 p
= prefix_ipv4_new();
939 p
->prefix
.s_addr
= INADDR_ANY
;
942 co
->address
= (struct prefix
*)p
;
944 voi
= ospf_if_new(ospf
, vi
, co
->address
);
946 if (IS_DEBUG_OSPF_EVENT
)
948 "%s: Alarm: OSPF int structure is not created",
954 voi
->vl_data
= vl_data
;
955 voi
->ifp
->mtu
= OSPF_VL_MTU
;
956 voi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
959 if (IS_DEBUG_OSPF_EVENT
)
960 zlog_debug("%s: Created name: %s set if->name to %s", __func__
,
963 area_id
.s_addr
= INADDR_ANY
;
964 area
= ospf_area_get(ospf
, area_id
);
967 if (IS_DEBUG_OSPF_EVENT
)
968 zlog_debug("%s: set associated area to the backbone", __func__
);
970 /* Add pseudo neighbor. */
971 ospf_nbr_self_reset(voi
, voi
->ospf
->router_id
);
973 ospf_area_add_if(voi
->area
, voi
);
975 if (IS_DEBUG_OSPF_EVENT
)
976 zlog_debug("%s: Stop", __func__
);
980 static void ospf_vl_if_delete(struct ospf_vl_data
*vl_data
)
982 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
983 struct vrf
*vrf
= ifp
->vrf
;
985 vl_data
->vl_oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
986 vl_data
->vl_oi
->address
->prefixlen
= 0;
987 ospf_if_free(vl_data
->vl_oi
);
989 if (!vrf_is_enabled(vrf
))
994 /* for a defined area, count the number of configured vl
996 int ospf_vl_count(struct ospf
*ospf
, struct ospf_area
*area
)
999 struct ospf_vl_data
*vl_data
;
1000 struct listnode
*node
;
1002 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1004 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1011 /* Look up vl_data for given peer, optionally qualified to be in the
1012 * specified area. NULL area returns first found..
1014 struct ospf_vl_data
*ospf_vl_lookup(struct ospf
*ospf
, struct ospf_area
*area
,
1015 struct in_addr vl_peer
)
1017 struct ospf_vl_data
*vl_data
;
1018 struct listnode
*node
;
1020 if (IS_DEBUG_OSPF_EVENT
) {
1021 zlog_debug("%s: Looking for %pI4", __func__
, &vl_peer
);
1023 zlog_debug("%s: in area %pI4", __func__
,
1027 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1028 if (IS_DEBUG_OSPF_EVENT
)
1029 zlog_debug("%s: VL %s, peer %pI4", __func__
,
1030 vl_data
->vl_oi
->ifp
->name
,
1034 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1037 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &vl_peer
))
1044 static void ospf_vl_shutdown(struct ospf_vl_data
*vl_data
)
1046 struct ospf_interface
*oi
;
1048 if ((oi
= vl_data
->vl_oi
) == NULL
)
1051 oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
1052 oi
->address
->prefixlen
= 0;
1054 UNSET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1055 /* OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceDown); */
1056 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
1059 void ospf_vl_add(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1061 listnode_add(ospf
->vlinks
, vl_data
);
1062 hook_call(ospf_vl_add
, vl_data
);
1065 void ospf_vl_delete(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1067 ospf_vl_shutdown(vl_data
);
1068 ospf_vl_if_delete(vl_data
);
1070 hook_call(ospf_vl_delete
, vl_data
);
1071 listnode_delete(ospf
->vlinks
, vl_data
);
1073 ospf_vl_data_free(vl_data
);
1076 static int ospf_vl_set_params(struct ospf_area
*area
,
1077 struct ospf_vl_data
*vl_data
, struct vertex
*v
)
1080 struct ospf_interface
*voi
;
1081 struct listnode
*node
;
1082 struct vertex_parent
*vp
= NULL
;
1084 struct router_lsa
*rl
;
1085 struct ospf_interface
*oi
;
1087 voi
= vl_data
->vl_oi
;
1089 if (voi
->output_cost
!= v
->distance
) {
1091 voi
->output_cost
= v
->distance
;
1095 for (ALL_LIST_ELEMENTS_RO(v
->parents
, node
, vp
)) {
1096 vl_data
->nexthop
.lsa_pos
= vp
->nexthop
->lsa_pos
;
1097 vl_data
->nexthop
.router
= vp
->nexthop
->router
;
1100 * Only deal with interface data when the local
1101 * (calculating) node is the SPF root node
1103 if (!area
->spf_dry_run
) {
1104 oi
= ospf_if_lookup_by_lsa_pos(
1105 area
, vl_data
->nexthop
.lsa_pos
);
1107 if (!IPV4_ADDR_SAME(&voi
->address
->u
.prefix4
,
1108 &oi
->address
->u
.prefix4
))
1111 voi
->address
->u
.prefix4
= oi
->address
->u
.prefix4
;
1112 voi
->address
->prefixlen
= oi
->address
->prefixlen
;
1115 break; /* We take the first interface. */
1118 rl
= (struct router_lsa
*)v
->lsa
;
1120 /* use SPF determined backlink index in struct vertex
1121 * for virtual link destination address
1123 if (vp
&& vp
->backlink
>= 0) {
1124 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1125 &rl
->link
[vp
->backlink
].link_data
))
1127 vl_data
->peer_addr
= rl
->link
[vp
->backlink
].link_data
;
1129 /* This is highly odd, there is no backlink index
1130 * there should be due to the ospf_spf_has_link() check
1131 * in SPF. Lets warn and try pick a link anyway.
1133 zlog_info("ospf_vl_set_params: No backlink for %s!",
1134 vl_data
->vl_oi
->ifp
->name
);
1135 for (i
= 0; i
< ntohs(rl
->links
); i
++) {
1136 switch (rl
->link
[i
].type
) {
1137 case LSA_LINK_TYPE_VIRTUALLINK
:
1138 if (IS_DEBUG_OSPF_EVENT
)
1140 "found back link through VL");
1142 case LSA_LINK_TYPE_TRANSIT
:
1143 case LSA_LINK_TYPE_POINTOPOINT
:
1144 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1145 &rl
->link
[i
].link_data
))
1147 vl_data
->peer_addr
= rl
->link
[i
].link_data
;
1152 if (IS_DEBUG_OSPF_EVENT
)
1153 zlog_debug("%s: %s peer address: %pI4, cost: %d,%schanged",
1154 __func__
, vl_data
->vl_oi
->ifp
->name
,
1155 &vl_data
->peer_addr
, voi
->output_cost
,
1156 (changed
? " " : " un"));
1162 void ospf_vl_up_check(struct ospf_area
*area
, struct in_addr rid
,
1165 struct ospf
*ospf
= area
->ospf
;
1166 struct listnode
*node
;
1167 struct ospf_vl_data
*vl_data
;
1168 struct ospf_interface
*oi
;
1170 if (IS_DEBUG_OSPF_EVENT
) {
1171 zlog_debug("%s: Start", __func__
);
1172 zlog_debug("%s: Router ID is %pI4 Area is %pI4", __func__
, &rid
,
1176 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1177 if (IS_DEBUG_OSPF_EVENT
) {
1178 zlog_debug("%s: considering VL, %s in area %pI4",
1179 __func__
, vl_data
->vl_oi
->ifp
->name
,
1180 &vl_data
->vl_area_id
);
1181 zlog_debug("%s: peer ID: %pI4", __func__
,
1185 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &rid
)
1186 && IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
)) {
1187 oi
= vl_data
->vl_oi
;
1188 SET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1190 if (IS_DEBUG_OSPF_EVENT
)
1191 zlog_debug("%s: this VL matched", __func__
);
1193 if (oi
->state
== ISM_Down
) {
1194 if (IS_DEBUG_OSPF_EVENT
)
1196 "%s: VL is down, waking it up",
1198 SET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1199 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceUp
);
1202 if (ospf_vl_set_params(area
, vl_data
, v
)) {
1203 if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1205 "%s: VL cost change, scheduling router lsa refresh",
1208 ospf_router_lsa_update_area(
1210 else if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1212 "%s: VL cost change, no backbone!",
1219 void ospf_vl_unapprove(struct ospf
*ospf
)
1221 struct listnode
*node
;
1222 struct ospf_vl_data
*vl_data
;
1224 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
))
1225 UNSET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1228 void ospf_vl_shut_unapproved(struct ospf
*ospf
)
1230 struct listnode
*node
, *nnode
;
1231 struct ospf_vl_data
*vl_data
;
1233 for (ALL_LIST_ELEMENTS(ospf
->vlinks
, node
, nnode
, vl_data
))
1234 if (!CHECK_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
))
1235 ospf_vl_shutdown(vl_data
);
1238 int ospf_full_virtual_nbrs(struct ospf_area
*area
)
1240 if (IS_DEBUG_OSPF_EVENT
) {
1242 "counting fully adjacent virtual neighbors in area %pI4",
1244 zlog_debug("there are %d of them", area
->full_vls
);
1247 return area
->full_vls
;
1250 int ospf_vls_in_area(struct ospf_area
*area
)
1252 struct listnode
*node
;
1253 struct ospf_vl_data
*vl_data
;
1256 for (ALL_LIST_ELEMENTS_RO(area
->ospf
->vlinks
, node
, vl_data
))
1257 if (IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1264 struct crypt_key
*ospf_crypt_key_new(void)
1266 return XCALLOC(MTYPE_OSPF_CRYPT_KEY
, sizeof(struct crypt_key
));
1269 void ospf_crypt_key_add(struct list
*crypt
, struct crypt_key
*ck
)
1271 listnode_add(crypt
, ck
);
1274 struct crypt_key
*ospf_crypt_key_lookup(struct list
*auth_crypt
, uint8_t key_id
)
1276 struct listnode
*node
;
1277 struct crypt_key
*ck
;
1279 for (ALL_LIST_ELEMENTS_RO(auth_crypt
, node
, ck
))
1280 if (ck
->key_id
== key_id
)
1286 int ospf_crypt_key_delete(struct list
*auth_crypt
, uint8_t key_id
)
1288 struct listnode
*node
, *nnode
;
1289 struct crypt_key
*ck
;
1291 for (ALL_LIST_ELEMENTS(auth_crypt
, node
, nnode
, ck
)) {
1292 if (ck
->key_id
== key_id
) {
1293 listnode_delete(auth_crypt
, ck
);
1294 XFREE(MTYPE_OSPF_CRYPT_KEY
, ck
);
1302 uint8_t ospf_default_iftype(struct interface
*ifp
)
1304 if (if_is_pointopoint(ifp
))
1305 return OSPF_IFTYPE_POINTOPOINT
;
1306 else if (if_is_loopback(ifp
))
1307 return OSPF_IFTYPE_LOOPBACK
;
1309 return OSPF_IFTYPE_BROADCAST
;
1312 void ospf_if_interface(struct interface
*ifp
)
1314 hook_call(ospf_if_update
, ifp
);
1317 uint32_t ospf_if_count_area_params(struct interface
*ifp
)
1319 struct ospf_if_params
*params
;
1320 struct route_node
*rn
;
1323 params
= IF_DEF_PARAMS(ifp
);
1324 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1327 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
1328 if ((params
= rn
->info
)
1329 && OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1335 static int ospf_ifp_create(struct interface
*ifp
)
1337 struct ospf
*ospf
= NULL
;
1338 struct ospf_if_info
*oii
;
1340 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1342 "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
1343 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1344 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1345 ifp
->metric
, ifp
->mtu
, ifp
->speed
);
1350 oii
->curr_mtu
= ifp
->mtu
;
1352 if (IF_DEF_PARAMS(ifp
)
1353 && !OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp
), type
)) {
1354 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), type
);
1355 IF_DEF_PARAMS(ifp
)->type
= ospf_default_iftype(ifp
);
1358 ospf
= ifp
->vrf
->info
;
1362 if (ospf_if_count_area_params(ifp
) > 0)
1363 ospf_interface_area_set(ospf
, ifp
);
1365 ospf_if_recalculate_output_cost(ifp
);
1367 ospf_if_update(ospf
, ifp
);
1369 if (HAS_LINK_PARAMS(ifp
))
1370 ospf_mpls_te_update_if(ifp
);
1372 hook_call(ospf_if_update
, ifp
);
1377 static int ospf_ifp_up(struct interface
*ifp
)
1379 struct ospf_interface
*oi
;
1380 struct route_node
*rn
;
1381 struct ospf_if_info
*oii
= ifp
->info
;
1383 ospf_if_recalculate_output_cost(ifp
);
1385 if (oii
&& oii
->curr_mtu
!= ifp
->mtu
) {
1386 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1388 "Zebra: Interface[%s] MTU change %u -> %u.",
1389 ifp
->name
, oii
->curr_mtu
, ifp
->mtu
);
1391 oii
->curr_mtu
= ifp
->mtu
;
1392 /* Must reset the interface (simulate down/up) when MTU
1399 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1400 zlog_debug("Zebra: Interface[%s] state change to up.",
1403 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1404 if ((oi
= rn
->info
) == NULL
)
1410 if (HAS_LINK_PARAMS(ifp
))
1411 ospf_mpls_te_update_if(ifp
);
1416 static int ospf_ifp_down(struct interface
*ifp
)
1418 struct ospf_interface
*oi
;
1419 struct route_node
*node
;
1421 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1422 zlog_debug("Zebra: Interface[%s] state change to down.",
1425 for (node
= route_top(IF_OIFS(ifp
)); node
; node
= route_next(node
)) {
1426 if ((oi
= node
->info
) == NULL
)
1434 static int ospf_ifp_destroy(struct interface
*ifp
)
1437 struct route_node
*rn
;
1439 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1441 "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
1442 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1443 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1444 ifp
->metric
, ifp
->mtu
);
1446 hook_call(ospf_if_delete
, ifp
);
1448 ospf
= ifp
->vrf
->info
;
1450 if (ospf_if_count_area_params(ifp
) > 0)
1451 ospf_interface_area_unset(ospf
, ifp
);
1454 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
))
1456 ospf_if_free((struct ospf_interface
*)rn
->info
);
1461 /* Resetting ospf hello timer */
1462 void ospf_reset_hello_timer(struct interface
*ifp
, struct in_addr addr
,
1465 struct route_node
*rn
;
1469 struct ospf_interface
*oi
= NULL
;
1473 p
.prefixlen
= IPV4_MAX_BITLEN
;
1475 oi
= ospf_if_table_lookup(ifp
, &p
);
1478 /* Send hello before restart the hello timer
1479 * to avoid session flaps in case of bigger
1480 * hello interval configurations.
1482 ospf_hello_send(oi
);
1484 /* Restart hello timer for this interface */
1485 THREAD_OFF(oi
->t_hello
);
1486 OSPF_HELLO_TIMER_ON(oi
);
1492 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1493 struct ospf_interface
*oi
= rn
->info
;
1498 /* If hello interval configured on this oi, don't restart. */
1499 if (OSPF_IF_PARAM_CONFIGURED(oi
->params
, v_hello
))
1502 /* Send hello before restart the hello timer
1503 * to avoid session flaps in case of bigger
1504 * hello interval configurations.
1506 ospf_hello_send(oi
);
1508 /* Restart the hello timer. */
1509 THREAD_OFF(oi
->t_hello
);
1510 OSPF_HELLO_TIMER_ON(oi
);
1514 void ospf_if_init(void)
1516 if_zapi_callbacks(ospf_ifp_create
, ospf_ifp_up
,
1517 ospf_ifp_down
, ospf_ifp_destroy
);
1519 /* Initialize Zebra interface data structure. */
1520 hook_register_prio(if_add
, 0, ospf_if_new_hook
);
1521 hook_register_prio(if_del
, 0, ospf_if_delete_hook
);