summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_abr.c
diff options
context:
space:
mode:
authorpaul <paul>2005-04-07 07:30:20 +0000
committerpaul <paul>2005-04-07 07:30:20 +0000
commit1eb8ef2584833f18fb674e127d59cb5a7f771482 (patch)
treef5b09d4781de9a9b08839fefb6530e64d2d2ec31 /ospf6d/ospf6_abr.c
parent5920990fecba7e2430af3cfaa8bcbaed40d0ba1a (diff)
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
Diffstat (limited to 'ospf6d/ospf6_abr.c')
-rw-r--r--ospf6d/ospf6_abr.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 8bacfcd3..7eb8f09c 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -56,12 +56,9 @@ ospf6_is_router_abr (struct ospf6 *o)
struct ospf6_area *oa;
int area_count = 0;
- for (node = listhead (o->area_list); node; nextnode (node))
- {
- oa = OSPF6_AREA (getdata (node));
- if (IS_AREA_ENABLED (oa))
- area_count++;
- }
+ for (ALL_LIST_ELEMENTS_RO (o->area_list, node, oa))
+ if (IS_AREA_ENABLED (oa))
+ area_count++;
if (area_count > 1)
return 1;
@@ -73,12 +70,10 @@ ospf6_abr_enable_area (struct ospf6_area *area)
{
struct ospf6_area *oa;
struct ospf6_route *ro;
- struct listnode *node;
+ struct listnode *node, *nnode;
- for (node = listhead (area->ospf6->area_list); node; nextnode (node))
+ for (ALL_LIST_ELEMENTS (area->ospf6->area_list, node, nnode, oa))
{
- oa = OSPF6_AREA (getdata (node));
-
/* update B bit for each area */
OSPF6_ROUTER_LSA_SCHEDULE (oa);
@@ -111,7 +106,7 @@ ospf6_abr_disable_area (struct ospf6_area *area)
struct ospf6_area *oa;
struct ospf6_route *ro;
struct ospf6_lsa *old;
- struct listnode *node;
+ struct listnode *node, *nnode;
/* Withdraw all summary prefixes previously originated */
for (ro = ospf6_route_head (area->summary_prefix); ro;
@@ -136,13 +131,9 @@ ospf6_abr_disable_area (struct ospf6_area *area)
}
/* Schedule Router-LSA for each area (ABR status may change) */
- for (node = listhead (area->ospf6->area_list); node; nextnode (node))
- {
- oa = OSPF6_AREA (getdata (node));
-
- /* update B bit for each area */
- OSPF6_ROUTER_LSA_SCHEDULE (oa);
- }
+ for (ALL_LIST_ELEMENTS (area->ospf6->area_list, node, nnode, oa))
+ /* update B bit for each area */
+ OSPF6_ROUTER_LSA_SCHEDULE (oa);
}
/* RFC 2328 12.4.3. Summary-LSAs */
@@ -470,7 +461,7 @@ ospf6_abr_range_update (struct ospf6_route *range)
void
ospf6_abr_originate_summary (struct ospf6_route *route)
{
- struct listnode *node;
+ struct listnode *node, *nnode;
struct ospf6_area *oa;
struct ospf6_route *range = NULL;
@@ -482,11 +473,8 @@ ospf6_abr_originate_summary (struct ospf6_route *route)
ospf6_abr_range_update (range);
}
- for (node = listhead (ospf6->area_list); node; nextnode (node))
- {
- oa = (struct ospf6_area *) getdata (node);
- ospf6_abr_originate_summary_to_area (route, oa);
- }
+ for (ALL_LIST_ELEMENTS (ospf6->area_list, node, nnode, oa))
+ ospf6_abr_originate_summary_to_area (route, oa);
}
/* RFC 2328 16.2. Calculating the inter-area routes */
@@ -656,22 +644,17 @@ ospf6_abr_examin_brouter (u_int32_t router_id)
{
struct ospf6_lsa *lsa;
struct ospf6_area *oa;
- struct listnode *node;
+ struct listnode *node, *nnode;
u_int16_t type;
- type = htons (OSPF6_LSTYPE_INTER_ROUTER);
- for (node = listhead (ospf6->area_list); node; nextnode (node))
+ for (ALL_LIST_ELEMENTS (ospf6->area_list, node, nnode, oa))
{
- oa = OSPF6_AREA (getdata (node));
+ type = htons (OSPF6_LSTYPE_INTER_ROUTER);
for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa;
lsa = ospf6_lsdb_type_router_next (type, router_id, lsa))
ospf6_abr_examin_summary (lsa, oa);
- }
- type = htons (OSPF6_LSTYPE_INTER_PREFIX);
- for (node = listhead (ospf6->area_list); node; nextnode (node))
- {
- oa = OSPF6_AREA (getdata (node));
+ type = htons (OSPF6_LSTYPE_INTER_PREFIX);
for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa;
lsa = ospf6_lsdb_type_router_next (type, router_id, lsa))
ospf6_abr_examin_summary (lsa, oa);