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 for (rn
= route_top(ospf
->new_table
); rn
; rn
= route_next(rn
)) {
854 for (nh
= listhead(or->paths
); nh
;
855 nh
= listnextnode_unchecked(nh
)) {
856 op
= listgetdata(nh
);
857 if (op
->ifindex
== oi
->ifp
->ifindex
) {
868 /* Virtual Link related functions. */
870 struct ospf_vl_data
*ospf_vl_data_new(struct ospf_area
*area
,
871 struct in_addr vl_peer
)
873 struct ospf_vl_data
*vl_data
;
875 vl_data
= XCALLOC(MTYPE_OSPF_VL_DATA
, sizeof(struct ospf_vl_data
));
877 vl_data
->vl_peer
.s_addr
= vl_peer
.s_addr
;
878 vl_data
->vl_area_id
= area
->area_id
;
879 vl_data
->vl_area_id_fmt
= area
->area_id_fmt
;
884 void ospf_vl_data_free(struct ospf_vl_data
*vl_data
)
886 XFREE(MTYPE_OSPF_VL_DATA
, vl_data
);
889 unsigned int vlink_count
= 0;
891 struct ospf_interface
*ospf_vl_new(struct ospf
*ospf
,
892 struct ospf_vl_data
*vl_data
)
894 struct ospf_interface
*voi
;
895 struct interface
*vi
;
896 char ifname
[INTERFACE_NAMSIZ
];
897 struct ospf_area
*area
;
898 struct in_addr area_id
;
899 struct connected
*co
;
900 struct prefix_ipv4
*p
;
902 if (IS_DEBUG_OSPF_EVENT
)
903 zlog_debug("ospf_vl_new()(%s): Start", ospf_get_name(ospf
));
904 if (vlink_count
== OSPF_VL_MAX_COUNT
) {
905 if (IS_DEBUG_OSPF_EVENT
)
907 "ospf_vl_new(): Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links");
911 if (IS_DEBUG_OSPF_EVENT
)
913 "ospf_vl_new(): creating pseudo zebra interface vrf id %u",
916 snprintf(ifname
, sizeof(ifname
), "VLINK%u", vlink_count
);
917 vi
= if_get_by_name(ifname
, ospf
->vrf_id
, ospf
->name
);
919 * if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION
920 * virtual links don't need this.
922 UNSET_FLAG(vi
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
923 co
= connected_new();
925 listnode_add(vi
->connected
, co
);
927 p
= prefix_ipv4_new();
929 p
->prefix
.s_addr
= INADDR_ANY
;
932 co
->address
= (struct prefix
*)p
;
934 voi
= ospf_if_new(ospf
, vi
, co
->address
);
936 if (IS_DEBUG_OSPF_EVENT
)
938 "ospf_vl_new(): Alarm: OSPF int structure is not created");
942 voi
->vl_data
= vl_data
;
943 voi
->ifp
->mtu
= OSPF_VL_MTU
;
944 voi
->type
= OSPF_IFTYPE_VIRTUALLINK
;
947 if (IS_DEBUG_OSPF_EVENT
)
948 zlog_debug("ospf_vl_new(): Created name: %s", ifname
);
949 if (IS_DEBUG_OSPF_EVENT
)
950 zlog_debug("ospf_vl_new(): set if->name to %s", vi
->name
);
952 area_id
.s_addr
= INADDR_ANY
;
953 area
= ospf_area_get(ospf
, area_id
);
956 if (IS_DEBUG_OSPF_EVENT
)
958 "ospf_vl_new(): set associated area to the backbone");
960 /* Add pseudo neighbor. */
961 ospf_nbr_self_reset(voi
, voi
->ospf
->router_id
);
963 ospf_area_add_if(voi
->area
, voi
);
965 if (IS_DEBUG_OSPF_EVENT
)
966 zlog_debug("ospf_vl_new(): Stop");
970 static void ospf_vl_if_delete(struct ospf_vl_data
*vl_data
)
972 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
973 struct vrf
*vrf
= ifp
->vrf
;
975 vl_data
->vl_oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
976 vl_data
->vl_oi
->address
->prefixlen
= 0;
977 ospf_if_free(vl_data
->vl_oi
);
979 if (!vrf_is_enabled(vrf
))
984 /* for a defined area, count the number of configured vl
986 int ospf_vl_count(struct ospf
*ospf
, struct ospf_area
*area
)
989 struct ospf_vl_data
*vl_data
;
990 struct listnode
*node
;
992 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
994 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1001 /* Look up vl_data for given peer, optionally qualified to be in the
1002 * specified area. NULL area returns first found..
1004 struct ospf_vl_data
*ospf_vl_lookup(struct ospf
*ospf
, struct ospf_area
*area
,
1005 struct in_addr vl_peer
)
1007 struct ospf_vl_data
*vl_data
;
1008 struct listnode
*node
;
1010 if (IS_DEBUG_OSPF_EVENT
) {
1011 zlog_debug("%s: Looking for %pI4", __func__
, &vl_peer
);
1013 zlog_debug("%s: in area %pI4", __func__
,
1017 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1018 if (IS_DEBUG_OSPF_EVENT
)
1019 zlog_debug("%s: VL %s, peer %pI4", __func__
,
1020 vl_data
->vl_oi
->ifp
->name
,
1024 && !IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1027 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &vl_peer
))
1034 static void ospf_vl_shutdown(struct ospf_vl_data
*vl_data
)
1036 struct ospf_interface
*oi
;
1038 if ((oi
= vl_data
->vl_oi
) == NULL
)
1041 oi
->address
->u
.prefix4
.s_addr
= INADDR_ANY
;
1042 oi
->address
->prefixlen
= 0;
1044 UNSET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1045 /* OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceDown); */
1046 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceDown
);
1049 void ospf_vl_add(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1051 listnode_add(ospf
->vlinks
, vl_data
);
1052 hook_call(ospf_vl_add
, vl_data
);
1055 void ospf_vl_delete(struct ospf
*ospf
, struct ospf_vl_data
*vl_data
)
1057 ospf_vl_shutdown(vl_data
);
1058 ospf_vl_if_delete(vl_data
);
1060 hook_call(ospf_vl_delete
, vl_data
);
1061 listnode_delete(ospf
->vlinks
, vl_data
);
1063 ospf_vl_data_free(vl_data
);
1066 static int ospf_vl_set_params(struct ospf_area
*area
,
1067 struct ospf_vl_data
*vl_data
, struct vertex
*v
)
1070 struct ospf_interface
*voi
;
1071 struct listnode
*node
;
1072 struct vertex_parent
*vp
= NULL
;
1074 struct router_lsa
*rl
;
1075 struct ospf_interface
*oi
;
1077 voi
= vl_data
->vl_oi
;
1079 if (voi
->output_cost
!= v
->distance
) {
1081 voi
->output_cost
= v
->distance
;
1085 for (ALL_LIST_ELEMENTS_RO(v
->parents
, node
, vp
)) {
1086 vl_data
->nexthop
.lsa_pos
= vp
->nexthop
->lsa_pos
;
1087 vl_data
->nexthop
.router
= vp
->nexthop
->router
;
1090 * Only deal with interface data when the local
1091 * (calculating) node is the SPF root node
1093 if (!area
->spf_dry_run
) {
1094 oi
= ospf_if_lookup_by_lsa_pos(
1095 area
, vl_data
->nexthop
.lsa_pos
);
1097 if (!IPV4_ADDR_SAME(&voi
->address
->u
.prefix4
,
1098 &oi
->address
->u
.prefix4
))
1101 voi
->address
->u
.prefix4
= oi
->address
->u
.prefix4
;
1102 voi
->address
->prefixlen
= oi
->address
->prefixlen
;
1105 break; /* We take the first interface. */
1108 rl
= (struct router_lsa
*)v
->lsa
;
1110 /* use SPF determined backlink index in struct vertex
1111 * for virtual link destination address
1113 if (vp
&& vp
->backlink
>= 0) {
1114 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1115 &rl
->link
[vp
->backlink
].link_data
))
1117 vl_data
->peer_addr
= rl
->link
[vp
->backlink
].link_data
;
1119 /* This is highly odd, there is no backlink index
1120 * there should be due to the ospf_spf_has_link() check
1121 * in SPF. Lets warn and try pick a link anyway.
1123 zlog_info("ospf_vl_set_params: No backlink for %s!",
1124 vl_data
->vl_oi
->ifp
->name
);
1125 for (i
= 0; i
< ntohs(rl
->links
); i
++) {
1126 switch (rl
->link
[i
].type
) {
1127 case LSA_LINK_TYPE_VIRTUALLINK
:
1128 if (IS_DEBUG_OSPF_EVENT
)
1130 "found back link through VL");
1132 case LSA_LINK_TYPE_TRANSIT
:
1133 case LSA_LINK_TYPE_POINTOPOINT
:
1134 if (!IPV4_ADDR_SAME(&vl_data
->peer_addr
,
1135 &rl
->link
[i
].link_data
))
1137 vl_data
->peer_addr
= rl
->link
[i
].link_data
;
1142 if (IS_DEBUG_OSPF_EVENT
)
1143 zlog_debug("%s: %s peer address: %pI4, cost: %d,%schanged",
1144 __func__
, vl_data
->vl_oi
->ifp
->name
,
1145 &vl_data
->peer_addr
, voi
->output_cost
,
1146 (changed
? " " : " un"));
1152 void ospf_vl_up_check(struct ospf_area
*area
, struct in_addr rid
,
1155 struct ospf
*ospf
= area
->ospf
;
1156 struct listnode
*node
;
1157 struct ospf_vl_data
*vl_data
;
1158 struct ospf_interface
*oi
;
1160 if (IS_DEBUG_OSPF_EVENT
) {
1161 zlog_debug("ospf_vl_up_check(): Start");
1162 zlog_debug("ospf_vl_up_check(): Router ID is %pI4",
1164 zlog_debug("ospf_vl_up_check(): Area is %pI4",
1168 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
)) {
1169 if (IS_DEBUG_OSPF_EVENT
) {
1170 zlog_debug("%s: considering VL, %s in area %pI4",
1171 __func__
, vl_data
->vl_oi
->ifp
->name
,
1172 &vl_data
->vl_area_id
);
1173 zlog_debug("%s: peer ID: %pI4", __func__
,
1177 if (IPV4_ADDR_SAME(&vl_data
->vl_peer
, &rid
)
1178 && IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
)) {
1179 oi
= vl_data
->vl_oi
;
1180 SET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1182 if (IS_DEBUG_OSPF_EVENT
)
1184 "ospf_vl_up_check(): this VL matched");
1186 if (oi
->state
== ISM_Down
) {
1187 if (IS_DEBUG_OSPF_EVENT
)
1189 "ospf_vl_up_check(): VL is down, waking it up");
1190 SET_FLAG(oi
->ifp
->flags
, IFF_UP
);
1191 OSPF_ISM_EVENT_EXECUTE(oi
, ISM_InterfaceUp
);
1194 if (ospf_vl_set_params(area
, vl_data
, v
)) {
1195 if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1197 "ospf_vl_up_check: VL cost change, scheduling router lsa refresh");
1199 ospf_router_lsa_update_area(
1201 else if (IS_DEBUG_OSPF(ism
, ISM_EVENTS
))
1203 "ospf_vl_up_check: VL cost change, no backbone!");
1209 void ospf_vl_unapprove(struct ospf
*ospf
)
1211 struct listnode
*node
;
1212 struct ospf_vl_data
*vl_data
;
1214 for (ALL_LIST_ELEMENTS_RO(ospf
->vlinks
, node
, vl_data
))
1215 UNSET_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
);
1218 void ospf_vl_shut_unapproved(struct ospf
*ospf
)
1220 struct listnode
*node
, *nnode
;
1221 struct ospf_vl_data
*vl_data
;
1223 for (ALL_LIST_ELEMENTS(ospf
->vlinks
, node
, nnode
, vl_data
))
1224 if (!CHECK_FLAG(vl_data
->flags
, OSPF_VL_FLAG_APPROVED
))
1225 ospf_vl_shutdown(vl_data
);
1228 int ospf_full_virtual_nbrs(struct ospf_area
*area
)
1230 if (IS_DEBUG_OSPF_EVENT
) {
1232 "counting fully adjacent virtual neighbors in area %pI4",
1234 zlog_debug("there are %d of them", area
->full_vls
);
1237 return area
->full_vls
;
1240 int ospf_vls_in_area(struct ospf_area
*area
)
1242 struct listnode
*node
;
1243 struct ospf_vl_data
*vl_data
;
1246 for (ALL_LIST_ELEMENTS_RO(area
->ospf
->vlinks
, node
, vl_data
))
1247 if (IPV4_ADDR_SAME(&vl_data
->vl_area_id
, &area
->area_id
))
1254 struct crypt_key
*ospf_crypt_key_new(void)
1256 return XCALLOC(MTYPE_OSPF_CRYPT_KEY
, sizeof(struct crypt_key
));
1259 void ospf_crypt_key_add(struct list
*crypt
, struct crypt_key
*ck
)
1261 listnode_add(crypt
, ck
);
1264 struct crypt_key
*ospf_crypt_key_lookup(struct list
*auth_crypt
, uint8_t key_id
)
1266 struct listnode
*node
;
1267 struct crypt_key
*ck
;
1269 for (ALL_LIST_ELEMENTS_RO(auth_crypt
, node
, ck
))
1270 if (ck
->key_id
== key_id
)
1276 int ospf_crypt_key_delete(struct list
*auth_crypt
, uint8_t key_id
)
1278 struct listnode
*node
, *nnode
;
1279 struct crypt_key
*ck
;
1281 for (ALL_LIST_ELEMENTS(auth_crypt
, node
, nnode
, ck
)) {
1282 if (ck
->key_id
== key_id
) {
1283 listnode_delete(auth_crypt
, ck
);
1284 XFREE(MTYPE_OSPF_CRYPT_KEY
, ck
);
1292 uint8_t ospf_default_iftype(struct interface
*ifp
)
1294 if (if_is_pointopoint(ifp
))
1295 return OSPF_IFTYPE_POINTOPOINT
;
1296 else if (if_is_loopback(ifp
))
1297 return OSPF_IFTYPE_LOOPBACK
;
1299 return OSPF_IFTYPE_BROADCAST
;
1302 void ospf_if_interface(struct interface
*ifp
)
1304 hook_call(ospf_if_update
, ifp
);
1307 uint32_t ospf_if_count_area_params(struct interface
*ifp
)
1309 struct ospf_if_params
*params
;
1310 struct route_node
*rn
;
1313 params
= IF_DEF_PARAMS(ifp
);
1314 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1317 for (rn
= route_top(IF_OIFS_PARAMS(ifp
)); rn
; rn
= route_next(rn
))
1318 if ((params
= rn
->info
)
1319 && OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
1325 static int ospf_ifp_create(struct interface
*ifp
)
1327 struct ospf
*ospf
= NULL
;
1328 struct ospf_if_info
*oii
;
1330 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1332 "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
1333 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1334 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1335 ifp
->metric
, ifp
->mtu
, ifp
->speed
);
1340 oii
->curr_mtu
= ifp
->mtu
;
1342 if (IF_DEF_PARAMS(ifp
)
1343 && !OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp
), type
)) {
1344 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), type
);
1345 IF_DEF_PARAMS(ifp
)->type
= ospf_default_iftype(ifp
);
1348 ospf
= ifp
->vrf
->info
;
1352 if (ospf_if_count_area_params(ifp
) > 0)
1353 ospf_interface_area_set(ospf
, ifp
);
1355 ospf_if_recalculate_output_cost(ifp
);
1357 ospf_if_update(ospf
, ifp
);
1359 if (HAS_LINK_PARAMS(ifp
))
1360 ospf_mpls_te_update_if(ifp
);
1362 hook_call(ospf_if_update
, ifp
);
1367 static int ospf_ifp_up(struct interface
*ifp
)
1369 struct ospf_interface
*oi
;
1370 struct route_node
*rn
;
1371 struct ospf_if_info
*oii
= ifp
->info
;
1373 ospf_if_recalculate_output_cost(ifp
);
1375 if (oii
&& oii
->curr_mtu
!= ifp
->mtu
) {
1376 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1378 "Zebra: Interface[%s] MTU change %u -> %u.",
1379 ifp
->name
, oii
->curr_mtu
, ifp
->mtu
);
1381 oii
->curr_mtu
= ifp
->mtu
;
1382 /* Must reset the interface (simulate down/up) when MTU
1389 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1390 zlog_debug("Zebra: Interface[%s] state change to up.",
1393 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1394 if ((oi
= rn
->info
) == NULL
)
1400 if (HAS_LINK_PARAMS(ifp
))
1401 ospf_mpls_te_update_if(ifp
);
1406 static int ospf_ifp_down(struct interface
*ifp
)
1408 struct ospf_interface
*oi
;
1409 struct route_node
*node
;
1411 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1412 zlog_debug("Zebra: Interface[%s] state change to down.",
1415 for (node
= route_top(IF_OIFS(ifp
)); node
; node
= route_next(node
)) {
1416 if ((oi
= node
->info
) == NULL
)
1424 static int ospf_ifp_destroy(struct interface
*ifp
)
1427 struct route_node
*rn
;
1429 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
1431 "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
1432 ifp
->name
, ifp
->vrf
->name
, ifp
->vrf
->vrf_id
,
1433 ifp
->ifindex
, (unsigned long long)ifp
->flags
,
1434 ifp
->metric
, ifp
->mtu
);
1436 hook_call(ospf_if_delete
, ifp
);
1438 ospf
= ifp
->vrf
->info
;
1440 if (ospf_if_count_area_params(ifp
) > 0)
1441 ospf_interface_area_unset(ospf
, ifp
);
1444 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
))
1446 ospf_if_free((struct ospf_interface
*)rn
->info
);
1451 /* Resetting ospf hello timer */
1452 void ospf_reset_hello_timer(struct interface
*ifp
, struct in_addr addr
,
1455 struct route_node
*rn
;
1459 struct ospf_interface
*oi
= NULL
;
1463 p
.prefixlen
= IPV4_MAX_BITLEN
;
1465 oi
= ospf_if_table_lookup(ifp
, &p
);
1468 /* Send hello before restart the hello timer
1469 * to avoid session flaps in case of bigger
1470 * hello interval configurations.
1472 ospf_hello_send(oi
);
1474 /* Restart hello timer for this interface */
1475 OSPF_ISM_TIMER_OFF(oi
->t_hello
);
1476 OSPF_HELLO_TIMER_ON(oi
);
1482 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
1483 struct ospf_interface
*oi
= rn
->info
;
1488 /* If hello interval configured on this oi, don't restart. */
1489 if (OSPF_IF_PARAM_CONFIGURED(oi
->params
, v_hello
))
1492 /* Send hello before restart the hello timer
1493 * to avoid session flaps in case of bigger
1494 * hello interval configurations.
1496 ospf_hello_send(oi
);
1498 /* Restart the hello timer. */
1499 OSPF_ISM_TIMER_OFF(oi
->t_hello
);
1500 OSPF_HELLO_TIMER_ON(oi
);
1504 void ospf_if_init(void)
1506 if_zapi_callbacks(ospf_ifp_create
, ospf_ifp_up
,
1507 ospf_ifp_down
, ospf_ifp_destroy
);
1509 /* Initialize Zebra interface data structure. */
1510 hook_register_prio(if_add
, 0, ospf_if_new_hook
);
1511 hook_register_prio(if_del
, 0, ospf_if_delete_hook
);