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/rtadv.c b/zebra/rtadv.c
index 7259656..3e22398 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -166,6 +166,7 @@
   int ret;
   int len = 0;
   struct zebra_if *zif;
+  struct rtadv_prefix *rprefix;
   u_char all_nodes_addr[] = {0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
   struct listnode *node;
 
@@ -245,12 +246,9 @@
     }
 
   /* Fill in prefix. */
-  for (node = listhead (zif->rtadv.AdvPrefixList); node; node = nextnode (node))
+  for (ALL_LIST_ELEMENTS_RO (zif->rtadv.AdvPrefixList, node, rprefix))
     {
       struct nd_opt_prefix_info *pinfo;
-      struct rtadv_prefix *rprefix;
-
-      rprefix = getdata (node);
 
       pinfo = (struct nd_opt_prefix_info *) (buf + len);
 
@@ -338,7 +336,7 @@
 int
 rtadv_timer (struct thread *thread)
 {
-  struct listnode *node;
+  struct listnode *node, *nnode;
   struct interface *ifp;
   struct zebra_if *zif;
   int period;
@@ -355,10 +353,8 @@
       rtadv_event (RTADV_TIMER_MSEC, 10 /* 10 ms */);
     }
 
-  for (node = listhead (iflist); node; nextnode (node))
+  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
     {
-      ifp = getdata (node);
-
       if (if_is_loopback (ifp))
 	continue;
 
@@ -553,12 +549,9 @@
   struct listnode *node;
   struct rtadv_prefix *rprefix;
 
-  for (node = listhead (rplist); node; node = nextnode (node))
-    {
-      rprefix = getdata (node);
-      if (prefix_same (&rprefix->prefix, p))
-	return rprefix;
-    }
+  for (ALL_LIST_ELEMENTS_RO (rplist, node, rprefix))
+    if (prefix_same (&rprefix->prefix, p))
+      return rprefix;
   return NULL;
 }
 
@@ -1426,9 +1419,8 @@
   if (zif->rtadv.AdvOtherConfigFlag)
     vty_out (vty, " ipv6 nd other-config-flag%s", VTY_NEWLINE);
 
-  for (node = listhead(zif->rtadv.AdvPrefixList); node; node = nextnode (node))
+  for (ALL_LIST_ELEMENTS_RO (zif->rtadv.AdvPrefixList, node, rprefix))
     {
-      rprefix = getdata (node);
       vty_out (vty, " ipv6 nd prefix %s/%d",
 	       inet_ntop (AF_INET6, &rprefix->prefix.u.prefix6, 
 			  (char *) buf, INET6_ADDRSTRLEN),