Browse Source

Merge branch 'volatile/fix_warnings'

Thanks to Donald Sharp and Greg Troxel for providing feedback!

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter 4 years ago
parent
commit
dc684eb997
100 changed files with 490 additions and 560 deletions
  1. 1 1
      babeld/Makefile.am
  2. 2 2
      babeld/babeld.c
  3. 1 1
      bgpd/Makefile.am
  4. 2 2
      bgpd/bgp_aspath.c
  5. 0 1
      bgpd/bgp_attr.c
  6. 5 5
      bgpd/bgp_damp.c
  7. 2 2
      bgpd/bgp_ecommunity.c
  8. 4 60
      bgpd/bgp_route.c
  9. 7 7
      bgpd/bgp_routemap.c
  10. 20 18
      bgpd/bgp_snmp.c
  11. 1 1
      bgpd/bgp_table.h
  12. 1 1
      bgpd/bgp_vty.c
  13. 1 1
      buildtest.sh
  14. 66 48
      configure.ac
  15. 1 1
      isisd/Makefile.am
  16. 2 1
      isisd/isis_adjacency.c
  17. 4 3
      isisd/isis_bpf.c
  18. 1 2
      isisd/isis_circuit.c
  19. 2 0
      isisd/isis_circuit.h
  20. 4 4
      isisd/isis_lsp.c
  21. 10 95
      isisd/isis_pdu.c
  22. 4 6
      isisd/isis_pfpacket.c
  23. 7 6
      isisd/isis_spf.c
  24. 1 3
      isisd/isis_tlv.c
  25. 3 3
      isisd/isis_zebra.c
  26. 6 6
      isisd/isisd.c
  27. 12 12
      isisd/topology/spgrid.c
  28. 1 0
      lib/Makefile.am
  29. 3 2
      lib/buffer.c
  30. 1 1
      lib/command.c
  31. 1 0
      lib/distribute.h
  32. 10 6
      lib/keychain.c
  33. 5 3
      lib/smux.h
  34. 1 1
      lib/snmp.c
  35. 1 1
      lib/stream.c
  36. 1 1
      lib/table.h
  37. 3 3
      lib/vty.c
  38. 3 3
      lib/zclient.c
  39. 1 1
      lib/zclient.h
  40. 1 1
      ospf6d/Makefile.am
  41. 2 1
      ospf6d/ospf6_interface.c
  42. 7 6
      ospf6d/ospf6_intra.c
  43. 3 3
      ospf6d/ospf6_lsa.c
  44. 1 0
      ospf6d/ospf6_neighbor.c
  45. 17 12
      ospf6d/ospf6_route.c
  46. 4 5
      ospf6d/ospf6_route.h
  47. 2 1
      ospf6d/ospf6_snmp.c
  48. 6 5
      ospf6d/ospf6_spf.c
  49. 3 2
      ospf6d/ospf6_top.c
  50. 13 13
      ospf6d/ospf6d.h
  51. 1 0
      ospfclient/Makefile.am
  52. 1 0
      ospfd/Makefile.am
  53. 10 6
      ospfd/ospf_apiserver.c
  54. 2 2
      ospfd/ospf_ase.c
  55. 4 4
      ospfd/ospf_dump.c
  56. 3 2
      ospfd/ospf_flood.c
  57. 22 20
      ospfd/ospf_lsa.c
  58. 1 1
      ospfd/ospf_lsdb.c
  59. 4 3
      ospfd/ospf_packet.c
  60. 6 6
      ospfd/ospf_snmp.c
  61. 3 3
      ospfd/ospf_spf.c
  62. 1 1
      ospfd/ospf_te.c
  63. 2 2
      pimd/Makefile.am
  64. 4 4
      pimd/pim_cmd.c
  65. 2 1
      pimd/pim_igmpv3.c
  66. 1 0
      pimd/pim_int.c
  67. 2 1
      pimd/pim_pim.c
  68. 3 2
      pimd/pim_ssmpingd.c
  69. 2 0
      pimd/pim_zebra.c
  70. 1 1
      ripd/Makefile.am
  71. 3 3
      ripd/rip_snmp.c
  72. 1 1
      ripngd/Makefile.am
  73. 2 2
      ripngd/ripngd.c
  74. 2 2
      tests/Makefile.am
  75. 1 1
      tests/bgp_mp_attr_test.c
  76. 1 1
      tests/bgp_mpath_test.c
  77. 1 1
      tests/ecommunity_test.c
  78. 2 0
      tests/heavy-thread.c
  79. 2 0
      tests/heavy-wq.c
  80. 2 0
      tests/heavy.c
  81. 1 1
      tests/main.c
  82. 0 35
      tests/test-checksum.c
  83. 1 1
      tests/test-segv.c
  84. 3 3
      tests/test-sig.c
  85. 6 3
      tests/test-timer-correctness.c
  86. 31 0
      tests/tests.h
  87. 1 1
      vtysh/Makefile.am
  88. 12 15
      vtysh/vtysh.c
  89. 9 9
      vtysh/vtysh_config.c
  90. 10 13
      vtysh/vtysh_main.c
  91. 12 7
      vtysh/vtysh_user.c
  92. 2 1
      vtysh/vtysh_user.h
  93. 1 1
      watchquagga/Makefile.am
  94. 20 13
      watchquagga/watchquagga.c
  95. 1 1
      zebra/Makefile.am
  96. 2 3
      zebra/if_netlink.c
  97. 1 0
      zebra/if_sysctl.c
  98. 23 18
      zebra/interface.c
  99. 2 2
      zebra/ioctl.c
  100. 0 0
      zebra/kernel_socket.c

+ 1 - 1
babeld/Makefile.am

@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = libbabel.a

+ 2 - 2
babeld/babeld.c

@@ -328,8 +328,8 @@ babel_main_loop(struct thread *thread)
         /* if there is no timeout, we must wait. */
         if(timeval_compare(&tv, &babel_now) > 0) {
             timeval_minus(&tv, &tv, &babel_now);
-            debugf(BABEL_DEBUG_TIMEOUT, "babel main loop : timeout: %ld msecs",
-                   tv.tv_sec * 1000 + tv.tv_usec / 1000);
+            debugf(BABEL_DEBUG_TIMEOUT, "babel main loop : timeout: %lld msecs",
+                   tv.tv_sec * 1000LL + tv.tv_usec / 1000LL);
             /* it happens often to have less than 1 ms, it's bad. */
             timeval_add_msec(&tv, &tv, 300);
             babel_set_timer(&tv);

+ 1 - 1
bgpd/Makefile.am

@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = libbgp.a

+ 2 - 2
bgpd/bgp_aspath.c

@@ -1378,7 +1378,7 @@ static struct aspath *
 aspath_add_asns (struct aspath *aspath, as_t asno, u_char type, unsigned num)
 {
   struct assegment *assegment = aspath->segments;
-  int i;
+  unsigned i;
 
   if (assegment && assegment->type == type)
     {
@@ -1913,7 +1913,7 @@ aspath_show_all_iterator (struct hash_backet *backet, struct vty *vty)
 
   as = (struct aspath *) backet->data;
 
-  vty_out (vty, "[%p:%u] (%ld) ", backet, backet->key, as->refcnt);
+  vty_out (vty, "[%p:%u] (%ld) ", (void *)backet, backet->key, as->refcnt);
   vty_out (vty, "%s%s", as->str, VTY_NEWLINE);
 }
 

+ 0 - 1
bgpd/bgp_attr.c

@@ -72,7 +72,6 @@ static const struct message attr_flag_str[] =
   /* bgp_attr_flags_diagnose() relies on this bit being last in this list */
   { BGP_ATTR_FLAG_EXTLEN,   "Extended Length" },
 };
-static const size_t attr_flag_str_max = array_size(attr_flag_str);
 
 static struct hash *cluster_hash;
 

+ 5 - 5
bgpd/bgp_damp.c

@@ -529,15 +529,15 @@ bgp_config_write_damp (struct vty *vty)
 	   && bgp_damp_cfg.reuse_limit == DEFAULT_REUSE
 	   && bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS
 	   && bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4)
