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
38 #include "ospfd/ospfd.h"
39 #include "ospfd/ospf_bfd.h"
40 #include "ospfd/ospf_spf.h"
41 #include "ospfd/ospf_interface.h"
42 #include "ospfd/ospf_ism.h"
43 #include "ospfd/ospf_asbr.h"
44 #include "ospfd/ospf_lsa.h"
45 #include "ospfd/ospf_lsdb.h"
46 #include "ospfd/ospf_neighbor.h"
47 #include "ospfd/ospf_nsm.h"
48 #include "ospfd/ospf_packet.h"
49 #include "ospfd/ospf_abr.h"
50 #include "ospfd/ospf_network.h"
51 #include "ospfd/ospf_dump.h"
52 #include "ospfd/ospf_ldp_sync.h"
53 #include "ospfd/ospf_route.h"
54 #include "ospfd/ospf_te.h"
56 DEFINE_QOBJ_TYPE(ospf_interface
);
57 DEFINE_HOOK(ospf_vl_add
, (struct ospf_vl_data
* vd
), (vd
));
58 DEFINE_HOOK(ospf_vl_delete
, (struct ospf_vl_data
* vd
), (vd
));
59 DEFINE_HOOK(ospf_if_update
, (struct interface
* ifp
), (ifp
));
60 DEFINE_HOOK(ospf_if_delete
, (struct interface
* ifp
), (ifp
));
62 int ospf_interface_neighbor_count(struct ospf_interface
*oi
)
65 struct route_node
*rn
;
66 struct ospf_neighbor
*nbr
= NULL
;
68 for (rn
= route_top(oi
->nbrs
); rn
; rn
= route_next(rn
)) {
73 /* Do not show myself. */
74 if (nbr
== oi
->nbr_self
)
76 /* Down state is not shown. */
77 if (nbr
->state
== NSM_Down
)
85 int ospf_if_get_output_cost(struct ospf_interface
*oi
)
87 /* If all else fails, use default OSPF cost */
91 /* if LDP-IGP Sync is running on interface set cost so interface
92 * is used only as last resort
94 if (ldp_sync_if_is_enabled(IF_DEF_PARAMS(oi
->ifp
)->ldp_sync_info
))
95 return (LDP_OSPF_LSINFINITY
);
97 /* ifp speed and bw can be 0 in some platforms, use ospf default bw
98 if bw is configured under interface it would be used.
100 if (!oi
->ifp
->bandwidth
&& oi
->ifp
->speed
)
103 bw
= oi
->ifp
->bandwidth
? oi
->ifp
->bandwidth
104 : OSPF_DEFAULT_BANDWIDTH
;
105 refbw
= oi
->ospf
->ref_bandwidth
;
107 /* A specified ip ospf cost overrides a calculated one. */
108 if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(oi
->ifp
), output_cost_cmd
)
109 || OSPF_IF_PARAM_CONFIGURED(oi
->params
, output_cost_cmd
))
110 cost
= OSPF_IF_PARAM(oi
, output_cost_cmd
);
111 /* See if a cost can be calculated from the zebra processes
112 interface bandwidth field. */
114 cost
= (uint32_t)((double)refbw
/ (double)bw
+ (double)0.5);
117 else if (cost
> 65535)
124 void ospf_if_recalculate_output_cost(struct interface
*ifp
)
127 struct route_node
*rn
;
129 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
130 struct ospf_interface
*oi
;
132 if ((oi
= rn
->info
) == NULL
)
135 newcost
= ospf_if_get_output_cost(oi
);
137 /* Is actual output cost changed? */
138 if (oi
->output_cost
!= newcost
) {
139 oi
->output_cost
= newcost
;
140 ospf_router_lsa_update_area(oi
->area
);
145 /* Simulate down/up on the interface. This is needed, for example, when
147 void ospf_if_reset(struct interface
*ifp
)
149 struct route_node
*rn
;
151 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
152 struct ospf_interface
*oi
;
154 if ((oi
= rn
->info
) == NULL
)
162 void ospf_if_reset_variables(struct ospf_interface
*oi
)
164 /* Set default values. */
165 /* don't clear this flag. oi->flag = OSPF_IF_DISABLE; */
168 oi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
170 /* preserve network-type */
171 if (oi
->type
!= OSPF_IFTYPE_NBMA
)
172 oi
->type
= OSPF_IFTYPE_BROADCAST
;
174 oi
->state
= ISM_Down
;
176 oi
->crypt_seqnum
= 0;
178 /* This must be short, (less than RxmtInterval)
179 - RFC 2328 Section 13.5 para 3. Set to 1 second to avoid Acks being
180 held back for too long - MAG */
184 /* lookup oi for specified prefix/ifp */
185 struct ospf_interface
*ospf_if_table_lookup(struct interface
*ifp
,
186 struct prefix
*prefix
)
189 struct route_node
*rn
;
190 struct ospf_interface
*rninfo
= NULL
;
193 p
.prefixlen
= IPV4_MAX_BITLEN
;
195 /* route_node_get implicitely locks */
196 if ((rn
= route_node_lookup(IF_OIFS(ifp
), &p
))) {
197 rninfo
= (struct ospf_interface
*)rn
->info
;
198 route_unlock_node(rn
);
204 static void ospf_add_to_if(struct interface
*ifp
, struct ospf_interface
*oi
)
206 struct route_node
*rn
;
210 p
.prefixlen
= IPV4_MAX_BITLEN
;
213 rn
= route_node_get(IF_OIFS(ifp
), &p
);
214 /* rn->info should either be NULL or equal to this oi
215 * as route_node_get may return an existing node
217 assert(!rn
->info
|| rn
->info
== oi
);
221 static void ospf_delete_from_if(struct interface
*ifp
,
222 struct ospf_interface
*oi
)
224 struct route_node
*rn
;
228 p
.prefixlen
= IPV4_MAX_BITLEN
;
230 rn
= route_node_lookup(IF_OIFS(oi
->ifp
), &p
);
234 route_unlock_node(rn
);
235 route_unlock_node(rn
);
238 struct ospf_interface
*ospf_if_new(struct ospf
*ospf
, struct interface
*ifp
,
241 struct ospf_interface
*oi
;
243 oi
= ospf_if_table_lookup(ifp
, p
);
247 oi
= XCALLOC(MTYPE_OSPF_IF
, sizeof(struct ospf_interface
));
249 oi
->obuf
= ospf_fifo_new();
251 /* Set zebra interface pointer. */
255 ospf_add_to_if(ifp
, oi
);
256 listnode_add(ospf
->oiflist
, oi
);
258 /* Initialize neighbor list. */
259 oi
->nbrs
= route_table_init();
261 /* Initialize static neighbor list. */
262 oi
->nbr_nbma
= list_new();
264 /* Initialize Link State Acknowledgment list. */
265 oi
->ls_ack
= list_new();
266 oi
->ls_ack_direct
.ls_ack
= list_new();
268 /* Set default values. */
269 ospf_if_reset_variables(oi
);
271 /* Set pseudo neighbor to Null */
274 oi
->ls_upd_queue
= route_table_init();
275 oi
->t_ls_upd_event
= NULL
;
276 oi
->t_ls_ack_direct
= NULL
;
278 oi
->crypt_seqnum
= frr_sequence32_next();
280 ospf_opaque_type9_lsa_init(oi
);
284 QOBJ_REG(oi
, ospf_interface
);
286 if (IS_DEBUG_OSPF_EVENT
)
287 zlog_debug("%s: ospf interface %s vrf %s id %u created",
288 __func__
, ifp
->name
, ospf_get_name(ospf
),
294 /* Restore an interface to its pre UP state
295 Used from ism_interface_down only */
296 void ospf_if_cleanup(struct ospf_interface
*oi
)
298 struct route_node
*rn
;
299 struct listnode
*node
, *nnode
;
300 struct ospf_neighbor
*nbr
;
301 struct ospf_nbr_nbma
*nbr_nbma
;
302 struct ospf_lsa
*lsa
;
304 /* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
305 /* delete all static neighbors attached to this interface */
306 for (ALL_LIST_ELEMENTS(oi
->nbr_nbma
, node
, nnode
, nbr_nbma
)) {
307 THREAD_OFF(nbr_nbma
->t_poll
);
310 nbr_nbma
->nbr
->nbr_nbma
= NULL
;
311 nbr_nbma
->nbr
= NULL
;
316 listnode_delete(oi
->nbr_nbma
, nbr_nbma
);
319 /* send Neighbor event KillNbr to all associated neighbors. */
320 for (rn
= route_top(oi
->nbrs
); rn
; rn
= route_next(rn
)) {
321 if ((nbr
= rn
->info
) != NULL
)
322 if (nbr
!= oi
->nbr_self
)
323 OSPF_NSM_EVENT_EXECUTE(nbr
, NSM_KillNbr
);
326 /* Cleanup Link State Acknowlegdment list. */
327 for (ALL_LIST_ELEMENTS(oi
->ls_ack
, node
, nnode
, lsa
))
328 ospf_lsa_unlock(&lsa
); /* oi->ls_ack */
329 list_delete_all_node(oi
->ls_ack
);
331 oi
->crypt_seqnum
= 0;
333 /* Empty link state update queue */
334 ospf_ls_upd_queue_empty(oi
);
336 /* Reset pseudo neighbor. */
337 ospf_nbr_self_reset(oi
, oi
->ospf
->router_id
);
340 void ospf_if_free(struct ospf_interface
*oi
)
344 ospf_fifo_free(oi
->obuf
);
346 assert(oi
->state
== ISM_Down
);
348 ospf_opaque_type9_lsa_term(oi
);
352 /* Free Pseudo Neighbour */
353 ospf_nbr_delete(oi
->nbr_self
);
355 route_table_finish(oi
->nbrs
);
356 route_table_finish(oi
->ls_upd_queue
);
358 /* Free any lists that should be freed */
359 list_delete(&oi
->nbr_nbma
);
361 list_delete(&oi
->ls_ack
);
362 list_delete(&oi
->ls_ack_direct
.ls_ack
);
364 if (IS_DEBUG_OSPF_EVENT
)
365 zlog_debug("%s: ospf interface %s vrf %s id %u deleted",
366 __func__
, oi
->ifp
->name
, oi
->ifp
->vrf
->name
,
367 oi
->ifp
->vrf
->vrf_id
);
369 ospf_delete_from_if(oi
->ifp
, oi
);
371 listnode_delete(oi
->ospf
->oiflist
, oi
);
372 listnode_delete(oi
->area
->oiflist
, oi
);
374 thread_cancel_event(master
, oi
);
376 memset(oi
, 0, sizeof(*oi
));
377 XFREE(MTYPE_OSPF_IF
, oi
);
380 int ospf_if_is_up(struct ospf_interface
*oi
)
382 return if_is_up(oi
->ifp
);
385 struct ospf_interface
*ospf_if_exists(struct ospf_interface
*oic
)
387 struct listnode
*node
;
389 struct ospf_interface
*oi
;
398 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
405 /* Lookup OSPF interface by router LSA posistion */
406 struct ospf_interface
*ospf_if_lookup_by_lsa_pos(struct ospf_area
*area
,
409 struct listnode
*node
;
410 struct ospf_interface
*oi
;
412 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, node
, oi
)) {
413 if (lsa_pos
>= oi
->lsa_pos_beg
&& lsa_pos
< oi
->lsa_pos_end
)
419 struct ospf_interface
*ospf_if_lookup_by_local_addr(struct ospf
*ospf
,
420 struct interface
*ifp
,
421 struct in_addr address
)
423 struct listnode
*node
;
424 struct ospf_interface
*oi
;
426 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
427 if (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
) {
428 if (ifp
&& oi
->ifp
!= ifp
)
431 if (IPV4_ADDR_SAME(&address
, &oi
->address
->u
.prefix4
))
438 struct ospf_interface
*ospf_if_lookup_by_prefix(struct ospf
*ospf
,
439 struct prefix_ipv4
*p
)
441 struct listnode
*node
;
442 struct ospf_interface
*oi
;
444 /* Check each Interface. */
445 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
)) {
446 if (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
) {
449 prefix_copy(&ptmp
, CONNECTED_PREFIX(oi
->connected
));
451 if (prefix_same(&ptmp
, (struct prefix
*)p
))
458 /* determine receiving interface by ifp and source address */
459 struct ospf_interface
*ospf_if_lookup_recv_if(struct ospf
*ospf
,
461 struct interface
*ifp
)
463 struct route_node
*rn
;
464 struct prefix_ipv4 addr
;
465 struct ospf_interface
*oi
, *match
, *unnumbered_match
;
467 addr
.family
= AF_INET
;
469 addr
.prefixlen
= IPV4_MAX_BITLEN
;
471 match
= unnumbered_match
= NULL
;
473 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
476 if (!oi
) /* oi can be NULL for PtP aliases */
479 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
482 if (if_is_loopback(oi
->ifp
))
485 if (CHECK_FLAG(oi
->connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
486 unnumbered_match
= oi
;
487 else if (prefix_match(CONNECTED_PREFIX(oi
->connected
),
488 (struct prefix
*)&addr
)) {
489 if ((match
== NULL
) || (match
->address
->prefixlen
490 < oi
->address
->prefixlen
))
498 return unnumbered_match
;
501 void ospf_interface_fifo_flush(struct ospf_interface
*oi
)
503 struct ospf
*ospf
= oi
->ospf
;
505 ospf_fifo_flush(oi
->obuf
);
507 if (oi
->on_write_q
) {
508 listnode_delete(ospf
->oi_write_q
, oi
);
509 if (list_isempty(ospf
->oi_write_q
))
510 THREAD_OFF(ospf
->t_write
);
515 static void ospf_if_reset_stats(struct ospf_interface
*oi
)
517 oi
->hello_in
= oi
->hello_out
= 0;
518 oi
->db_desc_in
= oi
->db_desc_out
= 0;
519 oi
->ls_req_in
= oi
->ls_req_out
= 0;
520 oi
->ls_upd_in
= oi
->ls_upd_out
= 0;
521 oi
->ls_ack_in
= oi
->ls_ack_out
= 0;
524 void ospf_if_stream_unset(struct ospf_interface
*oi
)
526 /* flush the interface packet queue */
527 ospf_interface_fifo_flush(oi
);
528 /*reset protocol stats */
529 ospf_if_reset_stats(oi
);
533 static struct ospf_if_params
*ospf_new_if_params(void)
535 struct ospf_if_params
*oip
;
537 oip
= XCALLOC(MTYPE_OSPF_IF_PARAMS
, sizeof(struct ospf_if_params
));
539 UNSET_IF_PARAM(oip
, output_cost_cmd
);
540 UNSET_IF_PARAM(oip
, transmit_delay
);
541 UNSET_IF_PARAM(oip
, retransmit_interval
);
542 UNSET_IF_PARAM(oip
, passive_interface
);
543 UNSET_IF_PARAM(oip
, v_hello
);
544 UNSET_IF_PARAM(oip
, fast_hello
);
545 UNSET_IF_PARAM(oip
, v_wait
);
546 UNSET_IF_PARAM(oip
, priority
);
547 UNSET_IF_PARAM(oip
, type
);
548 UNSET_IF_PARAM(oip
, auth_simple
);
549 UNSET_IF_PARAM(oip
, auth_crypt
);
550 UNSET_IF_PARAM(oip
, auth_type
);
551 UNSET_IF_PARAM(oip
, if_area
);
553 oip
->auth_crypt
= list_new();
555 oip
->network_lsa_seqnum
= htonl(OSPF_INITIAL_SEQUENCE_NUMBER
);
556 oip
->is_v_wait_set
= false;
563 static void ospf_del_if_params(struct interface
*ifp
,
564 struct ospf_if_params
*oip
)
566 list_delete(&oip
->auth_crypt
);
567 ospf_interface_disable_bfd(ifp
, oip
);
568 ldp_sync_info_free(&(oip
->ldp_sync_info
));
569 XFREE(MTYPE_OSPF_IF_PARAMS
, oip
);
572 void ospf_free_if_params(struct interface
*ifp
, struct in_addr addr
)
574 struct ospf_if_params
*oip
;
575 struct prefix_ipv4 p
;
576 struct route_node
*rn
;
579 p
.prefixlen
= IPV4_MAX_BITLEN
;
581 rn
= route_node_lookup(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
582 if (!rn
|| !rn
->info
)
586 route_unlock_node(rn
);
588 if (!OSPF_IF_PARAM_CONFIGURED(oip
, output_cost_cmd
)
589 && !OSPF_IF_PARAM_CONFIGURED(oip
, transmit_delay
)
590 && !OSPF_IF_PARAM_CONFIGURED(oip
, retransmit_interval
)
591 && !OSPF_IF_PARAM_CONFIGURED(oip
, passive_interface
)
592 && !OSPF_IF_PARAM_CONFIGURED(oip
, v_hello
)
593 && !OSPF_IF_PARAM_CONFIGURED(oip
, fast_hello
)
594 && !OSPF_IF_PARAM_CONFIGURED(oip
, v_wait
)
595 && !OSPF_IF_PARAM_CONFIGURED(oip
, priority
)
596 && !OSPF_IF_PARAM_CONFIGURED(oip
, type
)
597 && !OSPF_IF_PARAM_CONFIGURED(oip
, auth_simple
)
598 && !OSPF_IF_PARAM_CONFIGURED(oip
, auth_type
)
599 && !OSPF_IF_PARAM_CONFIGURED(oip
, if_area
)
600 && listcount(oip
->auth_crypt
) == 0) {
601 ospf_del_if_params(ifp
, oip
);
603 route_unlock_node(rn
);
607 struct ospf_if_params
*ospf_lookup_if_params(struct interface
*ifp
,
610 struct prefix_ipv4 p
;
611 struct route_node
*rn
;
614 p
.prefixlen
= IPV4_MAX_BITLEN
;
617 rn
= route_node_lookup(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
620 route_unlock_node(rn
);
627 struct ospf_if_params
*ospf_get_if_params(struct interface
*ifp
,
630 struct prefix_ipv4 p
;
631 struct route_node
*rn
;
634 p
.prefixlen
= IPV4_MAX_BITLEN
;
638 rn
= route_node_get(IF_OIFS_PARAMS(ifp
), (struct prefix
*)&p
);
640 if (rn
->info
== NULL
)
641 rn
->info
= ospf_new_if_params();
643 route_unlock_node(rn
);
648 void ospf_if_update_params(struct interface
*ifp
, struct in_addr addr
)
650 struct route_node
*rn
;
651 struct ospf_interface
*oi
;
653 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
654 if ((oi
= rn
->info
) == NULL
)
657 if (IPV4_ADDR_SAME(&oi
->address
->u
.prefix4
, &addr
))
658 oi
->params
= ospf_lookup_if_params(
659 ifp
, oi
->address
->u
.prefix4
);
663 int ospf_if_new_hook(struct interface
*ifp
)
667 ifp
->info
= XCALLOC(MTYPE_OSPF_IF_INFO
, sizeof(struct ospf_if_info
));
669 IF_OIFS(ifp
) = route_table_init();
670 IF_OIFS_PARAMS(ifp
) = route_table_init();
672 IF_DEF_PARAMS(ifp
) = ospf_new_if_params();
674 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), transmit_delay
);
675 IF_DEF_PARAMS(ifp
)->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
677 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), retransmit_interval
);
678 IF_DEF_PARAMS(ifp
)->retransmit_interval
=
679 OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
681 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), priority
);
682 IF_DEF_PARAMS(ifp
)->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
684 IF_DEF_PARAMS(ifp
)->mtu_ignore
= OSPF_MTU_IGNORE_DEFAULT
;
686 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), v_hello
);
687 IF_DEF_PARAMS(ifp
)->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
689 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), fast_hello
);
690 IF_DEF_PARAMS(ifp
)->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
692 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), v_wait
);
693 IF_DEF_PARAMS(ifp
)->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
695 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), auth_simple
);
696 memset(IF_DEF_PARAMS(ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
698 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), auth_type
);
699 IF_DEF_PARAMS(ifp
)->auth_type
= OSPF_AUTH_NOTSET
;
701 rc
= ospf_opaque_new_if(ifp
);
705 static int ospf_if_delete_hook(struct interface
*ifp
)
708 struct route_node
*rn
;
709 rc
= ospf_opaque_del_if(ifp
);
712 * This function must be called before `route_table_finish` due to
713 * BFD integration need to iterate over the interface neighbors to
714 * remove all registrations.
716 ospf_del_if_params(ifp
, IF_DEF_PARAMS(ifp
));
718 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
720 ospf_del_if_params(ifp
, rn
->info
);
722 route_table_finish(IF_OIFS(ifp
));
723 route_table_finish(IF_OIFS_PARAMS(ifp
));
725 XFREE(MTYPE_OSPF_IF_INFO
, ifp
->info
);
730 int ospf_if_is_enable(struct ospf_interface
*oi
)
732 if (!(if_is_loopback(oi
->ifp
)))
733 if (if_is_up(oi
->ifp
))
739 void ospf_if_set_multicast(struct ospf_interface
*oi
)
741 if ((oi
->state
> ISM_Loopback
) && (oi
->type
!= OSPF_IFTYPE_LOOPBACK
)
742 && (oi
->type
!= OSPF_IFTYPE_VIRTUALLINK
)
743 && (OSPF_IF_PASSIVE_STATUS(oi
) == OSPF_IF_ACTIVE
)) {
744 /* The interface should belong to the OSPF-all-routers group. */
745 if (!OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
746 && (ospf_if_add_allspfrouters(oi
->ospf
, oi
->address
,
749 /* Set the flag only if the system call to join
751 OI_MEMBER_JOINED(oi
, MEMBER_ALLROUTERS
);
753 /* The interface should NOT belong to the OSPF-all-routers
755 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)) {
756 /* Only actually drop if this is the last reference */
757 if (OI_MEMBER_COUNT(oi
, MEMBER_ALLROUTERS
) == 1)
758 ospf_if_drop_allspfrouters(oi
->ospf
,
761 /* Unset the flag regardless of whether the system call
763 the group succeeded, since it's much safer to assume
765 we are not a member. */
766 OI_MEMBER_LEFT(oi
, MEMBER_ALLROUTERS
);
770 if (((oi
->type
== OSPF_IFTYPE_BROADCAST
)
771 || (oi
->type
== OSPF_IFTYPE_POINTOPOINT
))
772 && ((oi
->state
== ISM_DR
) || (oi
->state
== ISM_Backup
))
773 && (OSPF_IF_PASSIVE_STATUS(oi
) == OSPF_IF_ACTIVE
)) {
774 /* The interface should belong to the OSPF-designated-routers
776 if (!OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
)
777 && (ospf_if_add_alldrouters(oi
->ospf
, oi
->address
,
780 /* Set the flag only if the system call to join
782 OI_MEMBER_JOINED(oi
, MEMBER_DROUTERS
);
784 /* The interface should NOT belong to the
785 * OSPF-designated-routers group */
786 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
)) {
787 /* drop only if last reference */
788 if (OI_MEMBER_COUNT(oi
, MEMBER_DROUTERS
) == 1)
789 ospf_if_drop_alldrouters(oi
->ospf
, oi
->address
,
792 /* Unset the flag regardless of whether the system call
794 the group succeeded, since it's much safer to assume
796 we are not a member. */
797 OI_MEMBER_LEFT(oi
, MEMBER_DROUTERS
);
802 int ospf_if_up(struct ospf_interface
*oi
)
807 if (oi
->type
== OSPF_IFTYPE_LOOPBACK
)
808 OSPF_ISM_EVENT_SCHEDULE(oi
, ISM_LoopInd
);
810 OSPF_ISM_EVENT_SCHEDULE(oi
, ISM_InterfaceUp
);
816 int ospf_if_down(struct ospf_interface
*oi
)
819 struct route_node
*rn
;
820 struct ospf_route
*or;
822 struct ospf_path
*op
;
829 /* Cease the HELPER role for all the neighbours
832 if (ospf
->is_helper_supported
) {
833 struct route_node
*rn
= NULL
;
835 if (ospf_interface_neighbor_count(oi
)) {
836 for (rn
= route_top(oi
->nbrs
); rn
;
837 rn
= route_next(rn
)) {
838 struct ospf_neighbor
*nbr
= NULL
;
845 if (OSPF_GR_IS_ACTIVE_HELPER(nbr
))
847 nbr
, OSPF_GR_HELPER_TOPO_CHG
);
852 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
853 /* delete position in router LSA */
856 /* Shutdown packet reception and sending */
857 ospf_if_stream_unset(oi
);
859 if (!ospf
->new_table
)
861 for (rn
= route_top(ospf
->new_table
); rn
; rn
= route_next(rn
)) {
867 for (nh
= listhead(or->paths
); nh
;
868 nh
= listnextnode_unchecked(nh
)) {
869 op
= listgetdata(nh
);
870 if (op
->ifindex
== oi
->ifp
->ifindex
) {
881 /* Virtual Link related functions. */
883 struct ospf_vl_data
*ospf_vl_data_new(struct ospf_area
*area
,
884 struct in_addr vl_peer
)
886 struct ospf_vl_data
*vl_data
;
888 vl_data
= XCALLOC(MTYPE_OSPF_VL_DATA
, sizeof(struct ospf_vl_data
));
890 vl_data
->vl_peer
.s_addr
= vl_peer
.s_addr
;
891 vl_data
->vl_area_id
= area
->area_id
;
892 vl_data
->vl_area_id_fmt
= area
->area_id_fmt
;
897 void ospf_vl_data_free(struct ospf_vl_data
*vl_data
)
899 XFREE(MTYPE_OSPF_VL_DATA
, vl_data
);
902 unsigned int vlink_count
= 0;
904 struct ospf_interface
*ospf_vl_new(struct ospf
*ospf
,
905 struct ospf_vl_data
*vl_data
)
907 struct ospf_interface
*voi
;
908 struct interface
*vi
;
909 char ifname
[INTERFACE_NAMSIZ
];
910 struct ospf_area
*area
;
911 struct in_addr area_id
;
912 struct connected
*co
;
913 struct prefix_ipv4
*p
;
915 if (IS_DEBUG_OSPF_EVENT
)
916 zlog_debug("%s: (%s): Start", __func__
, ospf_get_name(ospf
));
917 if (vlink_count
== OSPF_VL_MAX_COUNT
) {
918 if (IS_DEBUG_OSPF_EVENT
)
920 "%s: Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links",
926 if (IS_DEBUG_OSPF_EVENT
)
927 zlog_debug("%s: creating pseudo zebra interface vrf id %u",
928 __func__
, ospf
->vrf_id
);
930 snprintf(ifname
, sizeof(ifname
), "VLINK%u", vlink_count
);
931 vi
= if_get_by_name(ifname
, ospf
->vrf_id
, ospf
->name
);
933 * if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION
934 * virtual links don't need this.
936 UNSET_FLAG(vi
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
937 co
= connected_new();
939 listnode_add(vi
->connected
, co
);
941 p
= prefix_ipv4_new();
943 p
->prefix
.s_addr
= INADDR_ANY
;
946 co
->address
= (struct prefix
*)p
;
948 voi
= ospf_if_new(ospf
, vi
, co
->address
);
950 if (IS_DEBUG_OSPF_EVENT
)
952 "%s: Alarm: OSPF int structure is not created",
958 voi
->vl_data
= vl_data
;
959 voi
->ifp
->mtu
= OSPF_VL_MTU
;
960 voi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
963 if (IS_DEBUG_OSPF_EVENT
)
964 zlog_debug("%s: Created name: %s set if->name to %s", __func__
,
967 area_id
.s_addr
= INADDR_ANY
;
968 area
= ospf_area_get(ospf
, area_id
);
971 if (IS_DEBUG_OSPF_EVENT
)
972 zlog_debug("%s: set associated area to the backbone", __func__
);
974 /* Add pseudo neighbor. */
975 ospf_nbr_self_reset(voi
, voi
->ospf
->router_id
);
977 ospf_area_add_if(voi
->area
, voi
);
979 if (IS_DEBUG_OSPF_EVENT
)
980 zlog_debug("%s: Stop", __func__
);
984 static void ospf_vl_if_delete(struct ospf_vl_data
*vl_data
)
986 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
987 struct vrf
*vrf
= ifp
->vrf
;
989 vl_data
->vl_oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
990 vl_data
->vl_oi
->address
->prefixlen
= 0;
991 ospf_if_free(vl_data
->vl_oi
);
993 if (!vrf_is_enabled(vrf
))
998 /* for a defined area, count the number of configured vl
1000 int ospf_vl_count(struct ospf
*ospf
, struct ospf_area
*area
)
1003 struct ospf_vl_data
*vl_data
;
1004 struct listnode
*node
;
1006 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1008 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1015 /* Look up vl_data for given peer, optionally qualified to be in the
1016 * specified area. NULL area returns first found..
1018 struct ospf_vl_data
*ospf_vl_lookup(struct ospf
*ospf
, struct ospf_area
*area
,
1019 struct in_addr vl_peer
)
1021 struct ospf_vl_data
*vl_data
;
1022 struct listnode
*node
;
1024 if (IS_DEBUG_OSPF_EVENT
) {
1025 zlog_debug("%s: Looking for %pI4", __func__
, &vl_peer
);
1027 zlog_debug("%s: in area %pI4", __func__
,
1031 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1032 if (IS_DEBUG_OSPF_EVENT
)
1033 zlog_debug("%s: VL %s, peer %pI4", __func__
,
1034 vl_data
->vl_oi
->ifp
->name
,
1038 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1041 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &vl_peer
))
1048 static void ospf_vl_shutdown(struct ospf_vl_data
*vl_data
)
1050 struct ospf_interface
*oi
;
1052 if ((oi
= vl_data
->vl_oi
) == NULL
)
1055 oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
1056 oi
->address
->prefixlen
= 0;
1058 UNSET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1059 /* OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceDown); */
1060 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
1063 void ospf_vl_add(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1065 listnode_add(ospf
->vlinks
, vl_data
);
1066 hook_call(ospf_vl_add
, vl_data
);
1069 void ospf_vl_delete(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1071 ospf_vl_shutdown(vl_data
);
1072 ospf_vl_if_delete(vl_data
);
1074 hook_call(ospf_vl_delete
, vl_data
);
1075 listnode_delete(ospf
->vlinks
, vl_data
);
1077 ospf_vl_data_free(vl_data
);
1080 static int ospf_vl_set_params(struct ospf_area
*area
,
1081 struct ospf_vl_data
*vl_data
, struct vertex
*v
)
1084 struct ospf_interface
*voi
;
1085 struct listnode
*node
;
1086 struct vertex_parent
*vp
= NULL
;
1088 struct router_lsa
*rl
;
1089 struct ospf_interface
*oi
;
1091 voi
= vl_data
->vl_oi
;
1093 if (voi
->output_cost
!= v
->distance
) {
1095 voi
->output_cost
= v
->distance
;
1099 for (ALL_LIST_ELEMENTS_RO(v
->parents
, node
, vp
)) {
1100 vl_data
->nexthop
.lsa_pos
= vp
->nexthop
->lsa_pos
;
1101 vl_data
->nexthop
.router
= vp
->nexthop
->router
;
1104 * Only deal with interface data when the local
1105 * (calculating) node is the SPF root node
1107 if (!area
->spf_dry_run
) {
1108 oi
= ospf_if_lookup_by_lsa_pos(
1109 area
, vl_data
->nexthop
.lsa_pos
);
1111 if (!IPV4_ADDR_SAME(&voi
->address
->u
.prefix4
,
1112 &oi
->address
->u
.prefix4
))
1115 voi
->address
->u
.prefix4
= oi
->address
->u
.prefix4
;
1116 voi
->address
->prefixlen
= oi
->address
->prefixlen
;
1119 break; /* We take the first interface. */
1122 rl
= (struct router_lsa
*)v
->lsa
;
1124 /* use SPF determined backlink index in struct vertex
1125 * for virtual link destination address
1127 if (vp
&& vp
->backlink
>= 0) {
1128 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1129 &rl
->link
[vp
->backlink
].link_data
))
1131 vl_data
->peer_addr
= rl
->link
[vp
->backlink
].link_data
;
1133 /* This is highly odd, there is no backlink index
1134 * there should be due to the ospf_spf_has_link() check
1135 * in SPF. Lets warn and try pick a link anyway.
1137 zlog_info("ospf_vl_set_params: No backlink for %s!",
1138 vl_data
->vl_oi
->ifp
->name
);
1139 for (i
= 0; i
< ntohs(rl
->links
); i
++) {
1140 switch (rl
->link
[i
].type
) {
1141 case LSA_LINK_TYPE_VIRTUALLINK
:
1142 if (IS_DEBUG_OSPF_EVENT
)
1144 "found back link through VL");
1146 case LSA_LINK_TYPE_TRANSIT
:
1147 case LSA_LINK_TYPE_POINTOPOINT
:
1148 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1149 &rl
->link
[i
].link_data
))
1151 vl_data
->peer_addr
= rl
->link
[i
].link_data
;
1156 if (IS_DEBUG_OSPF_EVENT
)
1157 zlog_debug("%s: %s peer address: %pI4, cost: %d,%schanged",
1158 __func__
, vl_data
->vl_oi
->ifp
->name
,
1159 &vl_data
->peer_addr
, voi
->output_cost
,
1160 (changed
? " " : " un"));
1166 void ospf_vl_up_check(struct ospf_area
*area
, struct in_addr rid
,
1169 struct ospf
*ospf
= area
->ospf
;
1170 struct listnode
*node
;
1171 struct ospf_vl_data
*vl_data
;
1172 struct ospf_interface
*oi
;
1174 if (IS_DEBUG_OSPF_EVENT
) {
1175 zlog_debug("%s: Start", __func__
);
1176 zlog_debug("%s: Router ID is %pI4 Area is %pI4", __func__
, &rid
,
1180 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1181 if (IS_DEBUG_OSPF_EVENT
) {
1182 zlog_debug("%s: considering VL, %s in area %pI4",
1183 __func__
, vl_data
->vl_oi
->ifp
->name
,
1184 &vl_data
->vl_area_id
);
1185 zlog_debug("%s: peer ID: %pI4", __func__
,
1189 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &rid
)
1190 && IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
)) {
1191 oi
= vl_data
->vl_oi
;
1192 SET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1194 if (IS_DEBUG_OSPF_EVENT
)
1195 zlog_debug("%s: this VL matched", __func__
);
1197 if (oi
->state
== ISM_Down
) {
1198 if (IS_DEBUG_OSPF_EVENT
)
1200 "%s: VL is down, waking it up",
1202 SET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1203 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceUp
);
1206 if (ospf_vl_set_params(area
, vl_data
, v
)) {
1207 if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1209 "%s: VL cost change, scheduling router lsa refresh",
1212 ospf_router_lsa_update_area(
1214 else if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1216 "%s: VL cost change, no backbone!",
1223 void ospf_vl_unapprove(struct ospf
*ospf
)
1225 struct listnode
*node
;
1226 struct ospf_vl_data
*vl_data
;
1228 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
))
1229 UNSET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1232 void ospf_vl_shut_unapproved(struct ospf
*ospf
)
1234 struct listnode
*node
, *nnode
;
1235 struct ospf_vl_data
*vl_data
;
1237 for (ALL_LIST_ELEMENTS(ospf
->vlinks
, node
, nnode
, vl_data
))
1238 if (!CHECK_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
))
1239 ospf_vl_shutdown(vl_data
);
1242 int ospf_full_virtual_nbrs(struct ospf_area
*area
)
1244 if (IS_DEBUG_OSPF_EVENT
) {
1246 "counting fully adjacent virtual neighbors in area %pI4",
1248 zlog_debug("there are %d of them", area
->full_vls
);
1251 return area
->full_vls
;
1254 int ospf_vls_in_area(struct ospf_area
*area
)
1256 struct listnode
*node
;
1257 struct ospf_vl_data
*vl_data
;
1260 for (ALL_LIST_ELEMENTS_RO(area
->ospf
->vlinks
, node
, vl_data
))
1261 if (IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1268 struct crypt_key
*ospf_crypt_key_new(void)
1270 return XCALLOC(MTYPE_OSPF_CRYPT_KEY
, sizeof(struct crypt_key
));
1273 void ospf_crypt_key_add(struct list
*crypt
, struct crypt_key
*ck
)
1275 listnode_add(crypt
, ck
);
1278 struct crypt_key
*ospf_crypt_key_lookup(struct list
*auth_crypt
, uint8_t key_id
)
1280 struct listnode
*node
;
1281 struct crypt_key
*ck
;
1283 for (ALL_LIST_ELEMENTS_RO(auth_crypt
, node
, ck
))
1284 if (ck
->key_id
== key_id
)
1290 int ospf_crypt_key_delete(struct list
*auth_crypt
, uint8_t key_id
)
1292 struct listnode
*node
, *nnode
;
1293 struct crypt_key
*ck
;
1295 for (ALL_LIST_ELEMENTS(auth_crypt
, node
, nnode
, ck
)) {
1296 if (ck
->key_id
== key_id
) {
1297 listnode_delete(auth_crypt
, ck
);
1298 XFREE(MTYPE_OSPF_CRYPT_KEY
, ck
);
1306 uint8_t ospf_default_iftype(struct interface
*ifp
)
1308 if (if_is_pointopoint(ifp
))
1309 return OSPF_IFTYPE_POINTOPOINT
;
1310 else if (if_is_loopback(ifp
))
1311 return OSPF_IFTYPE_LOOPBACK
;
1313 return OSPF_IFTYPE_BROADCAST
;
1316 void ospf_if_interface(struct interface
*ifp
)
1318 hook_call(ospf_if_update
, ifp
);
1321 uint32_t ospf_if_count_area_params(struct interface
*ifp
)
1323 struct ospf_if_params
*params
;
1324 struct route_node
*rn
;
1327 params
= IF_DEF_PARAMS(ifp
);
1328 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1331 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
1332 if ((params
= rn
->info
)
1333 && OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1339 static int ospf_ifp_create(struct interface
*ifp
)
1341 struct ospf
*ospf
= NULL
;
1342 struct ospf_if_info
*oii
;
1344 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1346 "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
1347 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1348 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1349 ifp
->metric
, ifp
->mtu
, ifp
->speed
);
1354 oii
->curr_mtu
= ifp
->mtu
;
1356 if (IF_DEF_PARAMS(ifp
)
1357 && !OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp
), type
)) {
1358 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), type
);
1359 IF_DEF_PARAMS(ifp
)->type
= ospf_default_iftype(ifp
);
1362 ospf
= ifp
->vrf
->info
;
1366 if (ospf_if_count_area_params(ifp
) > 0)
1367 ospf_interface_area_set(ospf
, ifp
);
1369 ospf_if_recalculate_output_cost(ifp
);
1371 ospf_if_update(ospf
, ifp
);
1373 if (HAS_LINK_PARAMS(ifp
))
1374 ospf_mpls_te_update_if(ifp
);
1376 hook_call(ospf_if_update
, ifp
);
1381 static int ospf_ifp_up(struct interface
*ifp
)
1383 struct ospf_interface
*oi
;
1384 struct route_node
*rn
;
1385 struct ospf_if_info
*oii
= ifp
->info
;
1387 ospf_if_recalculate_output_cost(ifp
);
1389 if (oii
&& oii
->curr_mtu
!= ifp
->mtu
) {
1390 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1392 "Zebra: Interface[%s] MTU change %u -> %u.",
1393 ifp
->name
, oii
->curr_mtu
, ifp
->mtu
);
1395 oii
->curr_mtu
= ifp
->mtu
;
1396 /* Must reset the interface (simulate down/up) when MTU
1403 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1404 zlog_debug("Zebra: Interface[%s] state change to up.",
1407 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1408 if ((oi
= rn
->info
) == NULL
)
1414 if (HAS_LINK_PARAMS(ifp
))
1415 ospf_mpls_te_update_if(ifp
);
1420 static int ospf_ifp_down(struct interface
*ifp
)
1422 struct ospf_interface
*oi
;
1423 struct route_node
*node
;
1425 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1426 zlog_debug("Zebra: Interface[%s] state change to down.",
1429 for (node
= route_top(IF_OIFS(ifp
)); node
; node
= route_next(node
)) {
1430 if ((oi
= node
->info
) == NULL
)
1438 static int ospf_ifp_destroy(struct interface
*ifp
)
1441 struct route_node
*rn
;
1443 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1445 "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
1446 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1447 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1448 ifp
->metric
, ifp
->mtu
);
1450 hook_call(ospf_if_delete
, ifp
);
1452 ospf
= ifp
->vrf
->info
;
1454 if (ospf_if_count_area_params(ifp
) > 0)
1455 ospf_interface_area_unset(ospf
, ifp
);
1458 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
))
1460 ospf_if_free((struct ospf_interface
*)rn
->info
);
1465 /* Resetting ospf hello timer */
1466 void ospf_reset_hello_timer(struct interface
*ifp
, struct in_addr addr
,
1469 struct route_node
*rn
;
1473 struct ospf_interface
*oi
= NULL
;
1477 p
.prefixlen
= IPV4_MAX_BITLEN
;
1479 oi
= ospf_if_table_lookup(ifp
, &p
);
1482 /* Send hello before restart the hello timer
1483 * to avoid session flaps in case of bigger
1484 * hello interval configurations.
1486 ospf_hello_send(oi
);
1488 /* Restart hello timer for this interface */
1489 THREAD_OFF(oi
->t_hello
);
1490 OSPF_HELLO_TIMER_ON(oi
);
1496 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1497 struct ospf_interface
*oi
= rn
->info
;
1502 /* If hello interval configured on this oi, don't restart. */
1503 if (OSPF_IF_PARAM_CONFIGURED(oi
->params
, v_hello
))
1506 /* Send hello before restart the hello timer
1507 * to avoid session flaps in case of bigger
1508 * hello interval configurations.
1510 ospf_hello_send(oi
);
1512 /* Restart the hello timer. */
1513 THREAD_OFF(oi
->t_hello
);
1514 OSPF_HELLO_TIMER_ON(oi
);
1518 void ospf_if_init(void)
1520 if_zapi_callbacks(ospf_ifp_create
, ospf_ifp_up
,
1521 ospf_ifp_down
, ospf_ifp_destroy
);
1523 /* Initialize Zebra interface data structure. */
1524 hook_register_prio(if_add
, 0, ospf_if_new_hook
);
1525 hook_register_prio(if_del
, 0, ospf_if_delete_hook
);