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/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index b11aaf2..060c68c 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -108,7 +108,7 @@
union sockunion *su2;
struct peer_group *group;
struct peer *peer;
- struct listnode *nn;
+ struct listnode *node, *nnode;
if (type == RMAP_BGP)
{
@@ -147,7 +147,7 @@
else
{
group = peer->group;
- LIST_LOOP (group->peer, peer, nn)
+ for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
{
if (sockunion_same (su, &peer->su))
return RMAP_MATCH;
@@ -2181,7 +2181,8 @@
afi_t afi;
safi_t safi;
int direct;
- struct listnode *nn, *nm;
+ struct listnode *node, *nnode;
+ struct listnode *mnode, *mnnode;
struct bgp *bgp;
struct peer *peer;
struct peer_group *group;
@@ -2190,9 +2191,9 @@
struct bgp_static *bgp_static;
/* For neighbor route-map updates. */
- LIST_LOOP (bm->bgp, bgp, nn)
+ for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
{
- LIST_LOOP (bgp->peer, peer, nm)
+ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
@@ -2214,7 +2215,7 @@
filter->usmap.map = NULL;
}
}
- LIST_LOOP (bgp->group, group, nm)
+ for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
{
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
@@ -2239,9 +2240,9 @@
}
/* For default-originate route-map updates. */
- LIST_LOOP (bm->bgp, bgp, nn)
+ for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
{
- LIST_LOOP (bgp->peer, peer, nm)
+ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
@@ -2256,7 +2257,7 @@
}
/* For network route-map updates. */
- LIST_LOOP (bm->bgp, bgp, nn)
+ for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
{
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
@@ -2273,7 +2274,7 @@
}
/* For redistribute route-map updates. */
- LIST_LOOP (bm->bgp, bgp, nn)
+ for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
{
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
{