-    vty_out (vty, " bgp dampening %ld%s",
-	     bgp_damp_cfg.half_life/60,
+    vty_out (vty, " bgp dampening %lld%s",
+	     bgp_damp_cfg.half_life/60LL,
 	     VTY_NEWLINE);
   else
-    vty_out (vty, " bgp dampening %ld %d %d %ld%s",
-	     bgp_damp_cfg.half_life/60,
+    vty_out (vty, " bgp dampening %lld %d %d %lld%s",
+	     bgp_damp_cfg.half_life/60LL,
 	     bgp_damp_cfg.reuse_limit,
 	     bgp_damp_cfg.suppress_value,
-	     bgp_damp_cfg.max_suppress_time/60,
+	     bgp_damp_cfg.max_suppress_time/60LL,
 	     VTY_NEWLINE);
 }
 

+ 2 - 2
bgpd/bgp_ecommunity.c

@@ -281,10 +281,10 @@ ecommunity_finish (void)
 /* Extended Communities token enum. */
 enum ecommunity_token
 {
+  ecommunity_token_unknown = 0,
   ecommunity_token_rt,
   ecommunity_token_soo,
   ecommunity_token_val,
-  ecommunity_token_unknown
 };
 
 /* Get next Extended Communities token from the string. */
@@ -511,7 +511,7 @@ struct ecommunity *
 ecommunity_str2com (const char *str, int type, int keyword_included)
 {
   struct ecommunity *ecom = NULL;
-  enum ecommunity_token token;
+  enum ecommunity_token token = ecommunity_token_unknown;
   struct ecommunity_val eval;
   int keyword = 0;
 

+ 4 - 60
bgpd/bgp_route.c

@@ -1666,9 +1666,10 @@ bgp_process_queue_init (void)
   bm->process_main_queue->spec.max_retries = 0;
   bm->process_main_queue->spec.hold = 50;
   
-  memcpy (bm->process_rsclient_queue, bm->process_main_queue,
-          sizeof (struct work_queue *));
   bm->process_rsclient_queue->spec.workfunc = &bgp_process_rsclient;
+  bm->process_rsclient_queue->spec.del_item_data = &bgp_processq_del;
+  bm->process_rsclient_queue->spec.max_retries = 0;
+  bm->process_rsclient_queue->spec.hold = 50;
 }
 
 void
@@ -7905,19 +7906,13 @@ ALIAS (show_ip_bgp_ipv4_community,
 
 DEFUN (show_bgp_view_afi_safi_community_all,
        show_bgp_view_afi_safi_community_all_cmd,
-#ifdef HAVE_IPV6
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community",
-#else
-       "show bgp view WORD ipv4 (unicast|multicast) community",
-#endif
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-#ifdef HAVE_IPV6
        "Address family\n"
-#endif
        "Address Family modifier\n"
        "Address Family modifier\n"
        "Display routes matching the communities\n")
@@ -7934,31 +7929,20 @@ DEFUN (show_bgp_view_afi_safi_community_all,
       return CMD_WARNING;
     }
 
-#ifdef HAVE_IPV6
   afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
   safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
-#else
-  afi = AFI_IP;
-  safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
-#endif
   return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL);
 }
 
 DEFUN (show_bgp_view_afi_safi_community,
        show_bgp_view_afi_safi_community_cmd,
-#ifdef HAVE_IPV6
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
-#else
-       "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
-#endif
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-#ifdef HAVE_IPV6
        "Address family\n"
-#endif
        "Address family modifier\n"
        "Address family modifier\n"
        "Display routes matching the communities\n"
@@ -7970,32 +7954,20 @@ DEFUN (show_bgp_view_afi_safi_community,
   int afi;
   int safi;
 
-#ifdef HAVE_IPV6
   afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
   safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
   return bgp_show_community (vty, argv[0], argc-3, &argv[3], 0, afi, safi);
-#else
-  afi = AFI_IP;
-  safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
-  return bgp_show_community (vty, argv[0], argc-2, &argv[2], 0, afi, safi);
-#endif
 }
 
 ALIAS (show_bgp_view_afi_safi_community,
        show_bgp_view_afi_safi_community2_cmd,
-#ifdef HAVE_IPV6
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#else
-       "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#endif
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-#ifdef HAVE_IPV6
        "Address family\n"
-#endif
        "Address family modifier\n"
        "Address family modifier\n"
        "Display routes matching the communities\n"
@@ -8010,19 +7982,13 @@ ALIAS (show_bgp_view_afi_safi_community,
 
 ALIAS (show_bgp_view_afi_safi_community,
        show_bgp_view_afi_safi_community3_cmd,
-#ifdef HAVE_IPV6
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#else
-       "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#endif
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-#ifdef HAVE_IPV6
        "Address family\n"
-#endif
        "Address family modifier\n"
        "Address family modifier\n"
        "Display routes matching the communities\n"
@@ -8041,19 +8007,13 @@ ALIAS (show_bgp_view_afi_safi_community,
 
 ALIAS (show_bgp_view_afi_safi_community,
        show_bgp_view_afi_safi_community4_cmd,
-#ifdef HAVE_IPV6
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#else
-       "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#endif
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-#ifdef HAVE_IPV6
        "Address family\n"
-#endif
        "Address family modifier\n"
        "Address family modifier\n"
        "Display routes matching the communities\n"
@@ -10199,19 +10159,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
 
 DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
        show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd,
-#ifdef HAVE_IPV6
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)",
-#else
-       "show bgp view WORD ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)",
-#endif
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-#ifdef HAVE_IPV6
        "Address family\n"
-#endif
        "Address family modifier\n"
        "Address family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
@@ -10225,24 +10179,14 @@ DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
   int in;
   struct peer *peer;
 
-#ifdef HAVE_IPV6
-    peer = peer_lookup_in_view (vty, argv[0], argv[3]);
-#else
-    peer = peer_lookup_in_view (vty, argv[0], argv[2]);
-#endif
+  peer = peer_lookup_in_view (vty, argv[0], argv[3]);
 
   if (! peer)
     return CMD_WARNING;
 
-#ifdef HAVE_IPV6
   afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
   safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
   in = (strncmp (argv[4], "r", 1) == 0) ? 1 : 0;
-#else
-  afi = AFI_IP;
-  safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
-  in = (strncmp (argv[3], "r", 1) == 0) ? 1 : 0;
-#endif
 
   return peer_adj_routes (vty, peer, afi, safi, in);
 }

+ 7 - 7
bgpd/bgp_routemap.c

@@ -131,8 +131,8 @@ route_match_peer (void *rule, struct prefix *prefix, route_map_object_t type,
       void *object)
 {
   union sockunion *su;
-  union sockunion su_def = { .sa.sa_family = AF_INET,
-			     .sin.sin_addr.s_addr = INADDR_ANY };
+  union sockunion su_def = { .sin = { .sin_family = AF_INET,
+                                      .sin_addr.s_addr = INADDR_ANY } };
   struct peer_group *group;
   struct peer *peer;
   struct listnode *node, *nnode;
@@ -826,12 +826,12 @@ route_match_probability (void *rule, struct prefix *prefix,
   r = (long) rand();
 #endif
 
-  switch (*(unsigned *) rule)
+  switch (*(long *) rule)
   {
     case 0: break;
     case RAND_MAX: return RMAP_MATCH;
     default:
-      if (r < *(unsigned *) rule)
+      if (r < *(long *) rule)
         {
           return RMAP_MATCH;
         }
@@ -843,7 +843,7 @@ route_match_probability (void *rule, struct prefix *prefix,
 static void *
 route_match_probability_compile (const char *arg)
 {
-  unsigned *lobule;
+  long *lobule;
   unsigned  perc;
 
 #if _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500
@@ -853,7 +853,7 @@ route_match_probability_compile (const char *arg)
 #endif
 
   perc    = atoi (arg);
-  lobule  = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned));
+  lobule  = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (long));
 
   switch (perc)
     {
@@ -3163,7 +3163,7 @@ ALIAS (set_aspath_prepend,
        "Transform BGP AS_PATH attribute\n"
        "Prepend to the as-path\n"
        "Use the peer's AS-number\n"
-       "Number of times to insert");
+       "Number of times to insert")
 
 DEFUN (no_set_aspath_prepend,
        no_set_aspath_prepend_cmd,

+ 20 - 18
bgpd/bgp_snmp.c

@@ -337,38 +337,42 @@ bgp_peer_lookup_next (struct in_addr *src)
   return NULL;
 }
 
+/* 1.3.6.1.2.1.15.3.1.x  = 10 */
+#define PEERTAB_NAMELEN 10
+
 static struct peer *
 bgpPeerTable_lookup (struct variable *v, oid name[], size_t *length, 
 		     struct in_addr *addr, int exact)
 {
   struct peer *peer = NULL;
+  size_t namelen = v ? v->namelen : PEERTAB_NAMELEN;
   int len;
 
   if (exact)
     {
       /* Check the length. */
-      if (*length - v->namelen != sizeof (struct in_addr))
+      if (*length - namelen != sizeof (struct in_addr))
 	return NULL;
 
-      oid2in_addr (name + v->namelen, IN_ADDR_SIZE, addr);
+      oid2in_addr (name + namelen, IN_ADDR_SIZE, addr);
 
       peer = peer_lookup_addr_ipv4 (addr);
       return peer;
     }
   else
     {
-      len = *length - v->namelen;
+      len = *length - namelen;
       if (len > 4) len = 4;
       
-      oid2in_addr (name + v->namelen, len, addr);
+      oid2in_addr (name + namelen, len, addr);
       
       peer = bgp_peer_lookup_next (addr);
 
       if (peer == NULL)
 	return NULL;
 
-      oid_copy_addr (name + v->namelen, addr, sizeof (struct in_addr));
-      *length = sizeof (struct in_addr) + v->namelen;
+      oid_copy_addr (name + namelen, addr, sizeof (struct in_addr));
+      *length = sizeof (struct in_addr) + namelen;
 
       return peer;
     }
@@ -379,14 +383,12 @@ bgpPeerTable_lookup (struct variable *v, oid name[], size_t *length,
 static int
 write_bgpPeerTable (int action, u_char *var_val,
 		    u_char var_val_type, size_t var_val_len,
-		    u_char *statP, oid *name, size_t length,
-		    struct variable *v)
+		    u_char *statP, oid *name, size_t length)
 {
   struct in_addr addr;
   struct peer *peer;
   long intval;
-  size_t bigsize = SNMP_MAX_LEN;
-  
+
   if (var_val_type != ASN_INTEGER) 
     {
       return SNMP_ERR_WRONGTYPE;
@@ -396,21 +398,21 @@ write_bgpPeerTable (int action, u_char *var_val,
       return SNMP_ERR_WRONGLENGTH;
     }
 
-  if (! asn_parse_int(var_val, &bigsize, &var_val_type,
-                      &intval, sizeof(long)))
-    {
-      return SNMP_ERR_WRONGENCODING;
-    }
+  intval = *(long *)var_val;
 
   memset (&addr, 0, sizeof (struct in_addr));
 
-  peer = bgpPeerTable_lookup (v, name, &length, &addr, 1);
+  peer = bgpPeerTable_lookup (NULL, name, &length, &addr, 1);
   if (! peer)
     return SNMP_ERR_NOSUCHNAME;
 
-  printf ("val: %ld\n", intval);
+  if (action != SNMP_MSG_INTERNAL_SET_COMMIT)
+    return SNMP_ERR_NOERROR;
 
-  switch (v->magic)
+  zlog_info ("%s: SNMP write .%ld = %ld",
+             peer->host, (long)name[PEERTAB_NAMELEN - 1], intval);
+
+  switch (name[PEERTAB_NAMELEN - 1])
     {
     case BGPPEERADMINSTATUS:
 #define BGP_PeerAdmin_stop  1

+ 1 - 1
bgpd/bgp_table.h

@@ -55,7 +55,7 @@ struct bgp_node
    * @see bgp_node_to_rnode
    * @see bgp_node_from_rnode
    */
-  ROUTE_NODE_FIELDS;
+  ROUTE_NODE_FIELDS
 
   struct bgp_adj_out *adj_out;
 

+ 1 - 1
bgpd/bgp_vty.c

@@ -8235,7 +8235,7 @@ community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
   struct community *com;
 
   com = (struct community *) backet->data;
-  vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
+  vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
 	   community_str (com), VTY_NEWLINE);
 }
 

+ 1 - 1
buildtest.sh

@@ -4,7 +4,7 @@
 # builds some git commit of Quagga in some different configurations
 # usage: buildtest.sh [commit [configurations...]]
 
-basecfg="--prefix=/usr --enable-user=quagga --enable-group=quagga --enable-vty-group=quagga --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/quagga --enable-exampledir=/etc/quagga/samples --localstatedir=/var/run/quagga --libdir=/usr/lib64/quagga --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-babeld --enable-pimd"
+basecfg="--prefix=/usr --enable-user=quagga --enable-group=quagga --enable-vty-group=quagga --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/quagga --enable-exampledir=/etc/quagga/samples --localstatedir=/var/run/quagga --libdir=/usr/lib64/quagga --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-babeld --enable-pimd --enable-werror"
 
 configs_base="gcc|$basecfg"
 

+ 66 - 48
configure.ac

@@ -86,20 +86,7 @@ else
 fi
 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
 
-dnl ------------------------------------------------------------------
-dnl Intel compiler check. Although Intel tries really hard to make icc
-dnl look like gcc, there are some differences. It's very verbose with
-dnl -Wall and it doesn't support the individual -W options.
-dnl ------------------------------------------------------------------
-if test "x${GCC}" = "xyes" ; then
-  COMPILER="GCC"
-  AC_MSG_CHECKING([whether we are using the Intel compiler])
-  AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
-      [AC_MSG_RESULT([no])],
-      [COMPILER="ICC"
-       AC_MSG_RESULT([yes])]
-  )
-else
+if test "x${GCC}" != "xyes" ; then
   AC_MSG_CHECKING([whether we are using SunPro compiler])
   AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
       [AC_MSG_RESULT([no])],
@@ -115,47 +102,84 @@ dnl already, eg "-O2 -g" for gcc, "-g" for others
 dnl (Wall is gcc specific... have to make sure
 dnl  gcc is being used before setting it)
 dnl
-dnl Intel icc 8.0 also sets __GNUC__, 
-dnl but doesn't support all these fancy -W options.
-dnl Intel compiler warnings we ignore:
-dnl 279: controlling expression is constant.
-dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
-dnl      about "self", "vty", "argc" and "argv" never referenced in DEFUN
-dnl      macro.
-dnl 981: operands are evaluated in unspecified order.
-dnl
 dnl Sun Studio 10 / SunPro 5.7 is also supported,
 dnl so lets set some sane CFLAGS for it.
 dnl ---------------------------------------------
 
+AC_USE_SYSTEM_EXTENSIONS()
+AC_DEFUN([AC_C_FLAG], [{
+	AC_LANG_PUSH(C)
+	ac_c_flag_save="$CFLAGS"
+	CFLAGS="$CFLAGS $1"
+	AC_MSG_CHECKING([[whether $CC supports $1]])
+	AC_COMPILE_IFELSE(
+		[AC_LANG_PROGRAM([[]])],
+		[
+			AC_MSG_RESULT([yes])
+			m4_if([$3], [], [], [
+				CFLAGS="$ac_c_flag_save"
+				$3
+			])
+		], [
+			CFLAGS="$ac_c_flag_save"
+			AC_MSG_RESULT([no])
+			$2
+		])
+	AC_LANG_POP(C)
+	}])
+
 AC_MSG_CHECKING([whether to set a default CFLAGS])
 if test "x${cflags_specified}" = "x" ; then
   case ${COMPILER} in
-    "ICC")
-        CFLAGS="-Os -g -Wall"
-        AC_MSG_RESULT([Intel default])
-        ;;
-    "GCC")
-  	CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
-  	CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
-  	CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
-  	CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
-  	CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
-  	# TODO: conditionally addd -Wpacked if handled
-  	AC_MSG_RESULT([gcc default])
-  	;;
     "SUNPRO")
-  	CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
-  	AC_MSG_RESULT([SunPro default])
-  	;;
+        CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
+        AC_MSG_RESULT([SunPro default])
+        ;;
     *)
-        AC_MSG_RESULT([unknown compiler])
+        AC_MSG_RESULT([autodetecting])
+
+        AC_C_FLAG([-diag-error 10006])
+        AC_C_FLAG([-std=gnu99])
+        AC_C_FLAG([-g])
+        AC_C_FLAG([-Os], [
+          AC_C_FLAG([-O2])
+        ])
+        AC_C_FLAG([-fno-omit-frame-pointer])
+        AC_C_FLAG([-Wall])
+        AC_C_FLAG([-Wextra])
+        AC_C_FLAG([-Wmissing-prototypes])
+        AC_C_FLAG([-Wmissing-declarations])
+        AC_C_FLAG([-Wpointer-arith])
+        AC_C_FLAG([-Wbad-function-cast])
+        AC_C_FLAG([-Wwrite-strings])
+        if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
+          AC_C_FLAG([-Wcast-qual])
+          AC_C_FLAG([-Wstrict-prototypes])
+          AC_C_FLAG([-Wmissing-noreturn])
+          AC_C_FLAG([-Wmissing-format-attribute])
+          AC_C_FLAG([-Wunreachable-code])
+          AC_C_FLAG([-Wpacked])
+          AC_C_FLAG([-Wpadded])
+        else
+          AC_C_FLAG([-Wno-unused-result])
+        fi
+        AC_C_FLAG([-Wno-unused-parameter])
+        AC_C_FLAG([-Wno-missing-field-initializers])
+        # ICC emits a broken warning for const char *x = a ? "b" : "c";
+        # for some reason the string consts get 'promoted' to char *,
+        # triggering a const to non-const conversion warning.
+        AC_C_FLAG([-diag-disable 3179])
         ;;
   esac
 else
   AC_MSG_RESULT([CFLAGS supplied by user])
 fi
 
+if test x"${enable_werror}" = x"yes" ; then
+  WERROR="-Werror"
+fi
+AC_SUBST(WERROR)
+
 dnl --------------
 dnl Check programs
 dnl --------------
@@ -277,13 +301,8 @@ AC_ARG_ENABLE(pcreposix,
   AS_HELP_STRING([--enable-pcreposix], [enable using PCRE Posix libs for regex functions]))
 AC_ARG_ENABLE(fpm,
   AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
-
-if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
-  CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
-  CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
-  CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
-  CFLAGS="${CFLAGS} -Wpacked -Wpadded"
-fi
+AC_ARG_ENABLE(werror,
+  AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
 
 if test x"${enable_gcc_rdynamic}" != x"no" ; then
   if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
@@ -422,7 +441,6 @@ dnl AC_TYPE_PID_T
 AC_TYPE_UID_T
 AC_TYPE_MODE_T
 AC_TYPE_SIZE_T
-AC_TYPE_SIGNAL
 AC_STRUCT_TM
 
 dnl -------------------------

+ 1 - 1
isisd/Makefile.am

@@ -6,7 +6,7 @@ DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 LIBS = @LIBS@ 
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = libisis.a

+ 2 - 1
isisd/isis_adjacency.c

@@ -396,7 +396,8 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail)
       vty_out (vty, "%-13s", adj_state2string (adj->adj_state));
       now = time (NULL);
       if (adj->last_upd)
-	vty_out (vty, "%-9lu", adj->last_upd + adj->hold_time - now);
+        vty_out (vty, "%-9llu",
+                 (unsigned long long)adj->last_upd + adj->hold_time - now);
       else
 	vty_out (vty, "-        ");
       vty_out (vty, "%-10s", snpa_print (adj->snpa));

+ 4 - 3
isisd/isis_bpf.c

@@ -301,13 +301,14 @@ int
 isis_send_pdu_bcast (struct isis_circuit *circuit, int level)
 {
   struct ether_header *eth;
-  int written, buflen;
+  ssize_t written;
+  size_t buflen;
 
   buflen = stream_get_endp (circuit->snd_stream) + LLC_LEN + ETHER_HDR_LEN;
   if (buflen > sizeof (sock_buff))
     {
-      zlog_warn ("isis_send_pdu_bcast: sock_buff size %lu is less than "
-		 "output pdu size %d on circuit %s",
+      zlog_warn ("isis_send_pdu_bcast: sock_buff size %zu is less than "
+		 "output pdu size %zu on circuit %s",
 		 sizeof (sock_buff), buflen, circuit->interface->name);
       return ISIS_WARNING;
     }

+ 1 - 2
isisd/isis_circuit.c

@@ -397,7 +397,7 @@ isis_circuit_id_gen (struct interface *ifp)
    */
   for (i = 0; i < strlen (ifp->name); i++)
     {
-      if (isdigit(ifp->name[i]))
+      if (isdigit((unsigned char)ifp->name[i]))
         {
           if (start < 0)
             {
@@ -1342,7 +1342,6 @@ DEFUN (no_ipv6_router_isis,
 {
   struct interface *ifp;
   struct isis_area *area;
-  struct listnode *node;
   struct isis_circuit *circuit;
 
   ifp = (struct interface *) vty->index;

+ 2 - 0
isisd/isis_circuit.h

@@ -23,6 +23,8 @@
 #ifndef ISIS_CIRCUIT_H
 #define ISIS_CIRCUIT_H
 
+#include "vty.h"
+
 #define CIRCUIT_MAX 255
 
 struct password

+ 4 - 4
isisd/isis_lsp.c

@@ -379,7 +379,7 @@ lsp_auth_update (struct isis_lsp *lsp)
   /* Compute autentication value */
   hmac_md5 (STREAM_DATA (lsp->pdu), stream_get_endp(lsp->pdu),
             (unsigned char *) &passwd->passwd, passwd->len,
-            (caddr_t) &hmac_md5_hash);
+            (unsigned char *) &hmac_md5_hash);
   /* Copy the hash into the stream */
   memcpy (STREAM_DATA (lsp->pdu) + lsp->auth_tlv_offset + 3,
           hmac_md5_hash, ISIS_AUTH_MD5_SIZE);
@@ -950,7 +950,7 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
       memcpy (in6.s6_addr, ipv6_reach->prefix,
 	      PSIZE (ipv6_reach->prefix_len));
       inet_ntop (AF_INET6, &in6, (char *)buff, BUFSIZ);
-      if ((ipv6_reach->control_info &&
+      if ((ipv6_reach->control_info &
 	   CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL)
 	vty_out (vty, "  Metric      : %-8d IPv6-Internal : %s/%d%s",
 		 ntohl (ipv6_reach->metric),
@@ -2396,7 +2396,7 @@ static int
 top_lsp_refresh (struct thread *thread)
 {
   struct isis_lsp *lsp;
-  u_int16_t rem_lifetime, refresh_time;
+  u_int16_t rem_lifetime;
 
   lsp = THREAD_ARG (thread);
   assert (lsp);
@@ -2420,7 +2420,7 @@ top_lsp_refresh (struct thread *thread)
   rem_lifetime = lsp_rem_lifetime (lsp->area, IS_LEVEL_1);
   lsp->lsp_header->rem_lifetime = htons (rem_lifetime);
 
-  refresh_time = lsp_refresh_time (lsp, rem_lifetime);
+  /* refresh_time = lsp_refresh_time (lsp, rem_lifetime); */
   THREAD_TIMER_ON (master, lsp->t_lsp_top_ref, top_lsp_refresh, lsp,
 		   lsp->area->lsp_refresh[0]);
 

+ 10 - 95
isisd/isis_pdu.c

@@ -204,7 +204,7 @@ authentication_check (struct isis_passwd *remote, struct isis_passwd *local,
       /* Compute the digest */
       hmac_md5 (STREAM_DATA (stream), stream_get_endp (stream),
                 (unsigned char *) &(local->passwd), local->len,
-                (caddr_t) &digest);
+                (unsigned char *) &digest);
       /* Copy back the authentication value after the check */
       memcpy (STREAM_DATA (stream) + auth_tlv_offset + 3,
               remote->passwd, ISIS_AUTH_MD5_SIZE);
@@ -1264,7 +1264,7 @@ out:
   if (isis->debugs & DEBUG_ADJ_PACKETS)
     {
       zlog_debug ("ISIS-Adj (%s): Rcvd L%d LAN IIH from %s on %s, cirType %s, "
-		  "cirID %u, length %ld",
+		  "cirID %u, length %zd",
 		  circuit->area->area_tag,
 		  level, snpa_print (ssnpa), circuit->interface->name,
 		  circuit_t2string (circuit->is_type),
@@ -1975,89 +1975,6 @@ process_psnp (int level, struct isis_circuit *circuit, u_char * ssnpa)
 }
 
 /*
- * Process ISH
- * ISO - 10589
- * Section 8.2.2 - Receiving ISH PDUs by an intermediate system
- * FIXME: sample packet dump, need to figure 0x81 - looks like NLPid
- *           0x82	0x15	0x01	0x00	0x04	0x01	0x2c	0x59
- *           0x38	0x08	0x47	0x00	0x01	0x00	0x02	0x00
- *           0x03	0x00	0x81	0x01	0xcc
- */
-static int
-process_is_hello (struct isis_circuit *circuit)
-{
-  struct isis_adjacency *adj;
-  int retval = ISIS_OK;
-  u_char neigh_len;
-  u_char *sysid;
-
-  if (isis->debugs & DEBUG_ADJ_PACKETS)
-    {
-      zlog_debug ("ISIS-Adj (%s): Rcvd ISH on %s, cirType %s, cirID %u",
-                  circuit->area->area_tag, circuit->interface->name,
-                  circuit_t2string (circuit->is_type), circuit->circuit_id);
-      if (isis->debugs & DEBUG_PACKET_DUMP)
-        zlog_dump_data (STREAM_DATA (circuit->rcv_stream),
-                        stream_get_endp (circuit->rcv_stream));
-    }
-
-  /* In this point in time we are not yet able to handle is_hellos
-   * on lan - Sorry juniper...
-   */
-  if (circuit->circ_type == CIRCUIT_T_BROADCAST)
-    return retval;
-
-  neigh_len = stream_getc (circuit->rcv_stream);
-  sysid = STREAM_PNT (circuit->rcv_stream) + neigh_len - 1 - ISIS_SYS_ID_LEN;
-  adj = circuit->u.p2p.neighbor;
-  if (!adj)
-    {
-      /* 8.2.2 */
-      adj = isis_new_adj (sysid, NULL, 0, circuit);
-      if (adj == NULL)
-	return ISIS_ERROR;
-
-      isis_adj_state_change (adj, ISIS_ADJ_INITIALIZING, NULL);
-      adj->sys_type = ISIS_SYSTYPE_UNKNOWN;
-      circuit->u.p2p.neighbor = adj;
-    }
-  /* 8.2.2 a) */
-  if ((adj->adj_state == ISIS_ADJ_UP) && memcmp (adj->sysid, sysid,
-						 ISIS_SYS_ID_LEN))
-    {
-      /* 8.2.2 a) 1) FIXME: adjStateChange(down) event */
-      /* 8.2.2 a) 2) delete the adj */
-      XFREE (MTYPE_ISIS_ADJACENCY, adj);
-      /* 8.2.2 a) 3) create a new adj */
-      adj = isis_new_adj (sysid, NULL, 0, circuit);
-      if (adj == NULL)
-	return ISIS_ERROR;
-
-      /* 8.2.2 a) 3) i */
-      isis_adj_state_change (adj, ISIS_ADJ_INITIALIZING, NULL);
-      /* 8.2.2 a) 3) ii */
-      adj->sys_type = ISIS_SYSTYPE_UNKNOWN;
-      /* 8.2.2 a) 4) quite meaningless */
-    }
-  /* 8.2.2 b) ignore on condition */
-  if ((adj->adj_state == ISIS_ADJ_INITIALIZING) &&
-      (adj->sys_type == ISIS_SYSTYPE_IS))
-    {
-      /* do nothing */
-    }
-  else
-    {
-      /* 8.2.2 c) respond with a p2p IIH */
-      send_hello (circuit, 1);
-    }
-  /* 8.2.2 d) type is IS */
-  adj->sys_type = ISIS_SYSTYPE_IS;
-  /* 8.2.2 e) FIXME: Circuit type of? */
-
-  return retval;
-}
-
-/*
  * PDU Dispatcher
  */
 
@@ -2321,7 +2238,7 @@ send_hello (struct isis_circuit *circuit, int level)
   struct isis_lan_hello_hdr hello_hdr;
   struct isis_p2p_hello_hdr p2p_hello_hdr;
   unsigned char hmac_md5_hash[ISIS_AUTH_MD5_SIZE];
-  unsigned long len_pointer, length, auth_tlv_offset = 0;
+  size_t len_pointer, length, auth_tlv_offset = 0;
   u_int32_t interval;
   int retval;
 
@@ -2469,7 +2386,7 @@ send_hello (struct isis_circuit *circuit, int level)
       hmac_md5 (STREAM_DATA (circuit->snd_stream),
                 stream_get_endp (circuit->snd_stream),
                 (unsigned char *) &circuit->passwd.passwd, circuit->passwd.len,
-                (caddr_t) &hmac_md5_hash);
+                (unsigned char *) &hmac_md5_hash);
       /* Copy the hash into the stream */
       memcpy (STREAM_DATA (circuit->snd_stream) + auth_tlv_offset + 3,
               hmac_md5_hash, ISIS_AUTH_MD5_SIZE);
@@ -2479,16 +2396,14 @@ send_hello (struct isis_circuit *circuit, int level)
     {
       if (circuit->circ_type == CIRCUIT_T_BROADCAST)
 	{
-	  zlog_debug ("ISIS-Adj (%s): Sent L%d LAN IIH on %s, length %ld",
+	  zlog_debug ("ISIS-Adj (%s): Sent L%d LAN IIH on %s, length %zd",
 		      circuit->area->area_tag, level, circuit->interface->name,
-		      /* FIXME: use %z when we stop supporting old compilers. */
 		      length);
 	}
       else
 	{
-	  zlog_debug ("ISIS-Adj (%s): Sent P2P IIH on %s, length %ld",
+	  zlog_debug ("ISIS-Adj (%s): Sent P2P IIH on %s, length %zd",
 		      circuit->area->area_tag, circuit->interface->name,
-		      /* FIXME: use %z when we stop supporting old compilers. */
 		      length);
 	}
       if (isis->debugs & DEBUG_PACKET_DUMP)
@@ -2656,7 +2571,7 @@ build_csnp (int level, u_char * start, u_char * stop, struct list *lsps,
       hmac_md5 (STREAM_DATA (circuit->snd_stream),
                 stream_get_endp(circuit->snd_stream),
                 (unsigned char *) &passwd->passwd, passwd->len,
-                (caddr_t) &hmac_md5_hash);
+                (unsigned char *) &hmac_md5_hash);
       /* Copy the hash into the stream */
       memcpy (STREAM_DATA (circuit->snd_stream) + auth_tlv_offset + 3,
               hmac_md5_hash, ISIS_AUTH_MD5_SIZE);
@@ -2801,7 +2716,7 @@ send_csnp (struct isis_circuit *circuit, int level)
 
       if (isis->debugs & DEBUG_SNP_PACKETS)
         {
-          zlog_debug ("ISIS-Snp (%s): Sent L%d CSNP on %s, length %ld",
+          zlog_debug ("ISIS-Snp (%s): Sent L%d CSNP on %s, length %zd",
                       circuit->area->area_tag, level, circuit->interface->name,
                       stream_get_endp (circuit->snd_stream));
           for (ALL_LIST_ELEMENTS_RO (list, node, lsp))
@@ -2992,7 +2907,7 @@ build_psnp (int level, struct isis_circuit *circuit, struct list *lsps)
       hmac_md5 (STREAM_DATA (circuit->snd_stream),
                 stream_get_endp(circuit->snd_stream),
                 (unsigned char *) &passwd->passwd, passwd->len,
-                (caddr_t) &hmac_md5_hash);
+                (unsigned char *) &hmac_md5_hash);
       /* Copy the hash into the stream */
       memcpy (STREAM_DATA (circuit->snd_stream) + auth_tlv_offset + 3,
               hmac_md5_hash, ISIS_AUTH_MD5_SIZE);
@@ -3050,7 +2965,7 @@ send_psnp (int level, struct isis_circuit *circuit)
 
       if (isis->debugs & DEBUG_SNP_PACKETS)
         {
-          zlog_debug ("ISIS-Snp (%s): Sent L%d PSNP on %s, length %ld",
+          zlog_debug ("ISIS-Snp (%s): Sent L%d PSNP on %s, length %zd",
                       circuit->area->area_tag, level,
                       circuit->interface->name,
                       stream_get_endp (circuit->snd_stream));

+ 4 - 6
isisd/isis_pfpacket.c

@@ -54,8 +54,8 @@ u_char ALL_L2_ISS[6] = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x15 };
 u_char ALL_ISS[6] = { 0x09, 0x00, 0x2B, 0x00, 0x00, 0x05 };
 u_char ALL_ESS[6] = { 0x09, 0x00, 0x2B, 0x00, 0x00, 0x04 };
 
-static char discard_buff[8192];
-static char sock_buff[8192];
+static uint8_t discard_buff[8192];
+static uint8_t sock_buff[8192];
 
 /*
  * if level is 0 we are joining p2p multicast
@@ -323,7 +323,6 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level)
   /* we need to do the LLC in here because of P2P circuits, which will
    * not need it
    */
-  int written = 1;
   struct sockaddr_ll sa;
 
   stream_set_getp (circuit->snd_stream, 0);
@@ -356,7 +355,7 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level)
   iov[1].iov_base = circuit->snd_stream->data;
   iov[1].iov_len = stream_get_endp (circuit->snd_stream);
 
-  written = sendmsg (circuit->fd, &msg, 0);
+  sendmsg (circuit->fd, &msg, 0);
 
   return ISIS_OK;
 }
@@ -364,7 +363,6 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level)
 int
 isis_send_pdu_p2p (struct isis_circuit *circuit, int level)
 {
-  int written = 1;
   struct sockaddr_ll sa;
 
   stream_set_getp (circuit->snd_stream, 0);
@@ -381,7 +379,7 @@ isis_send_pdu_p2p (struct isis_circuit *circuit, int level)
 
   /* lets try correcting the protocol */
   sa.sll_protocol = htons (0x00FE);
-  written = sendto (circuit->fd, circuit->snd_stream->data,
+  sendto (circuit->fd, circuit->snd_stream->data,
 		    stream_get_endp (circuit->snd_stream), 0, 
 		    (struct sockaddr *) &sa,
 		    sizeof (struct sockaddr_ll));

+ 7 - 6
isisd/isis_spf.c

@@ -1072,8 +1072,8 @@ isis_spf_preload_tent (struct isis_spftree *spftree, int level,
 	    {
 	      zlog_warn ("ISIS-Spf: No lsp (%p) found from root "
                   "to L%d DR %s on %s (ID %d)",
-		  lsp, level, rawlspid_print (lsp_id), 
-		  circuit->interface->name, circuit->circuit_id);
+                  (void *)lsp, level, rawlspid_print (lsp_id),
+                  circuit->interface->name, circuit->circuit_id);
               continue;
 	    }
 	  isis_spf_process_pseudo_lsp (spftree, lsp,
@@ -1456,8 +1456,8 @@ isis_spf_schedule6 (struct isis_area *area, int level)
   assert (area->is_type & level);
 
   if (isis->debugs & DEBUG_SPF_EVENTS)
-    zlog_debug ("ISIS-Spf (%s) L%d SPF schedule called, lastrun %d sec ago",
-                area->area_tag, level, diff);
+    zlog_debug ("ISIS-Spf (%s) L%d SPF schedule called, lastrun %lld sec ago",
+                area->area_tag, level, (long long)diff);
 
   if (spftree->pending)
     return ISIS_OK;
@@ -1476,8 +1476,9 @@ isis_spf_schedule6 (struct isis_area *area, int level)
                      area->min_spf_interval[1] - diff);
 
   if (isis->debugs & DEBUG_SPF_EVENTS)
-    zlog_debug ("ISIS-Spf (%s) L%d SPF scheduled %d sec from now",
-                area->area_tag, level, area->min_spf_interval[level-1] - diff);
+    zlog_debug ("ISIS-Spf (%s) L%d SPF scheduled %lld sec from now",
+                area->area_tag, level,
+                (long long)(area->min_spf_interval[level-1] - diff));
 
   spftree->pending = 1;
 

+ 1 - 3
isisd/isis_tlv.c

@@ -115,7 +115,6 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected,
   struct ipv6_reachability *ipv6_reach;
   int prefix_octets;
 #endif /* HAVE_IPV6 */
-  u_char virtual;
   int value_len, retval = ISIS_OK;
   u_char *start = stream, *pnt = stream, *endpnt;
 
@@ -179,7 +178,7 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected,
 	       * |                        Virtual Flag                           | 
 	       * +-------+-------+-------+-------+-------+-------+-------+-------+
 	       */
-	      virtual = *pnt;	/* FIXME: what is the use for this? */
+	      /* virtual = *pnt; FIXME: what is the use for this? */
 	      pnt++;
 	      value_len++;
 	      /* +-------+-------+-------+-------+-------+-------+-------+-------+
@@ -926,7 +925,6 @@ tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream)
   struct prefix_ipv4 *ipv4;
   u_char value[255];
   u_char *pos = value;
-  int retval;
 
   for (ALL_LIST_ELEMENTS_RO (ip_addrs, node, ipv4))
     {

+ 3 - 3
isisd/isis_zebra.c

@@ -318,7 +318,7 @@ isis_zebra_route_del_ipv4 (struct prefix *prefix,
 }
 
 #ifdef HAVE_IPV6
-void
+static void
 isis_zebra_route_add_ipv6 (struct prefix *prefix,
 			   struct isis_route_info *route_info)
 {
@@ -519,8 +519,8 @@ isis_zebra_read_ipv4 (int command, struct zclient *zclient,
   struct stream *stream;
   struct zapi_ipv4 api;
   struct prefix_ipv4 p;
-  unsigned long ifindex;
-  struct in_addr nexthop;
+  unsigned long ifindex __attribute__ ((unused));
+  struct in_addr nexthop __attribute__ ((unused));
 
   stream = zclient->ibuf;
   memset (&p, 0, sizeof (struct prefix_ipv4));

+ 6 - 6
isisd/isisd.c

@@ -1297,8 +1297,8 @@ DEFUN (show_isis_summary,
       vty_out_timestr(vty, spftree->last_run_timestamp);
       vty_out (vty, "%s", VTY_NEWLINE);
 
-      vty_out (vty, "      last run duration : %u msec%s",
-               spftree->last_run_duration, VTY_NEWLINE);
+      vty_out (vty, "      last run duration : %llu msec%s",
+               (unsigned long long)spftree->last_run_duration, VTY_NEWLINE);
 
       vty_out (vty, "      run count         : %d%s",
           spftree->runcount, VTY_NEWLINE);
@@ -1601,7 +1601,7 @@ ALIAS (area_passwd_md5,
        "Authentication\n"
        "SNP PDUs\n"
        "Send but do not check PDUs on receiving\n"
-       "Send and check PDUs on receiving\n");
+       "Send and check PDUs on receiving\n")
 
 DEFUN (area_passwd_clear,
        area_passwd_clear_cmd,
@@ -1659,7 +1659,7 @@ ALIAS (area_passwd_clear,
        "Authentication\n"
        "SNP PDUs\n"
        "Send but do not check PDUs on receiving\n"
-       "Send and check PDUs on receiving\n");
+       "Send and check PDUs on receiving\n")
 
 DEFUN (no_area_passwd,
        no_area_passwd_cmd,
@@ -1739,7 +1739,7 @@ ALIAS (domain_passwd_md5,
        "Authentication\n"
        "SNP PDUs\n"
        "Send but do not check PDUs on receiving\n"
-       "Send and check PDUs on receiving\n");
+       "Send and check PDUs on receiving\n")
 
 DEFUN (domain_passwd_clear,
        domain_passwd_clear_cmd,
@@ -1797,7 +1797,7 @@ ALIAS (domain_passwd_clear,
        "Authentication\n"
        "SNP PDUs\n"
        "Send but do not check PDUs on receiving\n"
-       "Send and check PDUs on receiving\n");
+       "Send and check PDUs on receiving\n")
 
 DEFUN (no_domain_passwd,
        no_domain_passwd_cmd,

+ 12 - 12
isisd/topology/spgrid.c

@@ -50,8 +50,8 @@ long   X,   /* horizontal size of grid */
 
 long   x,
        y,
-       y1, y2, yp,
-       dl, dx, xn, yn, count,
+       yy1, yy2, yyp,
+       dl, dx, xn, yyn, count,
        *mess;
 
 double n;
@@ -670,12 +670,12 @@ gen_spgrid_topology (struct vty *vty, struct list *topology)
 
     for ( k = ax; k > 0; k -- )
        {
-         y1 = nrand ( Y );
+         yy1 = nrand ( Y );
          do
-            y2 = nrand ( Y );
-         while ( y2 == y1 );
-         i  = NODE ( x, y1 );
-         j  = NODE ( x, y2 );
+            yy2 = nrand ( Y );
+         while ( yy2 == yy1 );
+         i  = NODE ( x, yy1 );
+         j  = NODE ( x, yy2 );
          l = am + nrand ( al );
          print_arc (vty, topology,  i, j, l );
        }
@@ -711,13 +711,13 @@ gen_spgrid_topology (struct vty *vty, struct list *topology)
   	  dx = xn - x;
   	  if ( ip_f )
   	    {
-  	      yp = nrand(Y-y);
-  	      yn = mess[ yp ];
-                mess[ yp ] = mess[ Y - y - 1 ];
+  	      yyp = nrand(Y-y);
+  	      yyn = mess[ yyp ];
+                mess[ yyp ] = mess[ Y - y - 1 ];
   	    }
   	  else
-               yn =  y;
-  	  j = NODE ( xn, yn );
+               yyn =  y;
+  	  j = NODE ( xn, yyn );
   	  l = im + nrand ( il );
   	  if ( in != 0 )
               l *= (long) ( in * dx );

+ 1 - 0
lib/Makefile.am

@@ -1,6 +1,7 @@
 ## Process this file with automake to produce Makefile.in.
 
 AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
+AM_CFLAGS = $(WERROR)
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 
 lib_LTLIBRARIES = libzebra.la

+ 3 - 2
lib/buffer.c

@@ -148,7 +148,7 @@ buffer_add (struct buffer *b)
 {
   struct buffer_data *d;
 
-  d = XMALLOC(MTYPE_BUFFER_DATA, offsetof(struct buffer_data, data[b->size]));
+  d = XMALLOC(MTYPE_BUFFER_DATA, offsetof(struct buffer_data, data) + b->size);
   d->cp = d->sp = 0;
   d->next = NULL;
 
@@ -322,7 +322,8 @@ buffer_flush_window (struct buffer *b, int fd, int width, int height,
 	      /* This should absolutely never occur. */
 	      zlog_err("%s: corruption detected: iov_small overflowed; "
 		       "head %p, tail %p, head->next %p",
-		       __func__, b->head, b->tail, b->head->next);
+		       __func__, (void *)b->head, (void *)b->tail,
+		       (void *)b->head->next);
 	      iov = XMALLOC(MTYPE_TMP, iov_alloc*sizeof(*iov));
 	      memcpy(iov, small_iov, sizeof(small_iov));
 	    }

+ 1 - 1
lib/command.c

@@ -1353,7 +1353,7 @@ cmd_matcher_match_multiple(struct cmd_matcher *matcher,
   enum match_type multiple_match;
   unsigned int multiple_index;
   const char *word;
-  const char *arg;
+  const char *arg = NULL;
   struct cmd_token *word_token;
   enum match_type word_match;
 

+ 1 - 0
lib/distribute.h

@@ -24,6 +24,7 @@
 
 #include <zebra.h>
 #include "if.h"
+#include "filter.h"
 
 /* Disctirubte list types. */
 enum distribute_type

+ 10 - 6
lib/keychain.c

@@ -381,18 +381,22 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
     NULL
   };
 
-#define GET_LONG_RANGE(V,STR,MIN,MAX) \
+#define _GET_LONG_RANGE(V,STR,MMCOND) \
 { \
   unsigned long tmpl; \
   char *endptr = NULL; \
   tmpl = strtoul ((STR), &endptr, 10); \
   if (*endptr != '\0' || tmpl == ULONG_MAX) \
     return -1; \
-  if ( tmpl < (MIN) || tmpl > (MAX)) \
+  if (MMCOND) \
     return -1; \
   (V) = tmpl; \
 }
-      
+#define GET_LONG_RANGE(V,STR,MIN,MAX) \
+        _GET_LONG_RANGE(V,STR,tmpl < (MIN) || tmpl > (MAX))
+#define GET_LONG_RANGE0(V,STR,MAX) \
+        _GET_LONG_RANGE(V,STR,tmpl > (MAX))
+
   /* Check hour field of time_str. */
   colon = strchr (time_str, ':');
   if (colon == NULL)
@@ -400,7 +404,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
   *colon = '\0';
 
   /* Hour must be between 0 and 23. */
-  GET_LONG_RANGE (hour, time_str, 0, 23);
+  GET_LONG_RANGE0 (hour, time_str, 23);
 
   /* Check min field of time_str. */
   time_str = colon + 1;
@@ -410,7 +414,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
   *colon = '\0';
 
   /* Min must be between 0 and 59. */
-  GET_LONG_RANGE (min, time_str, 0, 59);
+  GET_LONG_RANGE0 (min, time_str, 59);
 
   /* Check sec field of time_str. */
   time_str = colon + 1;
@@ -418,7 +422,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
     return -1;
   
   /* Sec must be between 0 and 59. */
-  GET_LONG_RANGE (sec, time_str, 0, 59);
+  GET_LONG_RANGE0 (sec, time_str, 59);
   
   /* Check day_str.  Day must be <1-31>. */
   GET_LONG_RANGE (day, day_str, 1, 31);

+ 5 - 3
lib/smux.h

@@ -25,6 +25,8 @@
 #include <net-snmp/agent/net-snmp-agent-includes.h>
 #include <net-snmp/agent/snmp_vars.h>
 
+#include "thread.h"
+
 /* Structures here are mostly compatible with UCD SNMP 4.1.1 */
 #define MATCH_FAILED     (-1)
 #define MATCH_SUCCEEDED  0
@@ -53,8 +55,8 @@ struct trap_object
 
 /* Declare SMUX return value. */
 #define SNMP_LOCAL_VARIABLES \
-  static long snmp_int_val; \
-  static struct in_addr snmp_in_addr_val;
+  static long snmp_int_val __attribute__ ((unused)); \
+  static struct in_addr snmp_in_addr_val __attribute__ ((unused));
 
 #define SNMP_INTEGER(V) \
   ( \
@@ -106,7 +108,7 @@ extern int smux_trap (struct variable *, size_t,
 		      const struct trap_object *, size_t,
 		      u_char);
 
-extern int oid_compare (oid *, int, oid *, int);
+extern int oid_compare (const oid *, int, const oid *, int);
 extern void oid2in_addr (oid [], int, struct in_addr *);
 extern void *oid_copy (void *, const void *, size_t);
 extern void oid_copy_addr (oid [], struct in_addr *, int);

+ 1 - 1
lib/snmp.c

@@ -30,7 +30,7 @@
 #define min(A,B) ((A) < (B) ? (A) : (B))
 
 int
-oid_compare (oid *o1, int o1_len, oid *o2, int o2_len)
+oid_compare (const oid *o1, int o1_len, const oid *o2, int o2_len)
 {
   int i;
 

+ 1 - 1
lib/stream.c

@@ -53,7 +53,7 @@
  */
 #define STREAM_WARN_OFFSETS(S) \
   zlog_warn ("&(struct stream): %p, size: %lu, getp: %lu, endp: %lu\n", \
-             (S), \
+             (void *)(S), \
              (unsigned long) (S)->size, \
              (unsigned long) (S)->getp, \
              (unsigned long) (S)->endp)\

+ 1 - 1
lib/table.h

@@ -92,7 +92,7 @@ struct route_table
 /* Each routing entry. */
 struct route_node
 {
-  ROUTE_NODE_FIELDS;
+  ROUTE_NODE_FIELDS
 
 #define l_left   link[0]
 #define l_right  link[1]

+ 3 - 3
lib/vty.c

@@ -870,7 +870,7 @@ vty_complete_command (struct vty *vty)
 
   /* In case of 'help \t'. */
   if (isspace ((int) vty->buf[vty->length - 1]))
-    vector_set (vline, '\0');
+    vector_set (vline, NULL);
 
   matched = cmd_complete_command (vline, vty, &ret);
   
@@ -985,11 +985,11 @@ vty_describe_command (struct vty *vty)
   if (vline == NULL)
     {
       vline = vector_init (1);
-      vector_set (vline, '\0');
+      vector_set (vline, NULL);
     }
   else 
     if (isspace ((int) vty->buf[vty->length - 1]))
-      vector_set (vline, '\0');
+      vector_set (vline, NULL);
 
   describe = cmd_describe_command (vline, vty, &ret);
 

+ 3 - 3
lib/zclient.c

@@ -41,7 +41,7 @@ static void zclient_event (enum event, struct zclient *);
 
 extern struct thread_master *master;
 
-char *zclient_serv_path = NULL;
+const char *zclient_serv_path = NULL;
 
 /* This file local debug flag. */
 int zclient_debug = 0;
@@ -919,7 +919,7 @@ zclient_read (struct thread *thread)
   length -= ZEBRA_HEADER_SIZE;
 
   if (zclient_debug)
-    zlog_debug("zclient 0x%p command 0x%x \n", zclient, command);
+    zlog_debug("zclient 0x%p command 0x%x \n", (void *)zclient, command);
 
   switch (command)
     {
@@ -1053,7 +1053,7 @@ zclient_event (enum event event, struct zclient *zclient)
     }
 }
 
-const char *const zclient_serv_path_get()
+const char *zclient_serv_path_get()
 {
   return zclient_serv_path ? zclient_serv_path : ZEBRA_SERV_PATH;
 }

+ 1 - 1
lib/zclient.h

@@ -134,7 +134,7 @@ extern void zclient_free (struct zclient *);
 
 extern int  zclient_socket_connect (struct zclient *);
 extern void zclient_serv_path_set  (char *path);
-extern const char *const zclient_serv_path_get (void);
+extern const char *zclient_serv_path_get (void);
 
 /* Send redistribute command to zebra daemon. Do not update zclient state. */
 extern int zebra_redistribute_send (int command, struct zclient *, int type);

+ 1 - 1
ospf6d/Makefile.am

@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = libospf6.a

+ 2 - 1
ospf6d/ospf6_interface.c

@@ -40,6 +40,7 @@
 #include "ospf6_neighbor.h"
 #include "ospf6_intra.h"
 #include "ospf6_spf.h"
+#include "ospf6_snmp.h"
 #include "ospf6d.h"
 
 unsigned char conf_debug_ospf6_interface = 0;
@@ -913,7 +914,7 @@ ospf6_interface_show (struct vty *vty, struct interface *ifp)
 	       "disabled" : "enabled", VNL);
       inet_ntop (AF_INET, &oi->area->area_id,
                  strbuf, sizeof (strbuf));
-      vty_out (vty, "  Area ID %s, Cost %hu%s", strbuf, oi->cost,
+      vty_out (vty, "  Area ID %s, Cost %u%s", strbuf, oi->cost,
 	       VNL);
     }
   else

+ 7 - 6
ospf6d/ospf6_intra.c

@@ -234,9 +234,9 @@ ospf6_router_lsa_originate (struct thread *thread)
 
       /* Multiple Router-LSA instance according to size limit setting */
       if ( (oa->router_lsa_size_limit != 0)
-          && ((caddr_t) lsdesc + sizeof (struct ospf6_router_lsdesc) -
-	      /* XXX warning: comparison between signed and unsigned */
-              (caddr_t) buffer > oa->router_lsa_size_limit))
+          && ((size_t)((char *)lsdesc - buffer)
+                 + sizeof (struct ospf6_router_lsdesc)
+               > oa->router_lsa_size_limit))
         {
           if ((caddr_t) lsdesc == (caddr_t) router_lsa +
                                   sizeof (struct ospf6_router_lsa))
@@ -1495,7 +1495,8 @@ ospf6_brouter_debug_print (struct ospf6_route *brouter)
 
   zlog_info ("Brouter: %s via area %s", brouter_name, area_name);
   zlog_info ("  memory: prev: %p this: %p next: %p parent rnode: %p",
-             brouter->prev, brouter, brouter->next, brouter->rnode);
+             (void *)brouter->prev, (void *)brouter, (void *)brouter->next,
+             (void *)brouter->rnode);
   zlog_info ("  type: %d prefix: %s installed: %s changed: %s",
              brouter->type, destination, installed, changed);
   zlog_info ("  lock: %d flags: %s%s%s%s", brouter->lock,
@@ -1543,7 +1544,7 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
           IS_OSPF6_DEBUG_ROUTE (MEMORY))
         {
           zlog_info ("%p: mark as removing: area %s brouter %s",
-                     brouter, oa->name, brouter_name);
+                     (void *)brouter, oa->name, brouter_name);
           ospf6_brouter_debug_print (brouter);
         }
     }
@@ -1575,7 +1576,7 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
           IS_OSPF6_DEBUG_ROUTE (MEMORY))
         {
           zlog_info ("%p: transfer: area %s brouter %s",
-                     brouter, oa->name, brouter_name);
+                     (void *)brouter, oa->name, brouter_name);
           ospf6_brouter_debug_print (brouter);
         }
     }

+ 3 - 3
ospf6d/ospf6_lsa.c

@@ -494,7 +494,7 @@ ospf6_lsa_show_internal (struct vty *vty, struct ospf6_lsa *lsa)
   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: 0x%p, Refresh: 0x%p %s",
-	   lsa->expire, lsa->refresh, VNL);
+           (void *)lsa->expire, (void *)lsa->refresh, VNL);
   vty_out (vty, "%s", VNL);
   return;
 }
@@ -807,8 +807,8 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h)
 
   for (i = 0; i < MIN (size, sizeof (buf)); i++)
     {
-      if (! islower (h->name[i]))
-        buf[i] = tolower (h->name[i]);
+      if (! islower ((unsigned char)h->name[i]))
+        buf[i] = tolower ((unsigned char)h->name[i]);
       else
         buf[i] = h->name[i];
     }

+ 1 - 0
ospf6d/ospf6_neighbor.c

@@ -38,6 +38,7 @@
 #include "ospf6_neighbor.h"
 #include "ospf6_intra.h"
 #include "ospf6_flood.h"
+#include "ospf6_snmp.h"
 #include "ospf6d.h"
 
 unsigned char conf_debug_ospf6_neighbor = 0;

+ 17 - 12
ospf6d/ospf6_route.c

@@ -374,7 +374,7 @@ ospf6_route_add (struct ospf6_route *route,
 
   if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
     zlog_debug ("%s %p: route add %p: %s", ospf6_route_table_name (table),
-                table, route, buf);
+                (void *)table, (void *)route, buf);
   else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
     zlog_debug ("%s: route add: %s", ospf6_route_table_name (table), buf);
 
@@ -408,7 +408,8 @@ ospf6_route_add (struct ospf6_route *route,
         {
           if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
             zlog_debug ("%s %p: route add %p: needless update of %p",
-                        ospf6_route_table_name (table), table, route, old);
+                        ospf6_route_table_name (table),
+                        (void *)table, (void *)route, (void *)old);
           else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
             zlog_debug ("%s: route add: needless update",
                         ospf6_route_table_name (table));
@@ -422,7 +423,8 @@ ospf6_route_add (struct ospf6_route *route,
 
       if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
         zlog_debug ("%s %p: route add %p: update of %p",
-                    ospf6_route_table_name (table), table, route, old);
+                    ospf6_route_table_name (table),
+                    (void *)table, (void *)route, (void *)old);
       else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
         zlog_debug ("%s: route add: update",
                     ospf6_route_table_name (table));
@@ -463,7 +465,8 @@ ospf6_route_add (struct ospf6_route *route,
     {
       if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
         zlog_debug ("%s %p: route add %p: another path: prev %p, next %p",
-                   ospf6_route_table_name (table), table, route, prev, next);
+                    ospf6_route_table_name (table),
+                    (void *)table, (void *)route, (void *)prev, (void *)next);
       else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
         zlog_debug ("%s: route add: another path found",
                     ospf6_route_table_name (table));
@@ -488,7 +491,8 @@ ospf6_route_add (struct ospf6_route *route,
           SET_FLAG (route->flag, OSPF6_ROUTE_BEST);
           if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
             zlog_info ("%s %p: route add %p: replacing previous best: %p",
-                       ospf6_route_table_name (table), table, route, next);
+                       ospf6_route_table_name (table),
+                       (void *)table, (void *)route, (void *)next);
         }
 
       route->installed = now;
@@ -510,7 +514,7 @@ ospf6_route_add (struct ospf6_route *route,
   /* Else, this is the brand new route regarding to the prefix */
   if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
     zlog_debug ("%s %p: route add %p: brand new route",
-                ospf6_route_table_name (table), table, route);
+                ospf6_route_table_name (table), (void *)table, (void *)route);
   else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
     zlog_debug ("%s: route add: brand new route",
                 ospf6_route_table_name (table));
@@ -589,7 +593,8 @@ ospf6_route_remove (struct ospf6_route *route,
 
   if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
     zlog_debug ("%s %p: route remove %p: %s",
-                ospf6_route_table_name (table), table, route, buf);
+                ospf6_route_table_name (table),
+                (void *)table, (void *)route, buf);
   else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
     zlog_debug ("%s: route remove: %s", ospf6_route_table_name (table), buf);
 
@@ -661,8 +666,8 @@ ospf6_route_head (struct ospf6_route_table *table)
 
   if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
     zlog_info ("%s %p: route head: %p<-[%p]->%p",
-               ospf6_route_table_name (table), table,
-               route->prev, route, route->next);
+               ospf6_route_table_name (table), (void *)table,
+               (void *)route->prev, (void *)route, (void *)route->next);
 
   return route;
 }
@@ -674,8 +679,8 @@ ospf6_route_next (struct ospf6_route *route)
 
   if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
     zlog_info ("%s %p: route next: %p<-[%p]->%p",
-               ospf6_route_table_name (route->table), route->table,
-               route->prev, route, route->next);
+               ospf6_route_table_name (route->table), (void *)route->table,
+               (void *)route->prev, (void *)route, (void *)route->next);
 
   ospf6_route_unlock (route);
   if (next)
@@ -874,7 +879,7 @@ ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route)
            (CHECK_FLAG (route->flag, OSPF6_ROUTE_CHANGE) ? "C" : "-"),
            VNL);
   vty_out (vty, "Memory: prev: %p this: %p next: %p%s",
-           route->prev, route, route->next, VNL);
+           (void *)route->prev, (void *)route, (void *)route->next, VNL);
 
   /* Path section */
 

+ 4 - 5
ospf6d/ospf6_route.h

@@ -239,16 +239,15 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];
            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]))
+  ((x)->u.lp.id.s_addr)
 #define ospf6_linkstate_prefix_id(x) \
-  (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4]))
+  ((x)->u.lp.adv_router.s_addr)
 
 #define ADV_ROUTER_IN_PREFIX(x) \
