summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_nexthop.c
diff options
context:
space:
mode:
authorpaul <paul>2005-04-07 09:30:20 +0200
committerpaul <paul>2005-04-07 09:30:20 +0200
commit1eb8ef2584833f18fb674e127d59cb5a7f771482 (patch)
treef5b09d4781de9a9b08839fefb6530e64d2d2ec31 /bgpd/bgp_nexthop.c
parent * lib/prefix.[hc]: inet6_ntoa utility function copied from (diff)
downloadfrr-1eb8ef2584833f18fb674e127d59cb5a7f771482.tar.xz
frr-1eb8ef2584833f18fb674e127d59cb5a7f771482.zip
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 'bgpd/bgp_nexthop.c')
-rw-r--r--bgpd/bgp_nexthop.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 76c1c2a13..df55f326b 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -419,7 +419,7 @@ bgp_scan (afi_t afi, safi_t safi)
struct bgp_info *bi;
struct bgp_info *next;
struct peer *peer;
- struct listnode *nn;
+ struct listnode *node, *nnode;
int valid;
int current;
int changed;
@@ -437,7 +437,7 @@ bgp_scan (afi_t afi, safi_t safi)
return;
/* Maximum prefix check */
- LIST_LOOP (bgp->peer, peer, nn)
+ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{
if (peer->status != Established)
continue;
@@ -723,13 +723,10 @@ bgp_nexthop_self (afi_t afi, struct attr *attr)
struct connected *ifc;
struct prefix *p;
- for (node = listhead (iflist); node; nextnode (node))
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
- ifp = getdata (node);
-
- for (node2 = listhead (ifp->connected); node2; nextnode (node2))
+ for (ALL_LIST_ELEMENTS_RO (ifp->connected, node2, ifc))
{
- ifc = getdata (node2);
p = ifc->address;
if (p && p->family == AF_INET
@@ -1033,7 +1030,7 @@ bgp_import (struct thread *t)
struct bgp *bgp;
struct bgp_node *rn;
struct bgp_static *bgp_static;
- struct listnode *nn;
+ struct listnode *node, *nnode;
int valid;
u_int32_t metric;
struct in_addr nexthop;
@@ -1046,7 +1043,7 @@ bgp_import (struct thread *t)
if (BGP_DEBUG (events, EVENTS))
zlog_debug ("Import timer expired.");
- LIST_LOOP (bm->bgp, bgp, nn)
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
{
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MPLS_VPN; safi++)