3 * Copyright (C) 1999, 2000 Alex Zinin, Toshiaki Takada
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
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
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
37 #include "ospfd/ospfd.h"
38 #include "ospfd/ospf_interface.h"
39 #include "ospfd/ospf_ism.h"
40 #include "ospfd/ospf_asbr.h"
41 #include "ospfd/ospf_lsa.h"
42 #include "ospfd/ospf_lsdb.h"
43 #include "ospfd/ospf_neighbor.h"
44 #include "ospfd/ospf_nsm.h"
45 #include "ospfd/ospf_spf.h"
46 #include "ospfd/ospf_route.h"
47 #include "ospfd/ospf_ia.h"
48 #include "ospfd/ospf_flood.h"
49 #include "ospfd/ospf_abr.h"
50 #include "ospfd/ospf_ase.h"
51 #include "ospfd/ospf_zebra.h"
52 #include "ospfd/ospf_dump.h"
55 struct ospf_area_range
*
56 ospf_area_range_new (struct prefix_ipv4
*p
)
58 struct ospf_area_range
*range
;
60 range
= XCALLOC (MTYPE_OSPF_AREA_RANGE
, sizeof (struct ospf_area_range
));
61 range
->addr
= p
->prefix
;
62 range
->masklen
= p
->prefixlen
;
63 range
->cost_config
= OSPF_AREA_RANGE_COST_UNSPEC
;
69 ospf_area_range_free (struct ospf_area_range
*range
)
71 XFREE (MTYPE_OSPF_AREA_RANGE
, range
);
75 ospf_area_range_add (struct ospf_area
*area
, struct ospf_area_range
*range
)
77 struct route_node
*rn
;
81 p
.prefixlen
= range
->masklen
;
82 p
.prefix
= range
->addr
;
84 rn
= route_node_get (area
->ranges
, (struct prefix
*)&p
);
86 route_unlock_node (rn
);
92 ospf_area_range_delete (struct ospf_area
*area
, struct ospf_area_range
*range
)
94 struct route_node
*rn
;
98 p
.prefixlen
= range
->masklen
;
99 p
.prefix
= range
->addr
;
101 rn
= route_node_lookup (area
->ranges
, (struct prefix
*)&p
);
104 ospf_area_range_free (rn
->info
);
106 route_unlock_node (rn
);
107 route_unlock_node (rn
);
111 struct ospf_area_range
*
112 ospf_area_range_lookup (struct ospf_area
*area
, struct prefix_ipv4
*p
)
114 struct route_node
*rn
;
116 rn
= route_node_lookup (area
->ranges
, (struct prefix
*)p
);
119 route_unlock_node (rn
);
125 struct ospf_area_range
*
126 ospf_area_range_lookup_next (struct ospf_area
*area
, struct in_addr
*range_net
,
129 struct route_node
*rn
;
130 struct prefix_ipv4 p
;
131 struct ospf_area_range
*find
;
134 p
.prefixlen
= IPV4_MAX_BITLEN
;
135 p
.prefix
= *range_net
;
138 rn
= route_top (area
->ranges
);
141 rn
= route_node_get (area
->ranges
, (struct prefix
*) &p
);
142 rn
= route_next (rn
);
145 for (; rn
; rn
= route_next (rn
))
152 *range_net
= rn
->p
.u
.prefix4
;
153 route_unlock_node (rn
);
159 struct ospf_area_range
*
160 ospf_area_range_match (struct ospf_area
*area
, struct prefix_ipv4
*p
)
162 struct route_node
*node
;
164 node
= route_node_match (area
->ranges
, (struct prefix
*) p
);
167 route_unlock_node (node
);
173 struct ospf_area_range
*
174 ospf_area_range_match_any (struct ospf
*ospf
, struct prefix_ipv4
*p
)
176 struct ospf_area_range
*range
;
179 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
180 if ((range
= ospf_area_range_match (node
->data
, p
)))
187 ospf_area_range_active (struct ospf_area_range
*range
)
189 return range
->specifics
;
193 ospf_area_actively_attached (struct ospf_area
*area
)
195 return area
->act_ints
;
199 ospf_area_range_set (struct ospf
*ospf
, struct in_addr area_id
,
200 struct prefix_ipv4
*p
, int advertise
)
202 struct ospf_area
*area
;
203 struct ospf_area_range
*range
;
204 int ret
= OSPF_AREA_ID_FORMAT_DECIMAL
;
206 area
= ospf_area_get (area_id
, ret
);
210 range
= ospf_area_range_lookup (area
, p
);
213 if ((CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
)
214 && !CHECK_FLAG (advertise
, OSPF_AREA_RANGE_ADVERTISE
))
215 || (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
)
216 && CHECK_FLAG (advertise
, OSPF_AREA_RANGE_ADVERTISE
)))
217 ospf_schedule_abr_task ();
221 range
= ospf_area_range_new (p
);
222 ospf_area_range_add (area
, range
);
223 ospf_schedule_abr_task ();
226 if (CHECK_FLAG (advertise
, OSPF_AREA_RANGE_ADVERTISE
))
227 SET_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
);
229 UNSET_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
);
235 ospf_area_range_cost_set (struct ospf
*ospf
, struct in_addr area_id
,
236 struct prefix_ipv4
*p
, u_int32_t cost
)
238 struct ospf_area
*area
;
239 struct ospf_area_range
*range
;
240 int ret
= OSPF_AREA_ID_FORMAT_DECIMAL
;
242 area
= ospf_area_get (area_id
, ret
);
246 range
= ospf_area_range_new (p
);
250 if (range
->cost_config
!= cost
)
252 range
->cost_config
= cost
;
253 if (ospf_area_range_active (range
))
254 ospf_schedule_abr_task ();
261 ospf_area_range_unset (struct ospf
*ospf
, struct in_addr area_id
,
262 struct prefix_ipv4
*p
)
264 struct ospf_area
*area
;
265 struct ospf_area_range
*range
;
267 area
= ospf_area_lookup_by_area_id (area_id
);
271 range
= ospf_area_range_lookup (area
, p
);
275 if (ospf_area_range_active (range
))
276 ospf_schedule_abr_task ();
278 ospf_area_range_delete (area
, range
);
284 ospf_area_range_substitute_set (struct ospf
*ospf
, struct in_addr area_id
,
285 struct prefix_ipv4
*p
, struct prefix_ipv4
*s
)
287 struct ospf_area
*area
;
288 struct ospf_area_range
*range
;
289 int ret
= OSPF_AREA_ID_FORMAT_DECIMAL
;
291 area
= ospf_area_get (area_id
, ret
);
292 range
= ospf_area_range_lookup (area
, p
);
296 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
) ||
297 !CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
298 ospf_schedule_abr_task ();
302 range
= ospf_area_range_new (p
);
303 ospf_area_range_add (area
, range
);
304 ospf_schedule_abr_task ();
307 SET_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
);
308 SET_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
);
309 range
->subst_addr
= s
->prefix
;
310 range
->subst_masklen
= s
->prefixlen
;
316 ospf_area_range_substitute_unset (struct ospf
*ospf
, struct in_addr area_id
,
317 struct prefix_ipv4
*p
)
319 struct ospf_area
*area
;
320 struct ospf_area_range
*range
;
322 area
= ospf_area_lookup_by_area_id (area_id
);
326 range
= ospf_area_range_lookup (area
, p
);
330 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
331 if (ospf_area_range_active (range
))
332 ospf_schedule_abr_task ();
334 UNSET_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
);
335 range
->subst_addr
.s_addr
= 0;
336 range
->subst_masklen
= 0;
342 ospf_act_bb_connection ()
344 if (ospf_top
->backbone
== NULL
)
347 return ospf_top
->backbone
->full_nbrs
;
350 /* Check area border router status. */
352 ospf_check_abr_status ()
354 struct ospf_area
*area
;
356 int bb_configured
= 0;
357 int bb_act_attached
= 0;
358 int areas_configured
= 0;
359 int areas_act_attached
= 0;
361 u_char new_flags
= ospf_top
->flags
;
363 if (IS_DEBUG_OSPF_EVENT
)
364 zlog_info ("ospf_check_abr_status(): Start");
366 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
368 area
= getdata (node
);
370 if (listcount (area
->oiflist
))
374 if (OSPF_IS_AREA_BACKBONE (area
))
378 if (ospf_area_actively_attached (area
))
380 areas_act_attached
++;
382 if (OSPF_IS_AREA_BACKBONE (area
))
387 if (IS_DEBUG_OSPF_EVENT
)
389 zlog_info ("ospf_check_abr_status(): looked through areas");
390 zlog_info ("ospf_check_abr_status(): bb_configured: %d", bb_configured
);
391 zlog_info ("ospf_check_abr_status(): bb_act_attached: %d",
393 zlog_info ("ospf_check_abr_status(): areas_configured: %d",
395 zlog_info ("ospf_check_abr_status(): areas_act_attached: %d",
399 switch (ospf_top
->abr_type
)
401 case OSPF_ABR_SHORTCUT
:
403 if (areas_act_attached
> 1)
404 SET_FLAG (new_flags
, OSPF_FLAG_ABR
);
406 UNSET_FLAG (new_flags
, OSPF_FLAG_ABR
);
410 if ((areas_act_attached
> 1) && bb_configured
)
411 SET_FLAG (new_flags
, OSPF_FLAG_ABR
);
413 UNSET_FLAG (new_flags
, OSPF_FLAG_ABR
);
417 if ((areas_configured
> 1) && bb_act_attached
)
418 SET_FLAG (new_flags
, OSPF_FLAG_ABR
);
420 UNSET_FLAG (new_flags
, OSPF_FLAG_ABR
);
426 if (new_flags
!= ospf_top
->flags
)
428 ospf_spf_calculate_schedule ();
429 if (IS_DEBUG_OSPF_EVENT
)
430 zlog_info ("ospf_check_abr_status(): new router flags: %x",new_flags
);
431 ospf_top
->flags
= new_flags
;
432 OSPF_TIMER_ON (ospf_top
->t_router_lsa_update
,
433 ospf_router_lsa_update_timer
, OSPF_LSA_UPDATE_DELAY
);
438 ospf_abr_update_aggregate (struct ospf_area_range
*range
,
439 struct ospf_route
*or)
441 if (IS_DEBUG_OSPF_EVENT
)
442 zlog_info ("ospf_abr_update_aggregate(): Start");
444 if (range
->cost_config
!= -1)
446 if (IS_DEBUG_OSPF_EVENT
)
447 zlog_info ("ospf_abr_update_aggregate(): use configured cost %d",
450 range
->cost
= range
->cost_config
;
454 if (range
->specifics
== 0)
455 range
->cost
= or->cost
; /* 1st time get 1st cost */
457 if (or->cost
< range
->cost
)
459 if (IS_DEBUG_OSPF_EVENT
)
460 zlog_info ("ospf_abr_update_aggregate(): lowest cost, update");
462 range
->cost
= or->cost
;
470 set_metric (struct ospf_lsa
*lsa
, u_int32_t metric
)
472 struct summary_lsa
*header
;
474 metric
= htonl (metric
);
475 mp
= (char *) &metric
;
477 header
= (struct summary_lsa
*) lsa
->data
;
478 memcpy(header
->metric
, mp
, 3);
483 ospf_abr_check_nssa_range (struct prefix_ipv4
*p
, u_int32_t cost
,
484 struct ospf_area
*area
)
486 /* The Type-7 is tested against the aggregated prefix and forwarded
487 for lsa installation and flooding */
491 /* ospf_abr_translate_nssa */
493 ospf_abr_translate_nssa (struct ospf_lsa
*lsa
, void *p_arg
, int int_arg
)
495 /* Incoming Type-7 or later aggregated Type-7
497 LSA is skipped if P-bit is off.
498 LSA is aggregated if within range.
500 The Type-7 is translated, Installed/Approved as a Type-5 into
501 global LSDB, then Flooded through AS
503 Later, any Unapproved Translated Type-5's are flushed/discarded */
505 struct ospf_lsa
*dup
;
507 if (! CHECK_FLAG (lsa
->data
->options
, OSPF_OPTION_NP
))
509 if (IS_DEBUG_OSPF_NSSA
)
510 zlog_info ("ospf_abr_nssa(): P-bit off, NO Translation");
514 if (IS_DEBUG_OSPF_NSSA
)
515 zlog_info ("ospf_abr_nssa(): TRANSLATING 7 to 5");
518 /* UNSET_FLAG (lsa->data->options, OSPF_OPTION_NP); */
520 /* Area where Aggregate testing will be inserted, just like summary
522 /* ospf_abr_check_nssa_range (p_arg, lsa-> cost, lsa -> area); */
524 /* Follow thru here means no aggregation */
525 dup
= ospf_lsa_dup (lsa
); /* keep LSDB intact, lock = 1 */
527 SET_FLAG (dup
->flags
, OSPF_LSA_LOCAL_XLT
); /* Translated from 7 */
528 SET_FLAG (dup
->flags
, OSPF_LSA_APPROVED
); /* So, do not remove it */
530 dup
->data
->type
= OSPF_AS_EXTERNAL_LSA
; /* make Type-5 */
532 ospf_lsa_checksum (dup
->data
);
534 ospf_lsa_install (NULL
, dup
); /* Install this Type-5 into LSDB, Lock = 2. */
536 ospf_flood_through_as (NULL
, dup
); /* flood non-NSSA/STUB areas */
538 /* This translated Type-5 will go to all non-NSSA areas connected to
539 this ABR; The Type-5 could come from any of the NSSA's connected
546 ospf_abr_translate_nssa_range (struct prefix_ipv4
*p
, u_int32_t cost
)
548 /* The Type-7 is created from the aggregated prefix and forwarded
549 for lsa installation and flooding... to be added... */
551 #endif /* HAVE_NSSA */
554 ospf_abr_announce_network_to_area (struct prefix_ipv4
*p
, u_int32_t cost
,
555 struct ospf_area
*area
)
557 struct ospf_lsa
*lsa
, *old
= NULL
;
558 struct summary_lsa
*sl
= NULL
;
560 if (IS_DEBUG_OSPF_EVENT
)
561 zlog_info ("ospf_abr_announce_network_to_area(): Start");
563 old
= OSPF_SUMMARY_LSA_SELF_FIND_BY_PREFIX (area
, p
);
567 if (IS_DEBUG_OSPF_EVENT
)
568 zlog_info ("ospf_abr_announce_network_to_area(): old summary found");
569 sl
= (struct summary_lsa
*) old
->data
;
571 if (IS_DEBUG_OSPF_EVENT
)
572 zlog_info ("ospf_abr_announce_network_to_area(): "
573 "old metric: %d, new metric: %d",
574 GET_METRIC (sl
->metric
), cost
);
577 if (old
&& (GET_METRIC (sl
->metric
) == cost
))
579 if (IS_DEBUG_OSPF_EVENT
)
580 zlog_info ("ospf_abr_announce_network_to_area(): "
581 "old summary approved");
582 SET_FLAG (old
->flags
, OSPF_LSA_APPROVED
);
586 if (IS_DEBUG_OSPF_EVENT
)
587 zlog_info ("ospf_abr_announce_network_to_area(): "
588 "creating new summary");
592 set_metric (old
, cost
);
593 lsa
= ospf_summary_lsa_refresh (old
);
594 /* This will flood through area. */
598 lsa
= ospf_summary_lsa_originate (p
, cost
, area
);
599 /* This will flood through area. */
603 SET_FLAG (lsa
->flags
, OSPF_LSA_APPROVED
);
604 if (IS_DEBUG_OSPF_EVENT
)
605 zlog_info ("ospf_abr_announce_network_to_area(): "
606 "flooding new version of summary");
609 ospf_flood_through_area (area
, NULL
, lsa
);
610 #endif /* ! HAVE_NSSA */
613 if (IS_DEBUG_OSPF_EVENT
)
614 zlog_info ("ospf_abr_announce_network_to_area(): Stop");
618 ospf_abr_nexthops_belong_to_area (struct ospf_route
*or,
619 struct ospf_area
*area
)
623 for (node
= listhead (or->path
); node
; nextnode (node
))
625 struct ospf_path
*path
= node
->data
;
626 struct ospf_interface
*oi
= path
->oi
;
629 if (oi
->area
== area
)
637 ospf_abr_should_accept (struct prefix
*p
, struct ospf_area
*area
)
639 if (IMPORT_NAME (area
))
641 if (IMPORT_LIST (area
) == NULL
)
642 IMPORT_LIST (area
) = access_list_lookup (AFI_IP
, IMPORT_NAME (area
));
644 if (IMPORT_LIST (area
))
645 if (access_list_apply (IMPORT_LIST (area
), p
) == FILTER_DENY
)
653 ospf_abr_plist_in_check (struct ospf_area
*area
, struct ospf_route
*or,
656 if (PREFIX_NAME_IN (area
))
658 if (PREFIX_LIST_IN (area
) == NULL
)
659 PREFIX_LIST_IN (area
) = prefix_list_lookup (AFI_IP
,
660 PREFIX_NAME_IN (area
));
661 if (PREFIX_LIST_IN (area
))
662 if (prefix_list_apply (PREFIX_LIST_IN (area
), p
) != PREFIX_PERMIT
)
669 ospf_abr_plist_out_check (struct ospf_area
*area
, struct ospf_route
*or,
672 if (PREFIX_NAME_OUT (area
))
674 if (PREFIX_LIST_OUT (area
) == NULL
)
675 PREFIX_LIST_OUT (area
) = prefix_list_lookup (AFI_IP
,
676 PREFIX_NAME_OUT (area
));
677 if (PREFIX_LIST_OUT (area
))
678 if (prefix_list_apply (PREFIX_LIST_OUT (area
), p
) != PREFIX_PERMIT
)
685 ospf_abr_announce_network (struct route_node
*n
, struct ospf_route
*or)
688 struct ospf_area_range
*range
;
689 struct prefix_ipv4
*p
;
690 struct ospf_area
*area
, *or_area
;
692 if (IS_DEBUG_OSPF_EVENT
)
693 zlog_info ("ospf_abr_announce_network(): Start");
694 p
= (struct prefix_ipv4
*) &n
->p
;
696 or_area
= ospf_area_lookup_by_area_id (or->u
.std
.area_id
);
699 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
701 area
= getdata (node
);
703 if (IS_DEBUG_OSPF_EVENT
)
704 zlog_info ("ospf_abr_announce_network(): looking at area %s",
705 inet_ntoa (area
->area_id
));
707 if (IPV4_ADDR_SAME (&or->u
.std
.area_id
, &area
->area_id
))
710 if (ospf_abr_nexthops_belong_to_area (or, area
))
713 if (!ospf_abr_should_accept (&n
->p
, area
))
715 if (IS_DEBUG_OSPF_EVENT
)
716 zlog_info ("ospf_abr_announce_network(): "
717 "prefix %s/%d was denied by import-list",
718 inet_ntoa (p
->prefix
), p
->prefixlen
);
722 if (!ospf_abr_plist_in_check (area
, or, &n
->p
))
724 if (IS_DEBUG_OSPF_EVENT
)
725 zlog_info ("ospf_abr_announce_network(): "
726 "prefix %s/%d was denied by prefix-list",
727 inet_ntoa (p
->prefix
), p
->prefixlen
);
731 if (area
->external_routing
!= OSPF_AREA_DEFAULT
&& area
->no_summary
)
733 if (IS_DEBUG_OSPF_EVENT
)
734 zlog_info ("ospf_abr_announce_network(): "
735 "area %s is stub and no_summary",
736 inet_ntoa (area
->area_id
));
740 if (or->path_type
== OSPF_PATH_INTER_AREA
)
742 if (IS_DEBUG_OSPF_EVENT
)
743 zlog_info ("ospf_abr_announce_network(): this is "
744 "inter-area route to %s/%d",
745 inet_ntoa (p
->prefix
), p
->prefixlen
);
747 if (!OSPF_IS_AREA_BACKBONE (area
))
748 ospf_abr_announce_network_to_area (p
, or->cost
, area
);
751 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
753 if (IS_DEBUG_OSPF_EVENT
)
754 zlog_info ("ospf_abr_announce_network(): "
755 "this is intra-area route to %s/%d",
756 inet_ntoa (p
->prefix
), p
->prefixlen
);
757 if ((range
= ospf_area_range_match (or_area
, p
)) &&
758 !ospf_area_is_transit (area
))
759 ospf_abr_update_aggregate (range
, or);
761 ospf_abr_announce_network_to_area (p
, or->cost
, area
);
767 ospf_abr_should_announce (struct prefix
*p
, struct ospf_route
*or)
769 struct ospf_area
*area
= ospf_area_lookup_by_area_id (or->u
.std
.area_id
);
773 if (EXPORT_NAME (area
))
775 if (EXPORT_LIST (area
) == NULL
)
776 EXPORT_LIST (area
) = access_list_lookup (AFI_IP
, EXPORT_NAME (area
));
778 if (EXPORT_LIST (area
))
779 if (access_list_apply (EXPORT_LIST (area
), p
) == FILTER_DENY
)
788 ospf_abr_process_nssa_translates ()
790 /* Scan through all NSSA_LSDB records for all areas;
792 If P-bit is on, translate all Type-7's to 5's and aggregate or
793 flood install as approved in Type-5 LSDB with XLATE Flag on
794 later, do same for all aggregates... At end, DISCARD all
795 remaining UNAPPROVED Type-5's (Aggregate is for future ) */
797 struct ospf_area
*area
;
799 if (IS_DEBUG_OSPF_NSSA
)
800 zlog_info ("ospf_abr_process_nssa_translates(): Start");
802 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
804 area
= getdata (node
);
806 if (! area
->NSSATranslator
)
807 continue; /* skip if not translator */
809 if (area
->external_routing
!= OSPF_AREA_NSSA
)
810 continue; /* skip if not Nssa Area */
812 if (IS_DEBUG_OSPF_NSSA
)
813 zlog_info ("ospf_abr_process_nssa_translates(): "
814 "looking at area %s", inet_ntoa (area
->area_id
));
816 foreach_lsa (NSSA_LSDB (area
), area
, 0, ospf_abr_translate_nssa
);
819 if (IS_DEBUG_OSPF_NSSA
)
820 zlog_info ("ospf_abr_process_nssa_translates(): Stop");
823 #endif /* HAVE_NSSA */
826 ospf_abr_process_network_rt (struct route_table
*rt
)
828 struct route_node
*rn
;
829 struct ospf_route
*or;
830 struct ospf_area
*area
;
832 if (IS_DEBUG_OSPF_EVENT
)
833 zlog_info ("ospf_abr_process_network_rt(): Start");
835 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
837 if ((or = rn
->info
) == NULL
)
840 if (!(area
= ospf_area_lookup_by_area_id (or->u
.std
.area_id
)))
842 if (IS_DEBUG_OSPF_EVENT
)
843 zlog_info ("ospf_abr_process_network_rt(): area %s no longer exists",
844 inet_ntoa (or->u
.std
.area_id
));
848 if (IS_DEBUG_OSPF_EVENT
)
849 zlog_info ("ospf_abr_process_network_rt(): this is a route to %s/%d",
850 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
851 if (or->path_type
>= OSPF_PATH_TYPE1_EXTERNAL
)
853 if (IS_DEBUG_OSPF_EVENT
)
854 zlog_info ("ospf_abr_process_network_rt(): "
855 "this is an External router, skipping");
859 if (or->cost
>= OSPF_LS_INFINITY
)
861 if (IS_DEBUG_OSPF_EVENT
)
862 zlog_info ("ospf_abr_process_network_rt():"
863 " this route's cost is infinity, skipping");
867 if (or->type
== OSPF_DESTINATION_DISCARD
)
869 if (IS_DEBUG_OSPF_EVENT
)
870 zlog_info ("ospf_abr_process_network_rt():"
871 " this is a discard entry, skipping");
875 if (or->path_type
== OSPF_PATH_INTRA_AREA
&&
876 !ospf_abr_should_announce (&rn
->p
, or))
878 if (IS_DEBUG_OSPF_EVENT
)
879 zlog_info("ospf_abr_process_network_rt(): denied by export-list");
883 if (or->path_type
== OSPF_PATH_INTRA_AREA
&&
884 !ospf_abr_plist_out_check (area
, or, &rn
->p
))
886 if (IS_DEBUG_OSPF_EVENT
)
887 zlog_info("ospf_abr_process_network_rt(): denied by prefix-list");
891 if ((or->path_type
== OSPF_PATH_INTER_AREA
) &&
892 !OSPF_IS_AREA_ID_BACKBONE (or->u
.std
.area_id
))
894 if (IS_DEBUG_OSPF_EVENT
)
895 zlog_info ("ospf_abr_process_network_rt():"
896 " this is route is not backbone one, skipping");
901 if ((ospf_top
->abr_type
== OSPF_ABR_CISCO
) ||
902 (ospf_top
->abr_type
== OSPF_ABR_IBM
))
904 if (!ospf_act_bb_connection () &&
905 or->path_type
!= OSPF_PATH_INTRA_AREA
)
907 if (IS_DEBUG_OSPF_EVENT
)
908 zlog_info ("ospf_abr_process_network_rt(): ALT ABR: "
909 "No BB connection, skip not intra-area routes");
913 if (IS_DEBUG_OSPF_EVENT
)
914 zlog_info ("ospf_abr_process_network_rt(): announcing");
915 ospf_abr_announce_network (rn
, or);
918 if (IS_DEBUG_OSPF_EVENT
)
919 zlog_info ("ospf_abr_process_network_rt(): Stop");
923 ospf_abr_announce_rtr_to_area (struct prefix_ipv4
*p
, u_int32_t cost
,
924 struct ospf_area
*area
)
926 struct ospf_lsa
*lsa
, *old
= NULL
;
927 struct summary_lsa
*slsa
= NULL
;
929 if (IS_DEBUG_OSPF_EVENT
)
930 zlog_info ("ospf_abr_announce_rtr_to_area(): Start");
932 old
= OSPF_SUMMARY_ASBR_LSA_SELF_FIND_BY_PREFIX (area
, p
);
933 /* old = ospf_find_self_summary_asbr_lsa_by_prefix (area, p); */
937 if (IS_DEBUG_OSPF_EVENT
)
938 zlog_info ("ospf_abr_announce_rtr_to_area(): old summary found");
939 slsa
= (struct summary_lsa
*) old
->data
;
941 if (IS_DEBUG_OSPF_EVENT
)
942 zlog_info ("ospf_abr_announce_network_to_area(): "
943 "old metric: %d, new metric: %d",
944 GET_METRIC (slsa
->metric
), cost
);
947 if (old
&& (GET_METRIC (slsa
->metric
) == cost
))
949 if (IS_DEBUG_OSPF_EVENT
)
950 zlog_info ("ospf_abr_announce_rtr_to_area(): old summary approved");
951 SET_FLAG (old
->flags
, OSPF_LSA_APPROVED
);
955 if (IS_DEBUG_OSPF_EVENT
)
956 zlog_info ("ospf_abr_announce_rtr_to_area(): 2.2");
960 set_metric (old
, cost
);
961 lsa
= ospf_summary_asbr_lsa_refresh (old
);
964 lsa
= ospf_summary_asbr_lsa_originate (p
, cost
, area
);
966 if (IS_DEBUG_OSPF_EVENT
)
967 zlog_info ("ospf_abr_announce_rtr_to_area(): "
968 "flooding new version of summary");
970 zlog_info ("ospf_abr_announce_rtr_to_area(): creating new summary");
971 lsa = ospf_summary_asbr_lsa (p, cost, area, old); */
973 SET_FLAG (lsa
->flags
, OSPF_LSA_APPROVED
);
974 /* ospf_flood_through_area (area, NULL, lsa);*/
977 if (IS_DEBUG_OSPF_EVENT
)
978 zlog_info ("ospf_abr_announce_rtr_to_area(): Stop");
983 ospf_abr_announce_rtr (struct prefix_ipv4
*p
, struct ospf_route
*or)
986 struct ospf_area
*area
;
988 if (IS_DEBUG_OSPF_EVENT
)
989 zlog_info ("ospf_abr_announce_rtr(): Start");
991 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
993 area
= getdata (node
);
995 if (IS_DEBUG_OSPF_EVENT
)
996 zlog_info ("ospf_abr_announce_rtr(): looking at area %s",
997 inet_ntoa (area
->area_id
));
999 if (IPV4_ADDR_SAME (&or->u
.std
.area_id
, &area
->area_id
))
1002 if (ospf_abr_nexthops_belong_to_area (or, area
))
1005 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
1007 if (IS_DEBUG_OSPF_EVENT
)
1008 zlog_info ("ospf_abr_announce_network(): "
1009 "area %s doesn't support external routing",
1010 inet_ntoa(area
->area_id
));
1014 if (or->path_type
== OSPF_PATH_INTER_AREA
)
1016 if (IS_DEBUG_OSPF_EVENT
)
1017 zlog_info ("ospf_abr_announce_rtr(): "
1018 "this is inter-area route to %s", inet_ntoa (p
->prefix
));
1019 if (!OSPF_IS_AREA_BACKBONE (area
))
1020 ospf_abr_announce_rtr_to_area (p
, or->cost
, area
);
1023 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
1025 if (IS_DEBUG_OSPF_EVENT
)
1026 zlog_info ("ospf_abr_announce_rtr(): "
1027 "this is intra-area route to %s", inet_ntoa (p
->prefix
));
1028 ospf_abr_announce_rtr_to_area (p
, or->cost
, area
);
1032 if (IS_DEBUG_OSPF_EVENT
)
1033 zlog_info ("ospf_abr_announce_rtr(): Stop");
1037 ospf_abr_process_router_rt (struct route_table
*rt
)
1039 struct route_node
*rn
;
1040 struct ospf_route
*or;
1043 if (IS_DEBUG_OSPF_EVENT
)
1044 zlog_info ("ospf_abr_process_router_rt(): Start");
1046 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
1050 struct ospf_route
*best
= NULL
;
1052 if (rn
->info
== NULL
)
1057 if (IS_DEBUG_OSPF_EVENT
)
1058 zlog_info ("ospf_abr_process_router_rt(): this is a route to %s",
1059 inet_ntoa (rn
->p
.u
.prefix4
));
1061 for (node
= listhead (l
); node
; nextnode (node
))
1063 or = getdata (node
);
1067 if (!ospf_area_lookup_by_area_id (or->u
.std
.area_id
))
1069 if (IS_DEBUG_OSPF_EVENT
)
1070 zlog_info ("ospf_abr_process_router_rt(): area %s no longer exists",
1071 inet_ntoa (or->u
.std
.area_id
));
1076 if (!CHECK_FLAG (or->u
.std
.flags
, ROUTER_LSA_EXTERNAL
))
1078 if (IS_DEBUG_OSPF_EVENT
)
1079 zlog_info ("ospf_abr_process_router_rt(): "
1080 "This is not an ASBR, skipping");
1086 best
= ospf_find_asbr_route (rt
, (struct prefix_ipv4
*) &rn
->p
);
1095 if (IS_DEBUG_OSPF_EVENT
)
1096 zlog_info ("ospf_abr_process_router_rt(): "
1097 "This route is not the best among possible, skipping");
1101 if (or->path_type
== OSPF_PATH_INTER_AREA
&&
1102 !OSPF_IS_AREA_ID_BACKBONE (or->u
.std
.area_id
))
1104 if (IS_DEBUG_OSPF_EVENT
)
1105 zlog_info ("ospf_abr_process_router_rt(): "
1106 "This route is not a backbone one, skipping");
1110 if (or->cost
>= OSPF_LS_INFINITY
)
1112 if (IS_DEBUG_OSPF_EVENT
)
1113 zlog_info ("ospf_abr_process_router_rt(): "
1114 "This route has LS_INFINITY metric, skipping");
1118 if (ospf_top
->abr_type
== OSPF_ABR_CISCO
||
1119 ospf_top
->abr_type
== OSPF_ABR_IBM
)
1120 if (!ospf_act_bb_connection () &&
1121 or->path_type
!= OSPF_PATH_INTRA_AREA
)
1123 if (IS_DEBUG_OSPF_EVENT
)
1124 zlog_info("ospf_abr_process_network_rt(): ALT ABR: "
1125 "No BB connection, skip not intra-area routes");
1129 ospf_abr_announce_rtr ((struct prefix_ipv4
*) &rn
->p
, or);
1135 if (IS_DEBUG_OSPF_EVENT
)
1136 zlog_info ("ospf_abr_process_router_rt(): Stop");
1141 ospf_abr_unapprove_translates_apply (struct ospf_lsa
*lsa
, void *p_arg
,
1144 /* Could be a mix of Normal Type-5's, self-originated, or Type-7s
1145 that are Locally ABR Translated */
1147 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
1148 UNSET_FLAG (lsa
->flags
, OSPF_LSA_APPROVED
);
1154 ospf_abr_unapprove_translates () /* For NSSA Translations */
1156 if (IS_DEBUG_OSPF_NSSA
)
1157 zlog_info ("ospf_abr_unapprove_translates(): Start");
1159 /* NSSA Translator is not checked, because it may have gone away,
1160 and we would want to flush any residuals anyway */
1162 foreach_lsa (EXTERNAL_LSDB (ospf_top
), NULL
, 0,
1163 ospf_abr_unapprove_translates_apply
);
1165 if (IS_DEBUG_OSPF_NSSA
)
1166 zlog_info ("ospf_abr_unapprove_translates(): Stop");
1168 #endif /* HAVE_NSSA */
1171 ospf_abr_unapprove_summaries_apply (struct ospf_lsa
*lsa
, void *p_arg
,
1174 if (ospf_lsa_is_self_originated (lsa
))
1175 UNSET_FLAG (lsa
->flags
, OSPF_LSA_APPROVED
);
1181 ospf_abr_unapprove_summaries ()
1184 struct ospf_area
*area
;
1186 if (IS_DEBUG_OSPF_EVENT
)
1187 zlog_info ("ospf_abr_unapprove_summaries(): Start");
1189 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1191 area
= getdata (node
);
1192 foreach_lsa (SUMMARY_LSDB (area
), NULL
, 0,
1193 ospf_abr_unapprove_summaries_apply
);
1194 foreach_lsa (ASBR_SUMMARY_LSDB (area
), NULL
, 0,
1195 ospf_abr_unapprove_summaries_apply
);
1198 if (IS_DEBUG_OSPF_EVENT
)
1199 zlog_info ("ospf_abr_unapprove_summaries(): Stop");
1203 ospf_abr_prepare_aggregates ()
1206 struct route_node
*rn
;
1207 struct ospf_area_range
*range
;
1209 if (IS_DEBUG_OSPF_EVENT
)
1210 zlog_info ("ospf_abr_prepare_aggregates(): Start");
1212 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1214 struct ospf_area
*area
= getdata (node
);
1216 for (rn
= route_top (area
->ranges
); rn
; rn
= route_next (rn
))
1217 if ((range
= rn
->info
) != NULL
)
1220 range
->specifics
= 0;
1224 if (IS_DEBUG_OSPF_EVENT
)
1225 zlog_info ("ospf_abr_prepare_aggregates(): Stop");
1229 ospf_abr_announce_aggregates ()
1231 struct ospf_area
*area
, *ar
;
1232 struct ospf_area_range
*range
;
1233 struct route_node
*rn
;
1234 struct prefix_ipv4 p
;
1237 if (IS_DEBUG_OSPF_EVENT
)
1238 zlog_info ("ospf_abr_announce_aggregates(): Start");
1240 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1242 area
= getdata (node
);
1244 if (IS_DEBUG_OSPF_EVENT
)
1245 zlog_info ("ospf_abr_announce_aggregates(): looking at area %s",
1246 inet_ntoa (area
->area_id
));
1248 for (rn
= route_top (area
->ranges
); rn
; rn
= route_next (rn
))
1249 if ((range
= rn
->info
))
1251 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
1253 if (IS_DEBUG_OSPF_EVENT
)
1254 zlog_info ("ospf_abr_announce_aggregates():"
1255 " discarding suppress-ranges");
1260 p
.prefix
= range
->addr
;
1261 p
.prefixlen
= range
->masklen
;
1263 if (IS_DEBUG_OSPF_EVENT
)
1264 zlog_info ("ospf_abr_announce_aggregates():"
1265 " this is range: %s/%d",
1266 inet_ntoa (p
.prefix
), p
.prefixlen
);
1268 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
1271 p
.prefix
= range
->subst_addr
;
1272 p
.prefixlen
= range
->subst_masklen
;
1275 if (range
->specifics
)
1277 if (IS_DEBUG_OSPF_EVENT
)
1278 zlog_info ("ospf_abr_announce_aggregates(): active range");
1280 for (n
= listhead (ospf_top
->areas
); n
; nextnode (n
))
1286 /* We do not check nexthops here, because
1287 intra-area routes can be associated with
1290 /* backbone routes are not summarized
1291 when announced into transit areas */
1293 if (ospf_area_is_transit (ar
) &&
1294 OSPF_IS_AREA_BACKBONE (area
))
1296 if (IS_DEBUG_OSPF_EVENT
)
1297 zlog_info ("ospf_abr_announce_aggregates(): Skipping "
1298 "announcement of BB aggregate into"
1302 ospf_abr_announce_network_to_area (&p
, range
->cost
, ar
);
1308 if (IS_DEBUG_OSPF_EVENT
)
1309 zlog_info ("ospf_abr_announce_aggregates(): Stop");
1314 ospf_abr_send_nssa_aggregates () /* temporarily turned off */
1316 listnode node
; /*, n; */
1317 struct ospf_area
*area
; /*, *ar; */
1318 struct route_node
*rn
;
1319 struct ospf_area_range
*range
;
1320 struct prefix_ipv4 p
;
1322 if (IS_DEBUG_OSPF_NSSA
)
1323 zlog_info ("ospf_abr_send_nssa_aggregates(): Start");
1325 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1327 area
= getdata (node
);
1329 if (! area
->NSSATranslator
)
1332 if (IS_DEBUG_OSPF_NSSA
)
1333 zlog_info ("ospf_abr_send_nssa_aggregates(): looking at area %s",
1334 inet_ntoa (area
->area_id
));
1336 for (rn
= route_top (area
->ranges
); rn
; rn
= route_next (rn
))
1338 if (rn
->info
== NULL
)
1343 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
1345 if (IS_DEBUG_OSPF_NSSA
)
1346 zlog_info ("ospf_abr_send_nssa_aggregates():"
1347 " discarding suppress-ranges");
1352 p
.prefix
= range
->addr
;
1353 p
.prefixlen
= range
->masklen
;
1355 if (IS_DEBUG_OSPF_NSSA
)
1356 zlog_info ("ospf_abr_send_nssa_aggregates():"
1357 " this is range: %s/%d",
1358 inet_ntoa (p
.prefix
), p
.prefixlen
);
1360 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
1363 p
.prefix
= range
->subst_addr
;
1364 p
.prefixlen
= range
->subst_masklen
;
1367 if (range
->specifics
)
1369 if (IS_DEBUG_OSPF_NSSA
)
1370 zlog_info ("ospf_abr_send_nssa_aggregates(): active range");
1372 /* Fetch LSA-Type-7 from aggregate prefix, and then
1373 translate, Install (as Type-5), Approve, and Flood */
1374 ospf_abr_translate_nssa_range (&p
, range
->cost
);
1375 } /* if (range->specifics)*/
1376 } /* all area ranges*/
1379 if (IS_DEBUG_OSPF_NSSA
)
1380 zlog_info ("ospf_abr_send_nssa_aggregates(): Stop");
1384 ospf_abr_announce_nssa_defaults () /* By ABR-Translator */
1387 struct ospf_area
*area
;
1388 struct prefix_ipv4 p
;
1393 if (IS_DEBUG_OSPF_NSSA
)
1394 zlog_info ("ospf_abr_announce_stub_defaults(): Start");
1397 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1400 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1402 area
= getdata (node
);
1403 if (IS_DEBUG_OSPF_NSSA
)
1404 zlog_info ("ospf_abr_announce_nssa_defaults(): looking at area %s",
1405 inet_ntoa (area
->area_id
));
1407 if (area
->external_routing
!= OSPF_AREA_NSSA
)
1410 if (OSPF_IS_AREA_BACKBONE (area
))
1411 continue; /* Sanity Check */
1413 /* if (!TranslatorRole continue V 1.0 look for "always" conf */
1414 if (area
->NSSATranslator
)
1416 if (IS_DEBUG_OSPF_NSSA
)
1417 zlog_info ("ospf_abr_announce_nssa_defaults(): "
1418 "announcing 0.0.0.0/0 to this nssa");
1419 /* ospf_abr_announce_nssa_asbr_to_as (&p, area->default_cost, area); */
1423 #endif /* HAVE_NSSA */
1426 ospf_abr_announce_stub_defaults ()
1429 struct ospf_area
*area
;
1430 struct prefix_ipv4 p
;
1435 if (IS_DEBUG_OSPF_EVENT
)
1436 zlog_info ("ospf_abr_announce_stub_defaults(): Start");
1439 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1442 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1444 area
= getdata (node
);
1445 if (IS_DEBUG_OSPF_EVENT
)
1446 zlog_info ("ospf_abr_announce_stub_defaults(): looking at area %s",
1447 inet_ntoa (area
->area_id
));
1450 if (area
->external_routing
!= OSPF_AREA_STUB
)
1451 #else /* ! HAVE_NSSA */
1452 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1453 #endif /* HAVE_NSSA */
1456 if (OSPF_IS_AREA_BACKBONE (area
))
1457 continue; /* Sanity Check */
1459 if (IS_DEBUG_OSPF_EVENT
)
1460 zlog_info ("ospf_abr_announce_stub_defaults(): "
1461 "announcing 0.0.0.0/0 to this area");
1462 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1465 if (IS_DEBUG_OSPF_EVENT
)
1466 zlog_info ("ospf_abr_announce_stub_defaults(): Stop");
1471 ospf_abr_remove_unapproved_translates_apply (struct ospf_lsa
*lsa
, void *p_arg
,
1474 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
)
1475 && ! CHECK_FLAG (lsa
->flags
, OSPF_LSA_APPROVED
))
1477 zlog_info ("ospf_abr_remove_unapproved_translates(): "
1478 "removing unapproved translates, ID: %s",
1479 inet_ntoa (lsa
->data
->id
));
1481 /* FLUSH THROUGHOUT AS */
1482 ospf_lsa_flush_as (lsa
);
1484 /* DISCARD from LSDB */
1490 ospf_abr_remove_unapproved_translates () /* For NSSA Translations */
1492 /* All AREA PROCESS should have APPROVED necessary LSAs */
1493 /* Remove any left over and not APPROVED */
1494 if (IS_DEBUG_OSPF_NSSA
)
1495 zlog_info ("ospf_abr_remove_unapproved_translates(): Start");
1497 foreach_lsa (EXTERNAL_LSDB (ospf_top
), NULL
, 0,
1498 ospf_abr_remove_unapproved_translates_apply
);
1500 if (IS_DEBUG_OSPF_NSSA
)
1501 zlog_info ("ospf_abr_remove_unapproved_translates(): Stop");
1503 #endif /* HAVE_NSSA */
1506 ospf_abr_remove_unapproved_summaries_apply (struct ospf_lsa
*lsa
, void *p_arg
,
1509 struct ospf_area
*area
;
1511 area
= (struct ospf_area
*) p_arg
;
1513 if (ospf_lsa_is_self_originated (lsa
) &&
1514 !CHECK_FLAG (lsa
->flags
, OSPF_LSA_APPROVED
))
1516 if (IS_DEBUG_OSPF_EVENT
)
1517 zlog_info ("ospf_abr_remove_unapproved_summaries(): "
1518 "removing unapproved summary, ID: %s",
1519 inet_ntoa (lsa
->data
->id
));
1520 ospf_lsa_flush_area (lsa
, area
);
1526 ospf_abr_remove_unapproved_summaries ()
1529 struct ospf_area
*area
;
1531 if (IS_DEBUG_OSPF_EVENT
)
1532 zlog_info ("ospf_abr_remove_unapproved_summaries(): Start");
1534 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1536 area
= getdata (node
);
1538 if (IS_DEBUG_OSPF_EVENT
)
1539 zlog_info ("ospf_abr_remove_unapproved_summaries(): "
1540 "looking at area %s", inet_ntoa (area
->area_id
));
1542 foreach_lsa (SUMMARY_LSDB (area
), area
, 0,
1543 ospf_abr_remove_unapproved_summaries_apply
);
1544 foreach_lsa (ASBR_SUMMARY_LSDB (area
), area
, 0,
1545 ospf_abr_remove_unapproved_summaries_apply
);
1548 if (IS_DEBUG_OSPF_EVENT
)
1549 zlog_info ("ospf_abr_remove_unapproved_summaries(): Stop");
1553 ospf_abr_manage_discard_routes ()
1556 struct route_node
*rn
;
1557 struct ospf_area
*area
;
1558 struct ospf_area_range
*range
;
1560 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
1561 if ((area
= node
->data
) != NULL
)
1562 for (rn
= route_top (area
->ranges
); rn
; rn
= route_next (rn
))
1563 if ((range
= rn
->info
) != NULL
)
1564 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
1566 if (range
->specifics
)
1567 ospf_add_discard_route (ospf_top
->new_table
, area
,
1568 (struct prefix_ipv4
*) &rn
->p
);
1570 ospf_delete_discard_route ((struct prefix_ipv4
*) &rn
->p
);
1575 /* This is the function taking care about ABR NSSA, i.e. NSSA
1576 Translator, -LSA aggregation and flooding. For all NSSAs
1578 Any SELF-AS-LSA is in the Type-5 LSDB and Type-7 LSDB. These LSA's
1579 are refreshed from the Type-5 LSDB, installed into the Type-7 LSDB
1582 Any received Type-5s are legal for an ABR, else illegal for IR.
1583 Received Type-7s are installed, by area, with incoming P-bit. They
1584 are flooded; if the Elected NSSA Translator, then P-bit off.
1586 Additionally, this ABR will place "translated type-7's" into the
1587 Type-5 LSDB in order to keep track of APPROVAL or not.
1589 It will scan through every area, looking for Type-7 LSAs with P-Bit
1590 SET. The Type-7's are either AS-FLOODED & 5-INSTALLED or
1591 AGGREGATED. Later, the AGGREGATED LSAs are AS-FLOODED &
1594 5-INSTALLED is into the Type-5 LSDB; Any UNAPPROVED Type-5 LSAs
1595 left over are FLUSHED and DISCARDED.
1597 For External Calculations, any NSSA areas use the Type-7 AREA-LSDB,
1598 any ABR-non-NSSA areas use the Type-5 GLOBAL-LSDB. */
1601 ospf_abr_nssa_task () /* called only if any_nssa */
1603 if (IS_DEBUG_OSPF_NSSA
)
1604 zlog_info ("Check for NSSA-ABR Tasks():");
1609 if (! ospf_top
->anyNSSA
)
1612 /* Each area must confirm TranslatorRole */
1613 if (IS_DEBUG_OSPF_NSSA
)
1614 zlog_info ("ospf_abr_nssa_task(): Start");
1616 /* For all Global Entries flagged "local-translate", unset APPROVED */
1617 if (IS_DEBUG_OSPF_NSSA
)
1618 zlog_info ("ospf_abr_nssa_task(): unapprove translates");
1620 ospf_abr_unapprove_translates ();
1622 /* RESET all Ranges in every Area, same as summaries */
1623 if (IS_DEBUG_OSPF_NSSA
)
1624 zlog_info ("ospf_abr_nssa_task(): NSSA initialize aggregates");
1626 /* ospf_abr_prepare_aggregates (); TURNED OFF just for now */
1628 /* For all NSSAs, Type-7s, translate to 5's, INSTALL/FLOOD, or
1629 Aggregate as Type-7 */
1630 /* Install or Approve in Type-5 Global LSDB */
1631 if (IS_DEBUG_OSPF_NSSA
)
1632 zlog_info ("ospf_abr_nssa_task(): process translates");
1634 ospf_abr_process_nssa_translates (ospf_top
->new_table
);
1636 /* Translate/Send any "ranged" aggregates, and also 5-Install and
1638 /* Scan Type-7's for aggregates, translate to Type-5's,
1639 Install/Flood/Approve */
1640 if (IS_DEBUG_OSPF_NSSA
)
1641 zlog_info("ospf_abr_nssa_task(): send NSSA aggregates");
1642 /* ospf_abr_send_nssa_aggregates (); TURNED OFF FOR NOW */
1644 /* Send any NSSA defaults as Type-5 */
1645 if (IS_DEBUG_OSPF_NSSA
)
1646 zlog_info ("ospf_abr_nssa_task(): announce nssa defaults");
1647 ospf_abr_announce_nssa_defaults ();
1649 /* Flush any unapproved previous translates from Global Data Base */
1650 if (IS_DEBUG_OSPF_NSSA
)
1651 zlog_info ("ospf_abr_nssa_task(): remove unapproved translates");
1652 ospf_abr_remove_unapproved_translates ();
1654 ospf_abr_manage_discard_routes (); /* same as normal...discard */
1656 if (IS_DEBUG_OSPF_NSSA
)
1657 zlog_info ("ospf_abr_nssa_task(): Stop");
1659 #endif /* HAVE_NSSA */
1661 /* This is the function taking care about ABR stuff, i.e.
1662 summary-LSA origination and flooding. */
1666 if (IS_DEBUG_OSPF_EVENT
)
1667 zlog_info ("ospf_abr_task(): Start");
1669 if (ospf_top
->new_table
== NULL
|| ospf_top
->new_rtrs
== NULL
)
1671 if (IS_DEBUG_OSPF_EVENT
)
1672 zlog_info ("ospf_abr_task(): Routing tables are not yet ready");
1676 if (IS_DEBUG_OSPF_EVENT
)
1677 zlog_info ("ospf_abr_task(): unapprove summaries");
1678 ospf_abr_unapprove_summaries ();
1680 if (IS_DEBUG_OSPF_EVENT
)
1681 zlog_info ("ospf_abr_task(): prepare aggregates");
1682 ospf_abr_prepare_aggregates ();
1686 if (IS_DEBUG_OSPF_EVENT
)
1687 zlog_info ("ospf_abr_task(): process network RT");
1688 ospf_abr_process_network_rt (ospf_top
->new_table
);
1690 if (IS_DEBUG_OSPF_EVENT
)
1691 zlog_info ("ospf_abr_task(): process router RT");
1692 ospf_abr_process_router_rt (ospf_top
->new_rtrs
);
1694 if (IS_DEBUG_OSPF_EVENT
)
1695 zlog_info ("ospf_abr_task(): announce aggregates");
1696 ospf_abr_announce_aggregates ();
1698 if (IS_DEBUG_OSPF_EVENT
)
1699 zlog_info ("ospf_abr_task(): announce stub defaults");
1700 ospf_abr_announce_stub_defaults ();
1703 if (IS_DEBUG_OSPF_EVENT
)
1704 zlog_info ("ospf_abr_task(): remove unapproved summaries");
1705 ospf_abr_remove_unapproved_summaries ();
1707 ospf_abr_manage_discard_routes ();
1710 ospf_abr_nssa_task(); /* if nssa-abr, then scan Type-7 LSDB */
1711 #endif /* HAVE_NSSA */
1713 if (IS_DEBUG_OSPF_EVENT
)
1714 zlog_info ("ospf_abr_task(): Stop");
1719 ospf_abr_task_timer (struct thread
*t
)
1721 ospf_top
->t_abr_task
= 0;
1723 if (IS_DEBUG_OSPF_EVENT
)
1724 zlog_info ("Running ABR task on timer");
1726 ospf_check_abr_status ();
1734 ospf_schedule_abr_task ()
1736 if (IS_DEBUG_OSPF_EVENT
)
1737 zlog_info ("Scheduling ABR task");
1738 if (! ospf_top
->t_abr_task
)
1739 ospf_top
->t_abr_task
= thread_add_timer (master
, ospf_abr_task_timer
,
1740 0, OSPF_ABR_TASK_DELAY
);