summaryrefslogtreecommitdiff
path: root/ripngd/ripngd.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 /ripngd/ripngd.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 'ripngd/ripngd.c')
-rw-r--r--ripngd/ripngd.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index b6b5f5ae..ec6c4d04 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -380,20 +380,19 @@ ripng_nexthop_rte (struct rte *rte,
int
ripng_lladdr_check (struct interface *ifp, struct in6_addr *addr)
{
- struct listnode *listnode;
+ struct listnode *node;
struct connected *connected;
struct prefix *p;
- for (listnode = listhead (ifp->connected); listnode; nextnode (listnode))
- if ((connected = getdata (listnode)) != NULL)
- {
- p = connected->address;
+ for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, connected))
+ {
+ p = connected->address;
- if (p->family == AF_INET6 &&
- IN6_IS_ADDR_LINKLOCAL (&p->u.prefix6) &&
- IN6_ARE_ADDR_EQUAL (&p->u.prefix6, addr))
- return 1;
- }
+ if (p->family == AF_INET6 &&
+ IN6_IS_ADDR_LINKLOCAL (&p->u.prefix6) &&
+ IN6_ARE_ADDR_EQUAL (&p->u.prefix6, addr))
+ return 1;
+ }
return 0;
}
@@ -1439,9 +1438,8 @@ ripng_update (struct thread *t)
zlog_debug ("RIPng update timer expired!");
/* Supply routes to each interface. */
- for (node = listhead (iflist); node; nextnode (node))
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
- ifp = getdata (node);
ri = ifp->info;
if (if_is_loopback (ifp) || ! if_is_up (ifp))
@@ -1523,9 +1521,8 @@ ripng_triggered_update (struct thread *t)
/* Split Horizon processing is done when generating triggered
updates as well as normal updates (see section 2.6). */
- for (node = listhead (iflist); node; nextnode (node))
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
- ifp = getdata (node);
ri = ifp->info;
if (if_is_loopback (ifp) || ! if_is_up (ifp))
@@ -2137,6 +2134,7 @@ DEFUN (show_ipv6_ripng_status,
"IPv6 routing protocol process parameters and statistics\n")
{
struct listnode *node;
+ struct interface *ifp;
int ripng_network_write (struct vty *, int);
void ripng_redistribute_write (struct vty *, int);
@@ -2171,12 +2169,10 @@ DEFUN (show_ipv6_ripng_status,
vty_out (vty, " Interface Send Recv%s", VTY_NEWLINE);
- for (node = listhead (iflist); node; node = nextnode (node))
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
struct ripng_interface *ri;
- struct interface *ifp;
-
- ifp = getdata (node);
+
ri = ifp->info;
if (ri->enable_network || ri->enable_interface)
@@ -2808,11 +2804,8 @@ ripng_distribute_update_all (struct prefix_list *notused)
struct interface *ifp;
struct listnode *node;
- for (node = listhead (iflist); node; nextnode (node))
- {
- ifp = getdata (node);
- ripng_distribute_update_interface (ifp);
- }
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ ripng_distribute_update_interface (ifp);
}
void
@@ -2986,11 +2979,8 @@ ripng_routemap_update (const char *unused)
struct interface *ifp;
struct listnode *node;
- for (node = listhead (iflist); node; nextnode (node))
- {
- ifp = getdata (node);
- ripng_if_rmap_update_interface (ifp);
- }
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ ripng_if_rmap_update_interface (ifp);
ripng_routemap_update_redistribute ();
}