-  (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0]))
+  ((x)->u.lp.id.s_addr)
 #define ID_IN_PREFIX(x) \
-  (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4]))
+  ((x)->u.lp.adv_router.s_addr)
 
 /* Function prototype */
 extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id,

+ 2 - 1
ospf6d/ospf6_snmp.c

@@ -40,6 +40,8 @@
 #include "ospf6_interface.h"
 #include "ospf6_message.h"
 #include "ospf6_neighbor.h"
+#include "ospf6_abr.h"
+#include "ospf6_asbr.h"
 #include "ospf6d.h"
 #include "ospf6_snmp.h"
 
@@ -626,7 +628,6 @@ ospfv3WwLsdbEntry (struct variable *v, oid *name, size_t *length,
   int len;
   oid *offset;
   int offsetlen;
-  char a[16], b[16], c[16];
   struct ospf6_area *oa;
   struct listnode *node;
   struct interface *iif;

+ 6 - 5
ospf6d/ospf6_spf.c

@@ -601,11 +601,12 @@ ospf6_spf_calculation_thread (struct thread *t)
   ospf6_spf_reason_string(ospf6->spf_reason, rbuf, sizeof(rbuf));
 
   if (IS_OSPF6_DEBUG_SPF (PROCESS) || IS_OSPF6_DEBUG_SPF (TIME))
-    zlog_debug ("SPF runtime: %ld sec %ld usec",
-		runtime.tv_sec, runtime.tv_usec);
+    zlog_debug ("SPF runtime: %lld sec %lld usec",
+		(long long)runtime.tv_sec, (long long)runtime.tv_usec);
 
-  zlog_info("SPF processing: # Areas: %d, SPF runtime: %ld sec %ld usec, "
-	    "Reason: %s\n", areas_processed, runtime.tv_sec, runtime.tv_usec,
+  zlog_info("SPF processing: # Areas: %d, SPF runtime: %lld sec %lld usec, "
+	    "Reason: %s\n", areas_processed,
+	    (long long)runtime.tv_sec, (long long)runtime.tv_usec,
 	    rbuf);
   ospf6->last_spf_reason = ospf6->spf_reason;
   ospf6_reset_spf_reason(ospf6);
@@ -638,7 +639,7 @@ ospf6_spf_schedule (struct ospf6 *ospf6, unsigned int reason)
     {
       if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF (TIME))
         zlog_debug ("SPF: calculation timer is already scheduled: %p",
-                   ospf6->t_spf_calc);
+                    (void *)ospf6->t_spf_calc);
       return;
     }
 

