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/zebra/irdp_main.c b/zebra/irdp_main.c
index af6bb80..04f12f1 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -150,7 +150,7 @@
if( irdp->AdvPrefList == NULL )
return irdp->Preference;
- LIST_LOOP (irdp->AdvPrefList, adv, node)
+ for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv))
if( p->u.prefix4.s_addr == adv->ip.s_addr )
return adv->pref;
@@ -234,13 +234,13 @@
struct zebra_if *zi=ifp->info;
struct irdp_interface *irdp=&zi->irdp;
struct prefix *p;
- struct listnode *node;
+ struct listnode *node, *nnode;
struct connected *ifc;
irdp->flags &= ~IF_SOLICIT;
if(ifp->connected)
- LIST_LOOP (ifp->connected, ifc, node)
+ for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, ifc))
{
p = ifc->address;
irdp_advertisement(ifp, p);
@@ -266,7 +266,7 @@
{
struct zebra_if *zi=ifp->info;
struct irdp_interface *irdp=&zi->irdp;
- struct listnode *node;
+ struct listnode *node, *nnode;
int i;
struct connected *ifc;
struct prefix *p;
@@ -275,7 +275,7 @@
irdp->t_advertise = NULL;
if(ifp->connected)
- LIST_LOOP (ifp->connected, ifc, node)
+ for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, ifc))
{
p = ifc->address;
@@ -319,16 +319,15 @@
void irdp_finish()
{
- struct listnode *node;
+ struct listnode *node, *nnode;
struct interface *ifp;
struct zebra_if *zi;
struct irdp_interface *irdp;
zlog_info("IRDP: Received shutdown notification.");
- for (node = listhead (iflist); node; node = nextnode (node))
+ for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
{
- ifp = getdata(node);
zi = ifp->info;
if (!zi)