Fix most compiler warnings in default GCC build.

Fix lots of warnings. Some const and type-pun breaks strict-aliasing
warnings left but much reduced.

* bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to
  (struct fifo), so just use that.  Makes it clearer the beginning of
  (struct bgp_advertise) is compatible with with (struct fifo), which seems
  to be enough for gcc.
  Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up
  type-punning breaks strict aliasing warnings.
* bgp_packet.c: Use BGP_ADV_FIFO_HEAD.
  (bgp_route_refresh_receive) fix an interesting logic error in
  (!ok || (ret != BLAH)) where ret is only well-defined if ok.
* bgp_vty.c: Peer commands should use bgp_vty_return to set their return.
* jhash.{c,h}: Can take const on * args without adding issues & fix warnings.
* libospf.h: LSA sequence numbers use the unsigned range of values, and
  constants need to be set to unsigned, or it causes warnings in ospf6d.
* md5.h: signedness of caddr_t is implementation specific, change to an
  explicit (uint_8 *), fix sign/unsigned comparison warnings.
* vty.c: (vty_log_fixed) const on level is well-intentioned, but not going
  to fly given iov_base.
* workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always
  true for address of static variable.  Correct but pointless warning in
  this case, but use a 2nd pointer to shut it up.
* ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2
  different 32 bit IDs into in (struct ospf6_route), and the resulting
  type-pun strict-alias breakage warnings this causes.  Need to use 2
  different fields to fix that warning?

general:

* remove unused variables, other than a few cases where they serve a
  sufficiently useful documentary purpose (e.g.  for code that needs
  fixing), or they're required dummies.  In those cases, try mark them as
  unused.
* Remove dead code that can't be reached.
* Quite a few 'no ...' forms of vty commands take arguments, but do not
  check the argument matches the command being negated.  E.g., should
  'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set?
  Or should it be required that the distance match the previously configured
  distance for the prefix?
  Ultimately, probably better to be strict about this.  However, changing
  from slack to strict might expose problems in command aliases and tools.
* Fix uninitialised use of variables.
* Fix sign/unsigned comparison warnings by making signedness of types consistent.
* Mark functions as static where their use is restricted to the same compilation
  unit.
* Add required headers
* Move constants defined in headers into code.
* remove dead, unused functions that have no debug purpose.
diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h
index 4ebde90..2cf2a29 100644
--- a/bgpd/bgp_advertise.h
+++ b/bgpd/bgp_advertise.h
@@ -21,13 +21,6 @@
 #ifndef _QUAGGA_BGP_ADVERTISE_H
 #define _QUAGGA_BGP_ADVERTISE_H
 
-/* BGP advertise FIFO.  */
-struct bgp_advertise_fifo
-{
-  struct bgp_advertise *next;
-  struct bgp_advertise *prev;
-};
-
 /* BGP advertise attribute.  */
 struct bgp_advertise_attr
 {
@@ -44,7 +37,7 @@
 struct bgp_advertise
 {
   /* FIFO for advertisement.  */
-  struct bgp_advertise_fifo fifo;
+  struct fifo fifo;
 
   /* Link list for same attribute advertise.  */
   struct bgp_advertise *next;
@@ -97,11 +90,13 @@
 /* BGP advertisement list.  */
 struct bgp_synchronize
 {
-  struct bgp_advertise_fifo update;
-  struct bgp_advertise_fifo withdraw;
-  struct bgp_advertise_fifo withdraw_low;
+  struct fifo update;
+  struct fifo withdraw;
+  struct fifo withdraw_low;
 };
 
+#define BGP_ADV_FIFO_HEAD(F) ((struct bgp_advertise *)FIFO_HEAD(F))
+
 /* BGP adjacency linked list.  */
 #define BGP_INFO_ADD(N,A,TYPE)                        \
   do {                                                \
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index fcf8255..b62a4f8 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2110,7 +2110,6 @@
       case SAFI_UNICAST:
       case SAFI_MULTICAST:
 	{
-	  unsigned long sizep;
 	  struct attr_extra *attre = attr->extra;
 
 	  assert (attr->extra);
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index b0cf2a9..3d2dade 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -84,7 +84,6 @@
   struct prefix p;
   int psize;
   int prefixlen;
-  u_int32_t label;
   u_int16_t type;
   struct rd_as rd_as;
   struct rd_ip rd_ip;
@@ -117,8 +116,9 @@
 	  zlog_err ("prefix length is less than 88: %d", prefixlen);
 	  return -1;
 	}
-
-      label = decode_label (pnt);
+	
+      /* XXX: Not doing anything with the label */
+      decode_label (pnt);
 
       /* Copyr label to prefix. */
       tagpnt = pnt;;
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 5b1d13a..6218e67 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -789,9 +789,9 @@
   uint16_t length;
   u_char marker;
   u_char version;
-  uint16_t command;
-  int nbytes;
-  struct in_addr raddr;
+  uint16_t command __attribute__((unused));
+  int nbytes __attribute__((unused));
+  struct in_addr raddr __attribute__((unused));
   uint32_t metric;
   int i;
   u_char nexthop_num;
@@ -801,6 +801,7 @@
   s = zlookup->ibuf;
   stream_reset (s);
 
+  /* nbytes not being checked */
   nbytes = stream_read (s, zlookup->sock, 2);
   length = stream_getw (s);
 
@@ -814,9 +815,11 @@
                __func__, zlookup->sock, marker, version);
       return NULL;
     }
-    
+  
+  /* XXX: not checking command */
   command = stream_getw (s);
   
+  /* XXX: not doing anything with raddr */
   raddr.s_addr = stream_get_ipv4 (s);
   metric = stream_getl (s);
   nexthop_num = stream_getc (s);
@@ -901,8 +904,6 @@
   struct stream *s;
   uint16_t length;
   u_char version, marker;
-  uint16_t  command;
-  int nbytes;
   struct in6_addr raddr;
   uint32_t metric;
   int i;
@@ -913,10 +914,11 @@
   s = zlookup->ibuf;
   stream_reset (s);
 
-  nbytes = stream_read (s, zlookup->sock, 2);
+  /* XXX: ignoring nbytes, see also zread_lookup */
+  stream_read (s, zlookup->sock, 2);
   length = stream_getw (s);
 
-  nbytes = stream_read (s, zlookup->sock, length - 2);
+  stream_read (s, zlookup->sock, length - 2);
   marker = stream_getc (s);
   version = stream_getc (s);
   
@@ -926,9 +928,11 @@
                __func__, zlookup->sock, marker, version);
       return NULL;
     }