+ 3 - 2
ospf6d/ospf6_top.c

@@ -663,8 +663,9 @@ ospf6_show (struct vty *vty, struct ospf6 *o)
       timerstring(&result, buf, sizeof(buf));
       ospf6_spf_reason_string(o->last_spf_reason, rbuf, sizeof(rbuf));
       vty_out(vty, "last executed %s ago, reason %s%s", buf, rbuf, VNL);
-      vty_out (vty, " Last SPF duration %ld sec %ld usec%s",
-	       o->ts_spf_duration.tv_sec, o->ts_spf_duration.tv_usec, VNL);
+      vty_out (vty, " Last SPF duration %lld sec %lld usec%s",
+               (long long)o->ts_spf_duration.tv_sec,
+               (long long)o->ts_spf_duration.tv_usec, VNL);
     }
   else
     vty_out(vty, "has not been run$%s", VNL);

+ 13 - 13
ospf6d/ospf6d.h

@@ -71,19 +71,19 @@ extern struct thread_master *master;
       }                                               \
   } while (0)
 #endif /*timersub*/
-#define timerstring(tv, buf, size)                    \
-  do {                                                \
-    if ((tv)->tv_sec / 60 / 60 / 24)                  \
-      snprintf (buf, size, "%ldd%02ld:%02ld:%02ld",   \
-                (tv)->tv_sec / 60 / 60 / 24,          \
-                (tv)->tv_sec / 60 / 60 % 24,          \
-                (tv)->tv_sec / 60 % 60,               \
-                (tv)->tv_sec % 60);                   \
-    else                                              \
-      snprintf (buf, size, "%02ld:%02ld:%02ld",       \
-                (tv)->tv_sec / 60 / 60 % 24,          \
-                (tv)->tv_sec / 60 % 60,               \
-                (tv)->tv_sec % 60);                   \
+#define timerstring(tv, buf, size)                      \
+  do {                                                  \
+    if ((tv)->tv_sec / 60 / 60 / 24)                    \
+      snprintf (buf, size, "%lldd%02lld:%02lld:%02lld", \
+                (tv)->tv_sec / 60LL / 60 / 24,          \
+                (tv)->tv_sec / 60LL / 60 % 24,          \
+                (tv)->tv_sec / 60LL % 60,               \
+                (tv)->tv_sec % 60LL);                   \
+    else                                                \
+      snprintf (buf, size, "%02lld:%02lld:%02lld",      \
+                (tv)->tv_sec / 60LL / 60 % 24,          \
+                (tv)->tv_sec / 60LL % 60,               \
+                (tv)->tv_sec % 60LL);                   \
   } while (0)
 #define timerstring_local(tv, buf, size)                  \
   do {                                                    \

+ 1 - 0
ospfclient/Makefile.am

@@ -1,6 +1,7 @@
 ## Automake.am for OSPF API client
 
 AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
+AM_CFLAGS = $(WERROR)
 
 lib_LTLIBRARIES = libospfapiclient.la
 libospfapiclient_la_LDFLAGS = -version-info 0:0:0

+ 1 - 0
ospfd/Makefile.am

@@ -1,6 +1,7 @@
 ## Process this file with automake to produce Makefile.in.
 
 AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
+AM_CFLAGS = $(WERROR)
 DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 

+ 10 - 6
ospfd/ospf_apiserver.c

@@ -244,7 +244,8 @@ static int
 ospf_apiserver_new_lsa_hook (struct ospf_lsa *lsa)
 {
   if (IS_DEBUG_OSPF_EVENT)
-    zlog_debug ("API: Put LSA(%p)[%s] into reserve, total=%ld", lsa, dump_lsa_key (lsa), lsa->lsdb->total);
+    zlog_debug ("API: Put LSA(%p)[%s] into reserve, total=%ld", (void *)lsa,
+                dump_lsa_key (lsa), lsa->lsdb->total);
   return 0;
 }
 
@@ -252,7 +253,8 @@ static int
 ospf_apiserver_del_lsa_hook (struct ospf_lsa *lsa)
 {
   if (IS_DEBUG_OSPF_EVENT)
-    zlog_debug ("API: Get LSA(%p)[%s] from reserve, total=%ld", lsa, dump_lsa_key (lsa), lsa->lsdb->total);
+    zlog_debug ("API: Get LSA(%p)[%s] from reserve, total=%ld", (void *)lsa,
+                dump_lsa_key (lsa), lsa->lsdb->total);
   return 0;
 }
 
@@ -395,7 +397,8 @@ ospf_apiserver_free (struct ospf_apiserver *apiserv)
   listnode_delete (apiserver_list, apiserv);
 
   if (IS_DEBUG_OSPF_EVENT)
-    zlog_debug ("API: Delete apiserv(%p), total#(%d)", apiserv, apiserver_list->count);
+    zlog_debug ("API: Delete apiserv(%p), total#(%d)",
+                (void *)apiserv, apiserver_list->count);
 
   /* And free instance. */
   XFREE (MTYPE_OSPF_APISERVER, apiserv);
@@ -755,7 +758,8 @@ ospf_apiserver_accept (struct thread *thread)
 #endif /* USE_ASYNC_READ */
 
   if (IS_DEBUG_OSPF_EVENT)
-    zlog_debug ("API: New apiserv(%p), total#(%d)", apiserv, apiserver_list->count);
+    zlog_debug ("API: New apiserv(%p), total#(%d)",
+                (void *)apiserv, apiserver_list->count);
 
   return 0;
 }
@@ -944,7 +948,7 @@ ospf_apiserver_register_opaque_type (struct ospf_apiserver *apiserv,
   if (IS_DEBUG_OSPF_EVENT)
     zlog_debug ("API: Add LSA-type(%d)/Opaque-type(%d) into"
                " apiserv(%p), total#(%d)", 
-               lsa_type, opaque_type, apiserv, 
+               lsa_type, opaque_type, (void *)apiserv, 
                listcount (apiserv->opaque_types));
 
   return 0;
@@ -976,7 +980,7 @@ ospf_apiserver_unregister_opaque_type (struct ospf_apiserver *apiserv,
           if (IS_DEBUG_OSPF_EVENT)
             zlog_debug ("API: Del LSA-type(%d)/Opaque-type(%d)"
                        " from apiserv(%p), total#(%d)", 
-                       lsa_type, opaque_type, apiserv, 
+                       lsa_type, opaque_type, (void *)apiserv,
                        listcount (apiserv->opaque_types));
 
 	  return 0;

+ 2 - 2
ospfd/ospf_ase.c

@@ -679,8 +679,8 @@ ospf_ase_calculate_timer (struct thread *t)
 
       quagga_gettime(QUAGGA_CLK_MONOTONIC, &stop_time);
 
-      zlog_info ("SPF Processing Time(usecs): External Routes: %ld\n",
-		 (stop_time.tv_sec - start_time.tv_sec)*1000000L+
+      zlog_info ("SPF Processing Time(usecs): External Routes: %lld\n",
+		 (stop_time.tv_sec - start_time.tv_sec)*1000000LL+
 		 (stop_time.tv_usec - start_time.tv_usec));
     }
   return 0;

+ 4 - 4
ospfd/ospf_dump.c

@@ -299,13 +299,13 @@ ospf_timeval_dump (struct timeval *t, char *buf, size_t size)
   else if (d)
     snprintf (buf, size, "%1ldd%02ldh%02ldm", d, h, m);
   else if (h)
-    snprintf (buf, size, "%ldh%02ldm%02lds", h, m, t->tv_sec);
+    snprintf (buf, size, "%ldh%02ldm%02lds", h, m, (long)t->tv_sec);
   else if (m)
-    snprintf (buf, size, "%ldm%02lds", m, t->tv_sec);
+    snprintf (buf, size, "%ldm%02lds", m, (long)t->tv_sec);
   else if (ms)
-    snprintf (buf, size, "%ld.%03lds", t->tv_sec, ms);
+    snprintf (buf, size, "%ld.%03lds", (long)t->tv_sec, ms);
   else
-    snprintf (buf, size, "%ld usecs", t->tv_usec);
+    snprintf (buf, size, "%ld usecs", (long)t->tv_usec);
 
   return buf;
 }

+ 3 - 2
ospfd/ospf_flood.c

@@ -244,7 +244,7 @@ ospf_flood (struct ospf *ospf, struct ospf_neighbor *nbr,
     zlog_debug ("LSA[Flooding]: start, NBR %s (%s), cur(%p), New-LSA[%s]",
                inet_ntoa (nbr->router_id),
                LOOKUP (ospf_nsm_state_msg, nbr->state),
-               current,
+               (void *)current,
                dump_lsa_key (new));
 
   lsa_ack_flag = 0;
@@ -584,7 +584,8 @@ ospf_flood_through_area (struct ospf_area *area,
            * for the link on which the LSA has received.
            */
           if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
-            zlog_debug ("Type-9 Opaque-LSA: lsa->oi(%p) != oi(%p)", lsa->oi, oi);
+            zlog_debug ("Type-9 Opaque-LSA: lsa->oi(%p) != oi(%p)",
+                        (void *)lsa->oi, (void *)oi);
           continue;
         }
 #endif /* HAVE_OPAQUE_LSA */

+ 22 - 20
ospfd/ospf_lsa.c

@@ -248,7 +248,7 @@ ospf_lsa_dup (struct ospf_lsa *lsa)
   new->refresh_list = -1;
 
   if (IS_DEBUG_OSPF (lsa, LSA))
-    zlog_debug ("LSA: duplicated %p (new: %p)", lsa, new);
+    zlog_debug ("LSA: duplicated %p (new: %p)", (void *)lsa, (void *)new);
 
   return new;
 }
@@ -260,7 +260,7 @@ ospf_lsa_free (struct ospf_lsa *lsa)
   assert (lsa->lock == 0);
   
   if (IS_DEBUG_OSPF (lsa, LSA))
-    zlog_debug ("LSA: freed %p", lsa);
+    zlog_debug ("LSA: freed %p", (void *)lsa);
 
   /* Delete LSA data. */
   if (lsa->data != NULL)
@@ -336,7 +336,7 @@ ospf_lsa_data_free (struct lsa_header *lsah)
 {
   if (IS_DEBUG_OSPF (lsa, LSA))
     zlog_debug ("LSA[Type%d:%s]: data freed %p",
-	       lsah->type, inet_ntoa (lsah->id), lsah);
+	       lsah->type, inet_ntoa (lsah->id), (void *)lsah);
 
   XFREE (MTYPE_OSPF_LSA_DATA, lsah);
 }
@@ -888,7 +888,7 @@ ospf_router_lsa_originate (struct ospf_area *area)
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {
       zlog_debug ("LSA[Type%d:%s]: Originate router-LSA %p",
-		 new->data->type, inet_ntoa (new->data->id), new);
+		 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);
     }
 
@@ -1123,7 +1123,7 @@ ospf_network_lsa_update (struct ospf_interface *oi)
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {
       zlog_debug ("LSA[Type%d:%s]: Originate network-LSA %p",
-		 new->data->type, inet_ntoa (new->data->id), new);
+		 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);
     }
 
@@ -1300,7 +1300,7 @@ ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {
       zlog_debug ("LSA[Type%d:%s]: Originate summary-LSA %p",
-		 new->data->type, inet_ntoa (new->data->id), new);
+		 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);
     }
 
@@ -1443,7 +1443,7 @@ ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {
       zlog_debug ("LSA[Type%d:%s]: Originate summary-ASBR-LSA %p",
-		 new->data->type, inet_ntoa (new->data->id), new);
+		 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);
     }
 
@@ -2075,7 +2075,7 @@ ospf_external_lsa_originate (struct ospf *ospf, struct external_info *ei)
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {
       zlog_debug ("LSA[Type%d:%s]: Originate AS-external-LSA %p",
-		 new->data->type, inet_ntoa (new->data->id), new);
+		 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);
     }
 
@@ -2260,7 +2260,8 @@ ospf_external_lsa_refresh_default (struct ospf *ospf)
       if (lsa)
 	{
 	  if (IS_DEBUG_OSPF_EVENT)
-	    zlog_debug ("LSA[Type5:0.0.0.0]: Refresh AS-external-LSA %p", lsa);
+	    zlog_debug ("LSA[Type5:0.0.0.0]: Refresh AS-external-LSA %p",
+		       (void *)lsa);
 	  ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE);
 	}
       else
