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.
diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c
index 5bdcfba..87613bf 100644
--- a/ospfd/ospf_ia.c
+++ b/ospfd/ospf_ia.c
@@ -62,10 +62,10 @@
route_unlock_node (rn);
- for (node = listhead ((struct list *) rn->info); node; nextnode (node))
- if ((or = getdata (node)) != NULL)
- if (IPV4_ADDR_SAME (&or->u.std.area_id, &area->area_id) && (or->u.std.flags & ROUTER_LSA_BORDER))
- return or;
+ for (ALL_LIST_ELEMENTS_RO ((struct list *) rn->info, node, or))
+ if (IPV4_ADDR_SAME (&or->u.std.area_id, &area->area_id)
+ && (or->u.std.flags & ROUTER_LSA_BORDER))
+ return or;
return NULL;
}
@@ -637,11 +637,10 @@
OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
- for (node = listhead (ospf->areas); node; nextnode (node))
- if ((area = getdata (node)) != NULL)
- if (area != ospf->backbone)
- if (ospf_area_is_transit (area))
- OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
+ for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
+ if (area != ospf->backbone)
+ if (ospf_area_is_transit (area))
+ OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
}
else
if (IS_DEBUG_OSPF_EVENT)
@@ -664,20 +663,18 @@
OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
- for (node = listhead (ospf->areas); node; nextnode (node))
- if ((area = getdata (node)) != NULL)
- if (area != ospf->backbone)
- if (ospf_area_is_transit (area))
- OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
+ for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
+ if (area != ospf->backbone)
+ if (ospf_area_is_transit (area))
+ OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
}
else
{ /* No active BB connection--consider all areas */
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_ia_routing(): "
"Active BB connection not found");
- for (node = listhead (ospf->areas); node; nextnode (node))
- if ((area = getdata (node)) != NULL)
- OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
+ for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
+ OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
}
break;
case OSPF_ABR_SHORTCUT:
@@ -696,15 +693,14 @@
OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
}
- for (node = listhead (ospf->areas); node; nextnode (node))
- if ((area = getdata (node)) != NULL)
- if (area != ospf->backbone)
- if (ospf_area_is_transit (area) ||
- ((area->shortcut_configured != OSPF_SHORTCUT_DISABLE) &&
- ((ospf->backbone == NULL) ||
- ((area->shortcut_configured == OSPF_SHORTCUT_ENABLE) &&
- area->shortcut_capability))))
- OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
+ for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
+ if (area != ospf->backbone)
+ if (ospf_area_is_transit (area) ||
+ ((area->shortcut_configured != OSPF_SHORTCUT_DISABLE) &&
+ ((ospf->backbone == NULL) ||
+ ((area->shortcut_configured == OSPF_SHORTCUT_ENABLE) &&
+ area->shortcut_capability))))
+ OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
break;
default:
break;
@@ -717,8 +713,7 @@
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_ia_routing():not ABR, considering all areas");
- for (node = listhead (ospf->areas); node; nextnode (node))
- if ((area = getdata (node)) != NULL)
- OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
+ for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
+ OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
}
}