-    
-  command = stream_getw (s);
   
+  /* XXX: ignoring command */  
+  stream_getw (s);
+  
+  /* XXX: not actually doing anything with raddr */
   stream_get (&raddr, s, 16);
 
   metric = stream_getl (s);
@@ -1014,10 +1018,10 @@
 {
   struct stream *s;
   int ret;
-  u_int16_t length, command;
+  u_int16_t length, command __attribute__((unused));
   u_char version, marker;
-  int nbytes;
-  struct in_addr addr;
+  int nbytes __attribute__((unused));
+  struct in_addr addr __attribute__((unused));
   struct in_addr nexthop;
   u_int32_t metric = 0;
   u_char nexthop_num;
@@ -1063,6 +1067,7 @@
   stream_reset (s);
 
   /* Fetch length. */
+  /* XXX: not using nbytes */
   nbytes = stream_read (s, zlookup->sock, 2);
   length = stream_getw (s);
 
@@ -1077,9 +1082,11 @@
                __func__, zlookup->sock, marker, version);
       return 0;
     }
-    
+  
+  /* XXX: not using command */
   command = stream_getw (s);
   
+  /* XXX: not using addr */
   addr.s_addr = stream_get_ipv4 (s);
   metric = stream_getl (s);
   nexthop_num = stream_getc (s);
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 65c6cac..0fab1b0 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -158,7 +158,7 @@
   snlri = peer->scratch;
   stream_reset (snlri);
 