@@ -2687,7 +2688,7 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
             {
       	      zlog_debug ("ospf_lsa_install() Premature Aging "
 		         "lsa 0x%p, seqnum 0x%x",
-		         lsa, ntohl(lsa->data->ls_seqnum));
+		         (void *)lsa, ntohl(lsa->data->ls_seqnum));
       	      ospf_lsa_header_dump (lsa->data);
             }
         }
@@ -2790,9 +2791,9 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
     {
       if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
         zlog_debug ("LSA[Type%d:%s]: Install LSA 0x%p, MaxAge",
-                   new->data->type, 
-                   inet_ntoa (new->data->id), 
-                   lsa);
+                   new->data->type,
+                   inet_ntoa (new->data->id),
+                   (void *)lsa);
       ospf_lsa_maxage (ospf, lsa);
     }
 
@@ -2879,7 +2880,7 @@ ospf_maxage_lsa_remover (struct thread *thread)
 	if (CHECK_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE))
           {
             if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
-              zlog_debug ("originating new lsa for lsa 0x%p\n", lsa);
+              zlog_debug ("originating new lsa for lsa 0x%p\n", (void *)lsa);
             ospf_lsa_refresh (ospf, lsa);
           }
 
@@ -2946,7 +2947,7 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa)
     {
       if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
 	zlog_debug ("LSA[Type%d:%s]: %p already exists on MaxAge LSA list",
-		   lsa->data->type, inet_ntoa (lsa->data->id), lsa);
+		   lsa->data->type, inet_ntoa (lsa->data->id), (void *)lsa);
       return;
     }
 
@@ -2961,7 +2962,8 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa)
 	{
 	  if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
 	    zlog_debug ("LSA[%s]: found LSA (%p) in table for LSA %p %d",
-			dump_lsa_key (lsa), rn->info, lsa, lsa_prefix.prefixlen);
+			dump_lsa_key (lsa), rn->info, (void *)lsa,
+			lsa_prefix.prefixlen);
 	  route_unlock_node (rn);
 	}
       else
@@ -3691,7 +3693,7 @@ ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa)
       if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
         zlog_debug ("LSA[Refresh:%s]: ospf_refresher_register_lsa(): "
                    "setting refresh_list on lsa %p (slod %d)", 
-                   inet_ntoa (lsa->data->id), lsa, index);
+                   inet_ntoa (lsa->data->id), (void *)lsa, index);
     }
 }
 
@@ -3762,9 +3764,9 @@ ospf_lsa_refresh_walker (struct thread *t)
 	    {
 	      if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
 		zlog_debug ("LSA[Refresh:%s]: ospf_lsa_refresh_walker(): "
-		           "refresh lsa %p (slot %d)", 
-		           inet_ntoa (lsa->data->id), lsa, i);
-	      
+		           "refresh lsa %p (slot %d)",
+		           inet_ntoa (lsa->data->id), (void *)lsa, i);
+
 	      assert (lsa->lock > 0);
 	      list_delete_node (refresh_list, node);
 	      lsa->refresh_list = -1;

+ 1 - 1
ospfd/ospf_lsdb.c

@@ -158,7 +158,7 @@ ospf_lsdb_delete (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
       if (lsa)
         zlog_warn ("LSA[Type%d:%s]: LSA %p, lsa->lsdb %p",
                    lsa->data->type, inet_ntoa (lsa->data->id),
-                   lsa, lsa->lsdb);
+                   (void *)lsa, (void *)lsa->lsdb);
       return;
     }
   

+ 4 - 3
ospfd/ospf_packet.c

@@ -1681,7 +1681,7 @@ ospf_ls_upd_list_lsa (struct ospf_neighbor *nbr, struct stream *s,
 
       if (IS_DEBUG_OSPF_EVENT)
 	zlog_debug("LSA[Type%d:%s]: %p new LSA created with Link State Update",
-		  lsa->data->type, inet_ntoa (lsa->data->id), lsa);
+		  lsa->data->type, inet_ntoa (lsa->data->id), (void *)lsa);
       listnode_add (lsas, lsa);
     }
 
@@ -1762,7 +1762,8 @@ ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh,
 
 #define DISCARD_LSA(L,N) {\
         if (IS_DEBUG_OSPF_EVENT) \
-          zlog_debug ("ospf_lsa_discard() in ospf_ls_upd() point %d: lsa %p Type-%d", N, lsa, (int) lsa->data->type); \
+          zlog_debug ("ospf_lsa_discard() in ospf_ls_upd() point %d: lsa %p" \
+                      " Type-%d", N, (void *)lsa, (int) lsa->data->type); \
         ospf_lsa_discard (L); \
 	continue; }
 
@@ -1947,7 +1948,7 @@ ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh,
               ospf_lsa_flush_area(lsa,out_if->area);
               if(IS_DEBUG_OSPF_EVENT)
                 zlog_debug ("ospf_lsa_discard() in ospf_ls_upd() point 9: lsa %p Type-%d",
-                            lsa, (int) lsa->data->type);
+                            (void *)lsa, (int) lsa->data->type);
               ospf_lsa_discard (lsa);
               Flag = 1;
             }

+ 6 - 6
ospfd/ospf_snmp.c

@@ -986,7 +986,7 @@ ospfLsdbLookup (struct variable *v, oid *name, size_t *length,
       offsetlen = *length - v->namelen;
       len = offsetlen;
 
-      if (len > IN_ADDR_SIZE)
+      if (len > (int)IN_ADDR_SIZE)
 	len = IN_ADDR_SIZE;
 
       oid2in_addr (offset, len, area_id);
@@ -1026,7 +1026,7 @@ ospfLsdbLookup (struct variable *v, oid *name, size_t *length,
 	  else
 	    {
 	      ls_id_next = 0;
-	      if (len > IN_ADDR_SIZE)
+	      if (len > (int)IN_ADDR_SIZE)
 		len = IN_ADDR_SIZE;
 
 	      oid2in_addr (offset, len, ls_id);
@@ -1042,7 +1042,7 @@ ospfLsdbLookup (struct variable *v, oid *name, size_t *length,
 	  else
 	    {
 	      router_id_next = 0;
-	      if (len > IN_ADDR_SIZE)
+	      if (len > (int)IN_ADDR_SIZE)
 		len = IN_ADDR_SIZE;
 
 	      oid2in_addr (offset, len, router_id);
@@ -1152,7 +1152,7 @@ ospfAreaRangeLookup (struct variable *v, oid *name, size_t *length,
 {
   oid *offset;
   int offsetlen;
-  unsigned int len;
+  int len;
   struct ospf *ospf;
   struct ospf_area *area;
   struct ospf_area_range *range;
@@ -1193,7 +1193,7 @@ ospfAreaRangeLookup (struct variable *v, oid *name, size_t *length,
       offsetlen = *length - v->namelen;
 
       len = offsetlen;
-      if (len > IN_ADDR_SIZE)
+      if (len > (int)IN_ADDR_SIZE)
 	len = IN_ADDR_SIZE;
 
       oid2in_addr (offset, len, area_id);
@@ -1215,7 +1215,7 @@ ospfAreaRangeLookup (struct variable *v, oid *name, size_t *length,
 
 	  if (len < 0)
 	    len = 0;
-	  if (len > IN_ADDR_SIZE)
+	  if (len > (int)IN_ADDR_SIZE)
 	    len = IN_ADDR_SIZE;
 
 	  oid2in_addr (offset, len, range_net);

+ 3 - 3
ospfd/ospf_spf.c

@@ -590,7 +590,7 @@ ospf_nexthop_calculation (struct ospf_area *area, struct vertex *v,
 
           if (l->m[0].type == LSA_LINK_TYPE_POINTOPOINT)
             {
-	      struct in_addr nexthop;
+              struct in_addr nexthop = { .s_addr = 0 };
 
               /* If the destination is a router which connects to
                  the calculating router via a Point-to-MultiPoint
@@ -1014,7 +1014,7 @@ ospf_spf_dump (struct vertex *v, int i)
     for (ALL_LIST_ELEMENTS_RO (v->parents, nnode, parent))
       {
         zlog_debug (" nexthop %p %s %s", 
-                    parent->nexthop,
+                    (void *)parent->nexthop,
                     inet_ntoa (parent->nexthop->router),
                     parent->nexthop->oi ? IF_NAME(parent->nexthop->oi)
                                         : "NULL");
@@ -1444,7 +1444,7 @@ ospf_spf_calculate_schedule (struct ospf *ospf, ospf_spf_reason_t reason)
     {
       if (IS_DEBUG_OSPF_EVENT)
         zlog_debug ("SPF: calculation timer is already scheduled: %p",
-                   ospf->t_spf_calc);
+                    (void *)ospf->t_spf_calc);
       return;
     }
   

+ 1 - 1
ospfd/ospf_te.c

@@ -556,7 +556,7 @@ ospf_mpls_te_new_if (struct interface *ifp)
 
   if (lookup_linkparams_by_ifp (ifp) != NULL)
     {
-      zlog_warn ("ospf_mpls_te_new_if: ifp(%p) already in use?", ifp);
+      zlog_warn ("ospf_mpls_te_new_if: ifp(%p) already in use?", (void *)ifp);
       rc = 0; /* Do nothing here. */
       goto out;
     }

+ 2 - 2
pimd/Makefile.am

@@ -34,12 +34,12 @@ PIM_DEFS += -DPIM_ZCLIENT_DEBUG
 PIM_DEFS += -DPIM_ENFORCE_LOOPFREE_MFC
 #PIM_DEFS += -DPIM_UNEXPECTED_KERNEL_UPCALL
 
-AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
+AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" $(PIM_DEFS)
 INSTALL_SDATA=@INSTALL@ -m 600
 LIBS = @LIBS@
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = libpim.a

+ 4 - 4
pimd/pim_cmd.c

@@ -2031,8 +2031,8 @@ static void show_multicast_interfaces(struct vty *vty)
     if (ioctl(qpim_mroute_socket_fd, SIOCGETVIFCNT, &vreq)) {
       int e = errno;
       vty_out(vty,
-	      "ioctl(SIOCGETVIFCNT=%d) failure for interface %s vif_index=%d: errno=%d: %s%s",
-	      SIOCGETVIFCNT,
+	      "ioctl(SIOCGETVIFCNT=%lu) failure for interface %s vif_index=%d: errno=%d: %s%s",
+	      (unsigned long)SIOCGETVIFCNT,
 	      ifp->name,
 	      pim_ifp->mroute_vif_index,
 	      e,
@@ -2225,8 +2225,8 @@ static void show_mroute_count(struct vty *vty)
     if (ioctl(qpim_mroute_socket_fd, SIOCGETSGCNT, &sgreq)) {
       int e = errno;
       vty_out(vty,
-	      "ioctl(SIOCGETSGCNT=%d) failure for (S,G)=(%s,%s): errno=%d: %s%s",
-	      SIOCGETSGCNT,
+	      "ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=(%s,%s): errno=%d: %s%s",
+	      (unsigned long)SIOCGETSGCNT,
 	      source_str,
 	      group_str,
 	      e,

+ 2 - 1
pimd/pim_igmpv3.c

@@ -1680,7 +1680,8 @@ void pim_igmp_send_membership_query(struct igmp_group *group,
 #endif
   tolen = sizeof(to);
 
-  sent = sendto(fd, query_buf, msg_size, MSG_DONTWAIT, &to, tolen);
+  sent = sendto(fd, query_buf, msg_size, MSG_DONTWAIT,
+                (struct sockaddr *)&to, tolen);
   if (sent != (ssize_t) msg_size) {
     int e = errno;
     char dst_str[100];

+ 1 - 0
pimd/pim_int.c

@@ -22,6 +22,7 @@
 
 #include <string.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "pim_int.h"
 

+ 2 - 1
pimd/pim_pim.c

@@ -476,7 +476,8 @@ int pim_msg_send(int fd,
     pim_pkt_dump(__PRETTY_FUNCTION__, pim_msg, pim_msg_size);
   }
 
-  sent = sendto(fd, pim_msg, pim_msg_size, MSG_DONTWAIT, &to, tolen);
+  sent = sendto(fd, pim_msg, pim_msg_size, MSG_DONTWAIT,
+                (struct sockaddr *)&to, tolen);
   if (sent != (ssize_t) pim_msg_size) {
     int e = errno;
     char dst_str[100];

+ 3 - 2
pimd/pim_ssmpingd.c

@@ -96,7 +96,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
   sockaddr.sin_addr   = addr;
   sockaddr.sin_port   = htons(port);
 
-  if (bind(fd, &sockaddr, sizeof(sockaddr))) {
+  if (bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
     char addr_str[100];
     pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
     zlog_warn("%s: bind(fd=%d,addr=%s,port=%d,len=%zu) failure: errno=%d: %s",
@@ -222,7 +222,8 @@ static void ssmpingd_sendto(struct ssmpingd_sock *ss,
   socklen_t tolen = sizeof(to);
   int sent;
 
-  sent = sendto(ss->sock_fd, buf, len, MSG_DONTWAIT, &to, tolen);
+  sent = sendto(ss->sock_fd, buf, len, MSG_DONTWAIT,
+                (struct sockaddr *)&to, tolen);
   if (sent != len) {
     int e = errno;
     char to_str[100];

+ 2 - 0
pimd/pim_zebra.c

@@ -51,6 +51,7 @@ static int del_oif(struct channel_oil *channel_oil,
 		   struct interface *oif,
 		   uint32_t proto_mask);
 
+#if 0
 static void zclient_broken(struct zclient *zclient)
 {
   struct listnode  *ifnode;
@@ -65,6 +66,7 @@ static void zclient_broken(struct zclient *zclient)
 
   /* upon return, zclient will discard connected addresses */
 }
+#endif
 
 /* Router-id update message from zebra. */
 static int pim_router_id_update_zebra(int command, struct zclient *zclient,

+ 1 - 1
ripd/Makefile.am

@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = librip.a

+ 3 - 3
ripd/rip_snmp.c

@@ -295,7 +295,7 @@ rip2PeerLookup (struct variable *v, oid name[], size_t *length,
 
       peer = rip_peer_lookup (addr);
 
-      if (peer->domain == name[v->namelen + sizeof (struct in_addr)])
+      if (peer->domain == (int)name[v->namelen + sizeof (struct in_addr)])
 	return peer;
 
       return NULL;
@@ -311,8 +311,8 @@ rip2PeerLookup (struct variable *v, oid name[], size_t *length,
       peer = rip_peer_lookup (addr);
       if (peer)
 	{
-	  if ((len < sizeof (struct in_addr) + 1) ||
-	      (peer->domain > name[v->namelen + sizeof (struct in_addr)]))
+	  if ((len < (int)sizeof (struct in_addr) + 1) ||
+	      (peer->domain > (int)name[v->namelen + sizeof (struct in_addr)]))
 	    {
 	      oid_copy_addr (name + v->namelen, &peer->addr,
 			     sizeof (struct in_addr));

+ 1 - 1
ripngd/Makefile.am

@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
 AM_LDFLAGS = $(PILDFLAGS)
 
 noinst_LIBRARIES = libripng.a

+ 2 - 2
ripngd/ripngd.c

@@ -236,7 +236,7 @@ ripng_recv_packet (int sock, u_char *buf, int bufsize,
   struct msghdr msg;
   struct iovec iov;
   struct cmsghdr  *cmsgptr;
-  struct in6_addr dst;
+  struct in6_addr dst = { .s6_addr = { 0 } };
 
   /* Ancillary data.  This store cmsghdr and in6_pktinfo.  But at this
      point I can't determine size of cmsghdr */
@@ -1317,7 +1317,7 @@ ripng_read (struct thread *thread)
   int sock;
   struct sockaddr_in6 from;
   struct ripng_packet *packet;
-  unsigned int ifindex;
+  unsigned int ifindex = 0;
   struct interface *ifp;
   int hoplimit = -1;
 

+ 2 - 2
tests/Makefile.am

@@ -36,14 +36,14 @@ check_PROGRAMS = testsig testsegv testbuffer testmemory heavy heavywq heavythrea
 
 test-commands-defun.c: ../vtysh/vtysh_cmd.c
 	sed \
-		-e '/"vtysh.h"/d' \
+		-e 's/"vtysh\.h"/"tests.h"/' \
 		-e 's/vtysh_init_cmd/test_init_cmd/' \
 		-e 's/VTYSH_[A-Z][A-Z_0-9]*/0/g' \
 		< ../vtysh/vtysh_cmd.c \
 		> test-commands-defun.c
 
 BUILT_SOURCES = test-commands-defun.c
-noinst_HEADERS = prng.h
+noinst_HEADERS = prng.h tests.h
 
 testsig_SOURCES = test-sig.c
 testsegv_SOURCES = test-segv.c

+ 1 - 1
tests/bgp_mp_attr_test.c

@@ -545,7 +545,7 @@ main (void)
     return -1;
   
   peer = peer_create_accept (bgp);
-  peer->host = "foo";
+  peer->host = (char *)"foo";
   
   for (i = AFI_IP; i < AFI_MAX; i++)
     for (j = SAFI_UNICAST; j < SAFI_MAX; j++)

+ 1 - 1
tests/bgp_mpath_test.c

@@ -252,7 +252,7 @@ run_bgp_mp_list (testcase_t *t)
   bgp_mp_list_add (&mp_list, &test_mp_list_info[3]);
   bgp_mp_list_add (&mp_list, &test_mp_list_info[0]);
 
-  for (i = 0, mp_node = listhead(&mp_list); i < test_mp_list_info_count;
+  for (i = 0, mp_node = mp_list.head; i < test_mp_list_info_count;
        i++, mp_node = listnextnode(mp_node))
     {
       info = listgetdata(mp_node);

+ 1 - 1
tests/ecommunity_test.c

@@ -132,7 +132,7 @@ parse_test (struct test_segment *t)
   
   printf ("%s: %s\n", t->name, t->desc);
 
-  ecom = ecommunity_parse (t->data, t->len);
+  ecom = ecommunity_parse ((u_int8_t *)t->data, t->len);
 
   printf ("ecom: %s\nvalidating...:\n", ecommunity_str (ecom));
 

+ 2 - 0
tests/heavy-thread.c

@@ -37,6 +37,8 @@
 #include "memory.h"
 #include "log.h"
 
+#include "tests.h"
+
 extern struct thread_master *master;
 
 enum

+ 2 - 0
tests/heavy-wq.c

@@ -36,6 +36,8 @@
 #include "workqueue.h"
 #include <math.h>
 
+#include "tests.h"
+
 extern struct thread_master *master;
 static struct work_queue *heavy_wq;
 

+ 2 - 0
tests/heavy.c

@@ -36,6 +36,8 @@
 #include "memory.h"
 #include <math.h>
 
+#include "tests.h"
+
 enum
 {
   ITERS_FIRST = 0,

+ 1 - 1
tests/main.c

@@ -52,7 +52,7 @@ DEFUN (daemon_exit,
 }
 
 static int timer_count;
-int
+static int
 test_timer (struct thread *thread)
 {
   int *count = THREAD_ARG(thread);

+ 0 - 35
tests/test-checksum.c

@@ -46,41 +46,6 @@ typedef uint16_t testoff_t;
 /* Fletcher Checksum -- Refer to RFC1008. */
 #define MODX                 4102
 
-/* Accumulator phase of checksum */
-static 
-struct acc_vals
-accumulate (u_char *buffer, testsz_t len, testoff_t off)
-{
-  u_int8_t *p;
-  u_int16_t *csum;
-  int i, partial_len;
-  struct acc_vals ret;
-  
-  csum = (u_int16_t *) (buffer + off);
-  *(csum) = 0;
-  
-  p = buffer;
-  ret.c0 = 0;
-  ret.c1 = 0;
-  
-  while (len != 0)
-    {
-      partial_len = MIN(len, MODX);
-
-      for (i = 0; i < partial_len; i++)
-	{
-	  ret.c0 = ret.c0 + *(p++);
-	  ret.c1 += ret.c0;
-	}
-
-      ret.c0 = ret.c0 % 255;
-      ret.c1 = ret.c1 % 255;
-
-      len -= partial_len;
-    }
-  return ret;
-}
-
 /* The final reduction phase.
  * This one should be the original ospfd version 
  */

+ 1 - 1
tests/test-segv.c

@@ -35,7 +35,7 @@ struct quagga_signal_t sigs[] =
 
 struct thread_master *master;
 
-int
+static int
 threadfunc (struct thread *thread)
 {
   int *null = NULL;

+ 3 - 3
tests/test-sig.c

@@ -22,19 +22,19 @@
 #include "lib/log.h"
 #include "lib/memory.h"
 
-void
+static void
 sighup (void)
 {
   printf ("processed hup\n");
 }
 
-void
+static void
 sigusr1 (void)
 {
   printf ("processed usr1\n");
 }
 
-void
+static void
 sigusr2 (void)