-  adv = FIFO_HEAD (&peer->sync[afi][safi]->update);
+  adv = BGP_ADV_FIFO_HEAD (&peer->sync[afi][safi]->update);
 
   while (adv)
     {
@@ -331,7 +331,6 @@
   struct bgp_adj_out *adj;
   struct bgp_advertise *adv;
   struct bgp_node *rn;
-  unsigned long pos;
   bgp_size_t unfeasible_len;
   bgp_size_t total_attr_len;
   size_t mp_start = 0;
@@ -342,7 +341,7 @@
   s = peer->work;
   stream_reset (s);
 
-  while ((adv = FIFO_HEAD (&peer->sync[afi][safi]->withdraw)) != NULL)
+  while ((adv = BGP_ADV_FIFO_HEAD (&peer->sync[afi][safi]->withdraw)) != NULL)
     {
       assert (adv->rn);
       adj = adv->adj;
@@ -595,7 +594,7 @@
   for (afi = AFI_IP; afi < AFI_MAX; afi++)
     for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
       {
-	adv = FIFO_HEAD (&peer->sync[afi][safi]->withdraw);
+	adv = BGP_ADV_FIFO_HEAD (&peer->sync[afi][safi]->withdraw);
 	if (adv)
 	  {
 	    s = bgp_withdraw_packet (peer, afi, safi);
@@ -607,7 +606,7 @@
   for (afi = AFI_IP; afi < AFI_MAX; afi++)
     for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
       {
-	adv = FIFO_HEAD (&peer->sync[afi][safi]->update);
+	adv = BGP_ADV_FIFO_HEAD (&peer->sync[afi][safi]->update);
 	if (adv)
 	  {
             if (adv->binfo && adv->binfo->uptime < peer->synctime)
@@ -663,7 +662,7 @@
 
   for (afi = AFI_IP; afi < AFI_MAX; afi++)
     for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
-      if ((adv = FIFO_HEAD (&peer->sync[afi][safi]->update)) != NULL)
+      if ((adv = BGP_ADV_FIFO_HEAD (&peer->sync[afi][safi]->update)) != NULL)
 	if (adv->binfo->uptime < peer->synctime)
 	  return 1;
 
@@ -2036,7 +2035,6 @@
 {
   afi_t afi;
   safi_t safi;
-  u_char reserved;
   struct stream *s;
 
   /* If peer does not have the capability, send notification. */
@@ -2064,7 +2062,8 @@
   
   /* Parse packet. */
   afi = stream_getw (s);
-  reserved = stream_getc (s);
+  /* reserved byte */
+  stream_getc (s);
   safi = stream_getc (s);
 
   if (BGP_DEBUG (normal, NORMAL))
@@ -2116,8 +2115,8 @@
 	  if (orf_type == ORF_TYPE_PREFIX
 	      || orf_type == ORF_TYPE_PREFIX_OLD)
 	    {
-	      u_char *p_pnt = stream_pnt (s);
-	      u_char *p_end = stream_pnt (s) + orf_len;
+	      uint8_t *p_pnt = stream_pnt (s);
+	      uint8_t *p_end = stream_pnt (s) + orf_len;
 	      struct orf_prefix orfp;
 	      u_char common = 0;
 	      u_int32_t seq;
@@ -2157,7 +2156,7 @@
 		      prefix_bgp_orf_remove_all (name);
 		      break;
 		    }
-		  ok = ((p_end - p_pnt) >= sizeof(u_int32_t)) ;
+		  ok = ((size_t)(p_end - p_pnt) >= sizeof(u_int32_t)) ;
 		  if (ok)
 		    {
 		      memcpy (&seq, p_pnt, sizeof (u_int32_t));
@@ -2209,8 +2208,8 @@
 		    ret = prefix_bgp_orf_set (name, afi, &orfp,
 				   (common & ORF_COMMON_PART_DENY ? 0 : 1 ),
 				   (common & ORF_COMMON_PART_REMOVE ? 0 : 1));
-
-		  if (!ok || (ret != CMD_SUCCESS))
+                  
+		  if (!ok || (ok && ret != CMD_SUCCESS))
 		    {
 		      if (BGP_DEBUG (normal, NORMAL))
 			zlog_debug ("%s Received misformatted prefixlist ORF."
@@ -2246,11 +2245,9 @@
   struct capability_mp_data mpc;
   struct capability_header *hdr;
   u_char action;
-  struct bgp *bgp;
   afi_t afi;
   safi_t safi;
 
-  bgp = peer->bgp;
   end = pnt + length;
 
   while (pnt < end)
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 04cbb8a..e7357e5 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -4525,20 +4525,11 @@
   struct aspath *asmerge = NULL;
   struct community *community = NULL;
   struct community *commerge = NULL;
-  struct in_addr nexthop;
-  u_int32_t med = 0;
   struct bgp_info *ri;
   struct bgp_info *new;
   int first = 1;
   unsigned long match = 0;
 
-  /* Record adding route's nexthop and med. */
-  if (rinew)
-    {
-      nexthop = rinew->attr->nexthop;
-      med = rinew->attr->med;
-    }
-
   /* ORIGIN attribute: If at least one route among routes that are
      aggregated has ORIGIN with the value INCOMPLETE, then the
      aggregated route must have the ORIGIN attribute with the value
@@ -4566,11 +4557,7 @@
 	      continue;
 
 	    if (! rinew && first)
-	      {
-		nexthop = ri->attr->nexthop;
-		med = ri->attr->med;
-		first = 0;
-	      }
+              first = 0;
 
 #ifdef AGGREGATE_NEXTHOP_CHECK
 	    if (! IPV4_ADDR_SAME (&ri->attr->nexthop, &nexthop)
@@ -11773,7 +11760,13 @@
     }
 
   bdistance = rn->info;
-
+  
+  if (bdistance->distance != distance)
+    {
+       vty_out (vty, "Distance does not match configured%s", VTY_NEWLINE);
+       return CMD_WARNING;
+    }
+  
   if (bdistance->access_list)
     free (bdistance->access_list);
   bgp_distance_free (bdistance);
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index c498f58..06b0859 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -1174,7 +1174,6 @@
 static void *
 route_set_metric_compile (const char *arg)
 {
-  u_int32_t metric;
   unsigned long larg;
   char *endptr = NULL;
 
@@ -1185,7 +1184,6 @@
       larg = strtoul (arg, &endptr, 10);
       if (*endptr != '\0' || errno || larg > UINT32_MAX)
         return NULL;
-      metric = larg;
     }
   else
     {
@@ -1199,7 +1197,6 @@
       larg = strtoul (arg+1, &endptr, 10);
       if (*endptr != '\0' || errno || larg > UINT32_MAX)
 	return NULL;
-      metric = larg;
     }
 
   return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
@@ -1802,22 +1799,21 @@
 route_match_ipv6_next_hop (void *rule, struct prefix *prefix, 
 			   route_map_object_t type, void *object)
 {
-  struct in6_addr *addr;
+  struct in6_addr *addr = rule;
   struct bgp_info *bgp_info;
 
   if (type == RMAP_BGP)
     {
-      addr = rule;
       bgp_info = object;
       
       if (!bgp_info->attr->extra)
         return RMAP_NOMATCH;
       
-      if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, rule))
+      if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, addr))
 	return RMAP_MATCH;
 
       if (bgp_info->attr->extra->mp_nexthop_len == 32 &&
-	  IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_local, rule))
+	  IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_local, addr))
 	return RMAP_MATCH;
 
       return RMAP_NOMATCH;
@@ -3430,7 +3426,7 @@
        "IP address of aggregator\n")
 {
   int ret;
-  as_t as;
+  as_t as __attribute__((unused)); /* dummy for VTY_GET_INTEGER_RANGE */
   struct in_addr address;
   char *argstr;
 
@@ -3464,7 +3460,7 @@
        "AS number of aggregator\n")
 {
   int ret;
-  as_t as;
+  as_t as __attribute__((unused)); /* dummy for VTY_GET_INTEGER_RANGE */
   struct in_addr address;
   char *argstr;
 
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index a818fe7..ca44774 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -576,7 +576,7 @@
        "AS number\n")
 {
   struct bgp *bgp;
-  as_t as;
+  as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
 
   bgp = vty->index;
 
@@ -3205,7 +3205,6 @@
 peer_weight_set_vty (struct vty *vty, const char *ip_str, 
                      const char *weight_str)
 {
-  int ret;
   struct peer *peer;
   unsigned long weight;
 
@@ -3215,9 +3214,7 @@
 
   VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
 
-  ret = peer_weight_set (peer, weight);
-
-  return CMD_SUCCESS;
+  return bgp_vty_return (vty, peer_weight_set (peer, weight));
 }
 
 static int
@@ -3229,9 +3226,7 @@
   if (! peer)
     return CMD_WARNING;
 
-  peer_weight_unset (peer);
-
-  return CMD_SUCCESS;
+  return bgp_vty_return (vty, peer_weight_unset (peer));
 }
 
 DEFUN (neighbor_weight,
@@ -3371,7 +3366,6 @@
 peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, 
                              const char *time_str)
 {
-  int ret;
   struct peer *peer;
   u_int32_t connect;
 
@@ -3381,24 +3375,19 @@
 
   VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
 
-  ret = peer_timers_connect_set (peer, connect);
-
-  return CMD_SUCCESS;
+  return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
 }
 
 static int
 peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
 {
-  int ret;
   struct peer *peer;
 
   peer = peer_and_group_lookup_vty (vty, ip_str);
   if (! peer)
     return CMD_WARNING;
 
-  ret = peer_timers_connect_unset (peer);
-
-  return CMD_SUCCESS;
+  return bgp_vty_return (vty, peer_timers_connect_unset (peer));
 }
 
 DEFUN (neighbor_timers_connect,
@@ -3455,7 +3444,7 @@
   else
     ret = peer_advertise_interval_unset (peer);
 
-  return CMD_SUCCESS;
+  return bgp_vty_return (vty, ret);
 }
 
 DEFUN (neighbor_advertise_interval,
@@ -3505,7 +3494,7 @@
   else
     ret = peer_interface_unset (peer);
 
-  return CMD_SUCCESS;
+  return bgp_vty_return (vty, ret);
 }
 
 DEFUN (neighbor_interface,
diff --git a/lib/command.c b/lib/command.c
index 1087ceb..d1af7fa 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1411,7 +1411,7 @@
   const char *word;
   int keyword_argc;
   const char **keyword_argv;
-  enum matcher_rv rv;
+  enum matcher_rv rv = MATCHER_NO_MATCH;
 
   keyword_mask = 0;
   while (1)
@@ -1642,7 +1642,7 @@
 {
   struct cmd_matcher matcher;
   unsigned int token_index;
-  enum matcher_rv rv;
+  enum matcher_rv rv = MATCHER_NO_MATCH;
 
   cmd_matcher_init(&matcher, cmd_element, filter,
                    vline, index, match_type, match);
diff --git a/lib/if.c b/lib/if.c
index 18e2fb3..3a1f9b4 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -309,8 +309,6 @@
 if_lookup_prefix (struct prefix *prefix)
 {
   struct listnode *node;
-  struct prefix addr;
-  int bestlen = 0;
   struct listnode *cnode;
   struct interface *ifp;
   struct connected *c;
@@ -453,7 +451,7 @@
 if_dump (const struct interface *ifp)
 {
   struct listnode *node;
-  struct connected *c;
+  struct connected *c __attribute__((unused));
 
   for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, c))
     zlog_info ("Interface %s index %d metric %d mtu %d "
diff --git a/lib/jhash.c b/lib/jhash.c
index 071fed6..6154c34 100644
--- a/lib/jhash.c
+++ b/lib/jhash.c
@@ -42,10 +42,10 @@
  * the input key.
  */
 u_int32_t
-jhash (void *key, u_int32_t length, u_int32_t initval)
+jhash (const void *key, u_int32_t length, u_int32_t initval)
 {
   u_int32_t a, b, c, len;
-  u_int8_t *k = key;
+  const u_int8_t *k = key;
 
   len = length;
   a = b = JHASH_GOLDEN_RATIO;
@@ -105,7 +105,7 @@
  * The length parameter here is the number of u_int32_ts in the key.
  */
 u_int32_t
-jhash2 (u_int32_t * k, u_int32_t length, u_int32_t initval)
+jhash2 (const u_int32_t *k, u_int32_t length, u_int32_t initval)
 {
   u_int32_t a, b, c, len;
 
diff --git a/lib/jhash.h b/lib/jhash.h
index 44dd1b5..985ac94 100644
--- a/lib/jhash.h
+++ b/lib/jhash.h
@@ -24,12 +24,12 @@
  * of bytes.  No alignment or length assumptions are made about
  * the input key.
  */
-extern u_int32_t jhash(void *key, u_int32_t length, u_int32_t initval);
+extern u_int32_t jhash(const void *key, u_int32_t length, u_int32_t initval);
 
 /* A special optimized version that handles 1 or more of u_int32_ts.
  * The length parameter here is the number of u_int32_ts in the key.
  */
-extern u_int32_t jhash2(u_int32_t *k, u_int32_t length, u_int32_t initval);
+extern u_int32_t jhash2(const u_int32_t *k, u_int32_t length, u_int32_t initval);
 
 /* A special ultra-optimized versions that knows they are hashing exactly
  * 3, 2 or 1 word(s).
diff --git a/lib/libospf.h b/lib/libospf.h
index 856c76d..2796209 100644
--- a/lib/libospf.h
+++ b/lib/libospf.h
@@ -47,8 +47,8 @@
 #define OSPF_LSA_MAXAGE_DIFF                   900
 #define OSPF_LS_INFINITY                  0xffffff
 #define OSPF_DEFAULT_DESTINATION        0x00000000      /* 0.0.0.0 */
-#define OSPF_INITIAL_SEQUENCE_NUMBER    0x80000001
-#define OSPF_MAX_SEQUENCE_NUMBER        0x7fffffff
+#define OSPF_INITIAL_SEQUENCE_NUMBER    0x80000001U
+#define OSPF_MAX_SEQUENCE_NUMBER        0x7fffffffU
 
 /* OSPF Interface Types */
 #define OSPF_IFTYPE_NONE		0
diff --git a/lib/md5.c b/lib/md5.c
index 2fc36e1..ce459bb 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -306,7 +306,7 @@
 int             text_len;		/* length of data stream */
 unsigned char*  key;			/* pointer to authentication key */
 int             key_len;		/* length of authentication key */
-caddr_t         digest;		/* caller digest to be filled in */
+uint8_t *       digest;			/* caller digest to be filled in */
 
 {
     MD5_CTX context;
diff --git a/lib/md5.h b/lib/md5.h
index a03bf22..4e5ffbd 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -84,6 +84,6 @@
 
 /* From RFC 2104 */
 void hmac_md5(unsigned char* text, int text_len, unsigned char* key,
-              int key_len, caddr_t digest);
+              int key_len, uint8_t *digest);
 
 #endif /* ! _LIBZEBRA_MD5_H_*/
diff --git a/lib/table.c b/lib/table.c
index 220e9b8..bd7023c 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -626,11 +626,8 @@
 			       struct prefix *p)
 {
   struct route_node *node, *tmp_node;
-  u_char prefixlen;
   int cmp;
 
-  prefixlen = p->prefixlen;
-
   node = table->top;
 
   while (node)
diff --git a/lib/vty.c b/lib/vty.c
index 488f8d5..3f08b9e 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2458,7 +2458,7 @@
 
 /* Async-signal-safe version of vty_log for fixed strings. */
 void
-vty_log_fixed (const char *buf, size_t len)
+vty_log_fixed (char *buf, size_t len)
 {
   unsigned int i;
   struct iovec iov[2];
@@ -2467,7 +2467,7 @@
   if (!vtyvec)
     return;
   
-  iov[0].iov_base = (void *)buf;
+  iov[0].iov_base = buf;
   iov[0].iov_len = len;
   iov[1].iov_base = (void *)"\r\n";
   iov[1].iov_len = 2;
diff --git a/lib/vty.h b/lib/vty.h
index 1798585..4d6048c 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -242,6 +242,6 @@
 
 /* Send a fixed-size message to all vty terminal monitors; this should be
    an async-signal-safe function. */
-extern void vty_log_fixed (const char *buf, size_t len);
+extern void vty_log_fixed (char *buf, size_t len);
 
 #endif /* _ZEBRA_VTY_H */
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 61643bf..e09d009 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -30,7 +30,11 @@
 #include "log.h"
 
 /* master list of work_queues */
-static struct list work_queues;
+static struct list _work_queues;
+/* pointer primarily to avoid an otherwise harmless warning on
+ * ALL_LIST_ELEMENTS_RO 
+ */
+static struct list *work_queues = &_work_queues;
 
 #define WORK_QUEUE_MIN_GRANULARITY 1
 
@@ -78,7 +82,7 @@
   
   new->items->del = (void (*)(void *)) work_queue_item_free;  
   
-  listnode_add (&work_queues, new);
+  listnode_add (work_queues, new);
   
   new->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY;
 
@@ -96,7 +100,7 @@
   
   /* list_delete frees items via callback */
   list_delete (wq->items);
-  listnode_delete (&work_queues, wq);
+  listnode_delete (work_queues, wq);
   
   XFREE (MTYPE_WORK_QUEUE_NAME, wq->name);
   XFREE (MTYPE_WORK_QUEUE, wq);
@@ -187,7 +191,7 @@
            "Name", 
            VTY_NEWLINE);
  
-  for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq))
+  for (ALL_LIST_ELEMENTS_RO (work_queues, node, wq))
     {
       vty_out (vty,"%c %8d %5d %8ld %7d %6d %6u %s%s",
                (CHECK_FLAG (wq->flags, WQ_UNPLUGGED) ? ' ' : 'P'),
diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h
index 816f596..e5e2660 100644
--- a/ospf6d/ospf6_abr.h
+++ b/ospf6d/ospf6_abr.h
@@ -24,6 +24,8 @@
 
 /* for struct ospf6_route */
 #include "ospf6_route.h"
+/* for struct ospf6_prefix */
+#include "ospf6_proto.h"
 
 /* Debug option */
 extern unsigned char conf_debug_ospf6_abr;
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 4b4ca13..9b70422 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -518,13 +518,11 @@
        "Filter networks sent from this area\n")
 {
   struct ospf6_area *area;
-  struct prefix_list *plist;
 
   OSPF6_CMD_AREA_GET (argv[0], area);
   argc--;
   argv++;
 
-  plist = prefix_list_lookup (AFI_IP6, argv[0]);
   if (strncmp (argv[1], "in", 2) == 0)
     {
       if (PREFIX_NAME_IN (area))
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 6ba6cdf..b1620d4 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -58,18 +58,13 @@
 {
   char buffer[OSPF6_MAX_LSASIZE];
   struct ospf6_lsa_header *lsa_header;
-  struct ospf6_lsa *old, *lsa;
+  struct ospf6_lsa *lsa;
   struct ospf6_external_info *info = route->route_option;
 
   struct ospf6_as_external_lsa *as_external_lsa;
   char buf[64];
   caddr_t p;
 
-  /* find previous LSA */
-  old = ospf6_lsdb_lookup (htons (OSPF6_LSTYPE_AS_EXTERNAL),
-                           route->path.origin.id, ospf6->router_id,
-                           ospf6->lsdb);
-
   if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE (AS_EXTERNAL))
     {
       prefix2str (&route->prefix, buf, sizeof (buf));
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index f0ef790..772caff 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1283,7 +1283,6 @@
 {
   struct ospf6_interface *oi;
   struct interface *ifp;
-  unsigned long int lcost;
 
   ifp = (struct interface *) vty->index;
   assert (ifp);
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 2e61535..e57306b 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -493,7 +493,7 @@
   vty_out (vty, "Flag: %x %s", lsa->flag, VNL);
   vty_out (vty, "Lock: %d %s", lsa->lock, VNL);
   vty_out (vty, "ReTx Count: %d%s", lsa->retrans_count, VNL);
-  vty_out (vty, "Threads: Expire: %x, Refresh: %x %s",
+  vty_out (vty, "Threads: Expire: 0x%p, Refresh: 0x%p %s",
 	   lsa->expire, lsa->refresh, VNL);
   vty_out (vty, "%s", VNL);
   return;
diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index 7f6c6c5..f20c83b 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -46,6 +46,31 @@
 { "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange",
   "Loading", "Full", NULL };
 
+static const char *ospf6_neighbor_event_str[] =
+  {
+    "NoEvent",
+    "HelloReceived",
+    "2-WayReceived",
+    "NegotiationDone",
+    "ExchangeDone",
+    "LoadingDone",
+    "AdjOK?",
+    "SeqNumberMismatch",
+    "BadLSReq",
+    "1-WayReceived",
+    "InactivityTimer",
+  };
+
+static const char *
+ospf6_neighbor_event_string (int event)
+{
+  #define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent"
+
+  if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT)
+      return ospf6_neighbor_event_str[event];
+  return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING;
+}
+
 int
 ospf6_neighbor_cmp (void *va, void *vb)
 {
diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h
index 65c43fd..93ffa28 100644
--- a/ospf6d/ospf6_neighbor.h
+++ b/ospf6d/ospf6_neighbor.h
@@ -122,33 +122,8 @@
 #define OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER    10
 #define OSPF6_NEIGHBOR_EVENT_MAX_EVENT           11
 
-static const char *ospf6_neighbor_event_str[] =
-  {
-    "NoEvent",
-    "HelloReceived",
-    "2-WayReceived",
-    "NegotiationDone",
-    "ExchangeDone",
-    "LoadingDone",
-    "AdjOK?",
-    "SeqNumberMismatch",
-    "BadLSReq",
-    "1-WayReceived",
-    "InactivityTimer",
-  };
-
-static const char *ospf6_neighbor_event_string (int event)
-{
-  #define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent"
-
-  if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT)
-      return ospf6_neighbor_event_str[event];
-  return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING;
-}
-
 extern const char *ospf6_neighbor_state_str[];
 
-
 /* Function Prototypes */
 int ospf6_neighbor_cmp (void *va, void *vb);
 void ospf6_neighbor_dbex_init (struct ospf6_neighbor *on);
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index 74cfbec..e0be38b 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -37,18 +37,8 @@
 struct in6_addr allspfrouters6;
 struct in6_addr alldrouters6;
 
-/* setsockopt ReUseAddr to on */
-void
-ospf6_set_reuseaddr (void)
-{
-  u_int on = 0;
-  if (setsockopt (ospf6_sock, SOL_SOCKET, SO_REUSEADDR, &on,
-                  sizeof (u_int)) < 0)
-    zlog_warn ("Network: set SO_REUSEADDR failed: %s", safe_strerror (errno));
-}
-
 /* setsockopt MulticastLoop to off */
-void
+static void
 ospf6_reset_mcastloop (void)
 {
   u_int off = 0;
@@ -58,13 +48,13 @@
                safe_strerror (errno));
 }
 
-void
+static void
 ospf6_set_pktinfo (void)
 {
   setsockopt_ipv6_pktinfo (ospf6_sock, 1);
 }
 
-void
+static void
 ospf6_set_transport_class (void)
 {
 #ifdef IPTOS_PREC_INTERNETCONTROL
@@ -72,7 +62,7 @@
 #endif
 }
 
-void
+static void
 ospf6_set_checksum (void)
 {
   int offset = 12;
diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h
index 947834d..127bf45 100644
--- a/ospf6d/ospf6_network.h
+++ b/ospf6d/ospf6_network.h
@@ -28,12 +28,6 @@
 extern struct in6_addr allspfrouters6;
 extern struct in6_addr alldrouters6;
 
-/* Function Prototypes */
-extern void ospf6_set_reuseaddr (void);
-extern void ospf6_reset_mcastloop (void);
-extern void ospf6_set_pktinfo (void);
-extern void ospf6_set_checksum (void);
-
 extern int ospf6_serv_sock (void);
 extern void ospf6_sso (u_int ifindex, struct in6_addr *group, int option);
 
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h
index b384824..c0dcf9f 100644
--- a/ospf6d/ospf6_route.h
+++ b/ospf6d/ospf6_route.h
@@ -122,6 +122,10 @@
   /* Destination Type */
   u_char type;
 
+  /* XXX: It would likely be better to use separate struct in_addr's
+   * for the advertising router-ID and prefix IDs, instead of stuffing them
+   * into one. See also XXX below.
+   */
   /* Destination ID */
   struct prefix prefix;
 
@@ -235,6 +239,7 @@
            sizeof (struct ospf6_nexthop) * OSPF6_MULTI_PATH_LIMIT) == 0)
 #define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST))
 
+/* XXX: This gives GCC heartburn aboutbreaking aliasing rules. */
 #define ospf6_linkstate_prefix_adv_router(x) \
   (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0]))
 #define ospf6_linkstate_prefix_id(x) \
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index 3ef5485..d0e9101 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -40,6 +40,7 @@
 #include "ospf6_intra.h"
 #include "ospf6_interface.h"
 #include "ospf6d.h"
+#include "ospf6_abr.h"
 
 unsigned char conf_debug_ospf6_spf = 0;
 
@@ -391,7 +392,7 @@
 
 void ospf6_spf_reason_string (unsigned int reason, char *buf, int size)
 {
-  int bit;
+  size_t bit;
   int len = 0;
 
   if (!buf)
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 7191270..e4e6f17 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -180,6 +180,7 @@
 }
 
 static void
+__attribute__((unused))
 ospf6_enable (struct ospf6 *o)
 {
   struct listnode *node, *nnode;
@@ -219,7 +220,7 @@
     }
 }
 
-int
+static int
 ospf6_maxage_remover (struct thread *thread)
 {
   struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread);
@@ -471,14 +472,11 @@
        "OSPF6 area ID in IPv4 address notation\n"
        )
 {
-  struct ospf6 *o;
   struct ospf6_interface *oi;
   struct ospf6_area *oa;
   struct interface *ifp;
   u_int32_t area_id;
 
-  o = (struct ospf6 *) vty->index;
-
   ifp = if_lookup_by_name (argv[0]);
   if (ifp == NULL)
     {
diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c
index fae942e..cbb234a 100644
--- a/ospfd/ospf_api.c
+++ b/ospfd/ospf_api.c
@@ -464,7 +464,7 @@
 {
   u_char buf[OSPF_API_MAX_MSG_SIZE];
   struct msg_register_event *emsg;
-  int len;
+  size_t len;
 
   emsg = (struct msg_register_event *) buf;
   len = sizeof (struct msg_register_event) +
@@ -483,7 +483,7 @@
 {
   u_char buf[OSPF_API_MAX_MSG_SIZE];
   struct msg_sync_lsdb *smsg;
-  int len;
+  size_t len;
 
   smsg = (struct msg_sync_lsdb *) buf;
   len = sizeof (struct msg_sync_lsdb) +
@@ -504,7 +504,7 @@
 			   struct in_addr area_id, struct lsa_header *data)
 {
   struct msg_originate_request *omsg;
-  int omsglen;
+  size_t omsglen;
   char buf[OSPF_API_MAX_MSG_SIZE];
 
   omsg = (struct msg_originate_request *) buf;
@@ -630,7 +630,7 @@
 {
   u_char buf[OSPF_API_MAX_MSG_SIZE];
   struct msg_lsa_change_notify *nmsg;
-  int len;
+  size_t len;
 
   assert (data);
 
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 8bfcaa8..97fcffd 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -4034,7 +4034,6 @@
 show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)
 {
   struct route_node *rn;
-  struct ospf_lsa *lsa;
 
   vty_out (vty, "%s                MaxAge Link States:%s%s",
            VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
diff --git a/ripd/ripd.c b/ripd/ripd.c
index c69ef7f..9d355ec 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1737,16 +1737,6 @@
       ntohs (rte->family) == 0 &&
       ntohl (rte->metric) == RIP_METRIC_INFINITY)
     {	
-      struct prefix_ipv4 saddr;
-
-      /* saddr will be used for determining which routes to split-horizon.
-         Since the source address we'll pick will be on the same subnet as the
-         destination, for the purpose of split-horizoning, we'll
-         pretend that "from" is our source address.  */
-      saddr.family = AF_INET;
-      saddr.prefixlen = IPV4_MAX_BITLEN;
-      saddr.prefix = from->sin_addr;
-
       /* All route with split horizon */
       rip_output_process (ifc, from, rip_all_route, packet->version);
     }
@@ -3262,7 +3252,6 @@
 {
   int ret;
   struct prefix_ipv4 p;
-  u_char distance;
   struct route_node *rn;
   struct rip_distance *rdistance;
 
@@ -3273,8 +3262,6 @@
       return CMD_WARNING;
     }
 
-  distance = atoi (distance_str);
-
   rn = route_node_lookup (rip_distance_table, (struct prefix *)&p);
   if (! rn)
     {
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index 6403830..43c63a8 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -638,7 +638,6 @@
 {
   struct listnode *node, *nnode;
   struct in_addr ip; 
-  int pref;
   int ret;
   struct interface *ifp;
   struct zebra_if *zi;
@@ -657,8 +656,6 @@
   if (!ret) 
     return CMD_WARNING;
 
-  pref = atoi(argv[1]);
-
   for (ALL_LIST_ELEMENTS (irdp->AdvPrefList, node, nnode, adv))
     {
       if(adv->ip.s_addr == ip.s_addr )
diff --git a/zebra/router-id.c b/zebra/router-id.c
index b738027..94a2941 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -41,8 +41,13 @@
 #include "zebra/router-id.h"
 #include "zebra/redistribute.h"
 
-static struct list rid_all_sorted_list;
-static struct list rid_lo_sorted_list;
+/* 2nd pointer type used primarily to quell a warning on 
+ * ALL_LIST_ELEMENTS_RO
+ */
+static struct list _rid_all_sorted_list;
+static struct list _rid_lo_sorted_list;
+static struct list *rid_all_sorted_list = &_rid_all_sorted_list;
+static struct list *rid_lo_sorted_list = &_rid_lo_sorted_list;
 static struct prefix rid_user_assigned;
 
 /* master zebra server structure */
@@ -86,15 +91,15 @@
 
   if (rid_user_assigned.u.prefix4.s_addr)
     p->u.prefix4.s_addr = rid_user_assigned.u.prefix4.s_addr;
-  else if (!list_isempty (&rid_lo_sorted_list))
+  else if (!list_isempty (rid_lo_sorted_list))
     {
-      node = listtail (&rid_lo_sorted_list);
+      node = listtail (rid_lo_sorted_list);
       c = listgetdata (node);
       p->u.prefix4.s_addr = c->address->u.prefix4.s_addr;
     }
-  else if (!list_isempty (&rid_all_sorted_list))
+  else if (!list_isempty (rid_all_sorted_list))
     {
-      node = listtail (&rid_all_sorted_list);
+      node = listtail (rid_all_sorted_list);
       c = listgetdata (node);
       p->u.prefix4.s_addr = c->address->u.prefix4.s_addr;
     }
@@ -131,9 +136,9 @@
 
   if (!strncmp (ifc->ifp->name, "lo", 2)
       || !strncmp (ifc->ifp->name, "dummy", 5))
-    l = &rid_lo_sorted_list;
+    l = rid_lo_sorted_list;
   else
-    l = &rid_all_sorted_list;
+    l = rid_all_sorted_list;
   
   if (!router_id_find_node (l, ifc))
     listnode_add_sort (l, ifc);
@@ -164,9 +169,9 @@
 
   if (!strncmp (ifc->ifp->name, "lo", 2)
       || !strncmp (ifc->ifp->name, "dummy", 5))
-    l = &rid_lo_sorted_list;
+    l = rid_lo_sorted_list;
   else
-    l = &rid_all_sorted_list;
+    l = rid_all_sorted_list;
 
   if ((c = router_id_find_node (l, ifc)))
     listnode_delete (l, c);
@@ -240,12 +245,12 @@
   install_element (CONFIG_NODE, &router_id_cmd);
   install_element (CONFIG_NODE, &no_router_id_cmd);
 
-  memset (&rid_all_sorted_list, 0, sizeof (rid_all_sorted_list));
-  memset (&rid_lo_sorted_list, 0, sizeof (rid_lo_sorted_list));
+  memset (rid_all_sorted_list, 0, sizeof (rid_all_sorted_list));
+  memset (rid_lo_sorted_list, 0, sizeof (rid_lo_sorted_list));
   memset (&rid_user_assigned, 0, sizeof (rid_user_assigned));
 
-  rid_all_sorted_list.cmp = router_id_cmp;
-  rid_lo_sorted_list.cmp = router_id_cmp;
+  rid_all_sorted_list->cmp = router_id_cmp;
+  rid_lo_sorted_list->cmp = router_id_cmp;
 
   rid_user_assigned.family = AF_INET;
   rid_user_assigned.prefixlen = 32;
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index f3cdcdc..12dbd1a 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1246,9 +1246,9 @@
 /* Utility function  comes from iproute2. 
    Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
 int
-addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
+addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, int alen)
 {
-  int len;
+  size_t len;
   struct rtattr *rta;
 
   len = RTA_LENGTH (alen);
@@ -1288,9 +1288,9 @@
 /* Utility function comes from iproute2. 
    Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
 int
-addattr32 (struct nlmsghdr *n, int maxlen, int type, int data)
+addattr32 (struct nlmsghdr *n, size_t maxlen, int type, int data)
 {
-  int len;
+  size_t len;
   struct rtattr *rta;
 
   len = RTA_LENGTH (4);
diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h
index 452b397..0facd49 100644
--- a/zebra/rt_netlink.h
+++ b/zebra/rt_netlink.h
@@ -27,9 +27,9 @@
 #define NL_PKT_BUF_SIZE 8192
 
 extern int
-addattr32 (struct nlmsghdr *n, int maxlen, int type, int data);
+addattr32 (struct nlmsghdr *n, size_t maxlen, int type, int data);
 extern int
-addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen);
+addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, int alen);
 
 extern int
 rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen);