diff options
109 files changed, 554 insertions, 742 deletions
diff --git a/babeld/Makefile.am b/babeld/Makefile.am index 13922d0f..d34e180b 100644 --- a/babeld/Makefile.am +++ b/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 diff --git a/babeld/babeld.c b/babeld/babeld.c index 1ae3f042..eaa91b74 100644 --- a/babeld/babeld.c +++ b/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); diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am index 42f1f488..92fa10cd 100644 --- a/bgpd/Makefile.am +++ b/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 diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index cfa9bc14..0aec3ef1 100644 --- a/bgpd/bgp_aspath.c +++ b/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); } diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index be316daa..5c832edc 100644 --- a/bgpd/bgp_attr.c +++ b/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; diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index dd6c759f..05c30ff0 100644 --- a/bgpd/bgp_damp.c +++ b/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); } diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 482e76b7..04957d41 100644 --- a/bgpd/bgp_ecommunity.c +++ b/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; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f84a72dc..34cb7c0c 100644 --- a/bgpd/bgp_route.c +++ b/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); } diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 857781fe..416a3e51 100644 --- a/bgpd/bgp_routemap.c +++ b/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, diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 79aaa03a..0f4aeec8 100644 --- a/bgpd/bgp_snmp.c +++ b/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 diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 04a1d379..209a18c9 100644 --- a/bgpd/bgp_table.h +++ b/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; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e6a36605..00d766d6 100644 --- a/bgpd/bgp_vty.c +++ b/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); } diff --git a/buildtest.sh b/buildtest.sh index 3bc25f23..3dd8ed82 100755 --- a/buildtest.sh +++ b/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" diff --git a/configure.ac b/configure.ac index 2c72cff8..a82470cd 100755 --- a/configure.ac +++ b/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 ------------------------- diff --git a/isisd/Makefile.am b/isisd/Makefile.am index dba681b1..4e67b228 100644 --- a/isisd/Makefile.am +++ b/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 diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 414885fc..a3524362 100644 --- a/isisd/isis_adjacency.c +++ b/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)); diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index 4d5b1651..f6176ef7 100644 --- a/isisd/isis_bpf.c +++ b/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; } diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 3d9fb473..fdff819c 100644 --- a/isisd/isis_circuit.c +++ b/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; diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index 7ed481dc..d86fee04 100644 --- a/isisd/isis_circuit.h +++ b/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 diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index f2a7923d..88593de7 100644 --- a/isisd/isis_lsp.c +++ b/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]); diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 166dd7c0..02b50bf4 100644 --- a/isisd/isis_pdu.c +++ b/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)); diff --git a/isisd/isis_pfpacket.c b/isisd/isis_pfpacket.c index 4bc8717a..d2022645 100644 --- a/isisd/isis_pfpacket.c +++ b/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)); diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index fd93efa6..28525ce6 100644 --- a/isisd/isis_spf.c +++ b/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; diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index bbfa5d81..4fca072d 100644 --- a/isisd/isis_tlv.c +++ b/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)) { diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 2df74629..1ba0100d 100644 --- a/isisd/isis_zebra.c +++ b/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)); diff --git a/isisd/isisd.c b/isisd/isisd.c index ce6a2621..898dfd23 100644 --- a/isisd/isisd.c +++ b/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, diff --git a/isisd/topology/spgrid.c b/isisd/topology/spgrid.c index 611b6727..40147fb5 100644 --- a/isisd/topology/spgrid.c +++ b/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 ); diff --git a/lib/Makefile.am b/lib/Makefile.am index 5a806183..56837d86 100644 --- a/lib/Makefile.am +++ b/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 diff --git a/lib/buffer.c b/lib/buffer.c index 45e2e1c5..ee931010 100644 --- a/lib/buffer.c +++ b/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)); } diff --git a/lib/command.c b/lib/command.c index 83177895..f20065f1 100644 --- a/lib/command.c +++ b/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; diff --git a/lib/distribute.h b/lib/distribute.h index 5072016f..a2ffffd5 100644 --- a/lib/distribute.h +++ b/lib/distribute.h @@ -24,6 +24,7 @@ #include <zebra.h> #include "if.h" +#include "filter.h" /* Disctirubte list types. */ enum distribute_type diff --git a/lib/keychain.c b/lib/keychain.c index 762c4629..8a2fdd2e 100644 --- a/lib/keychain.c +++ b/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); @@ -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); @@ -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; diff --git a/lib/stream.c b/lib/stream.c index c6f20c85..e13da08b 100644 --- a/lib/stream.c +++ b/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)\ diff --git a/lib/table.h b/lib/table.h index ab357a07..ab7eb68c 100644 --- a/lib/table.h +++ b/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] @@ -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); diff --git a/lib/zclient.c b/lib/zclient.c index 41ecbb61..1e05d6dd 100644 --- a/lib/zclient.c +++ b/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; } diff --git a/lib/zclient.h b/lib/zclient.h index d0c5450b..a51b3def 100644 --- a/lib/zclient.h +++ b/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); diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am index d30ce581..cbd850f3 100644 --- a/ospf6d/Makefile.am +++ b/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 diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 772caff7..c9c90117 100644 --- a/ospf6d/ospf6_interface.c +++ b/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 diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 4ad7521e..6606c96d 100644 --- a/ospf6d/ospf6_intra.c +++ b/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); } } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 8eeb9959..3f008d3d 100644 --- a/ospf6d/ospf6_lsa.c +++ b/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]; } diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index f20c83b9..4e637970 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/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; diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 9e6b33e5..30927737 100644 --- a/ospf6d/ospf6_route.c +++ b/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 */ diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index c0dcf9f1..42eb69ea 100644 --- a/ospf6d/ospf6_route.h +++ b/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, diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 4be8be04..ef44e4c9 100644 --- a/ospf6d/ospf6_snmp.c +++ b/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; diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index d0e9101b..88e12853 100644 --- a/ospf6d/ospf6_spf.c +++ b/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; } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index e4e6f17a..7fffba83 100644 --- a/ospf6d/ospf6_top.c +++ b/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); diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index 4122b309..9e2efb41 100644 --- a/ospf6d/ospf6d.h +++ b/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 { \ diff --git a/ospfclient/Makefile.am b/ospfclient/Makefile.am index 09d2ba86..c4f0da83 100644 --- a/ospfclient/Makefile.am +++ b/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 diff --git a/ospfd/Makefile.am b/ospfd/Makefile.am index 4160bfcc..40f2cfe5 100644 --- a/ospfd/Makefile.am +++ b/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 diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index db1ccda7..92f68f75 100644 --- a/ospfd/ospf_apiserver.c +++ b/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; diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index 8aedc808..04240c15 100644 --- a/ospfd/ospf_ase.c +++ b/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; diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index ebcc717f..2e4e69dc 100644 --- a/ospfd/ospf_dump.c +++ b/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; } diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index d18314a9..c0b36228 100644 --- a/ospfd/ospf_flood.c +++ b/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 */ diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 94c31c9f..f032601a 100644 --- a/ospfd/ospf_lsa.c +++ b/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; diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c index f7cf60fd..b92e7494 100644 --- a/ospfd/ospf_lsdb.c +++ b/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; } diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 98b1af3b..b97e3a79 100644 --- a/ospfd/ospf_packet.c +++ b/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; } diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 7f7b1578..9f917769 100644 --- a/ospfd/ospf_snmp.c +++ b/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); diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 1fe8ab4b..58a39921 100644 --- a/ospfd/ospf_spf.c +++ b/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; } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index c605ce68..bcb89630 100644 --- a/ospfd/ospf_te.c +++ b/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; } diff --git a/pimd/Makefile.am b/pimd/Makefile.am index f13debd9..b82613a8 100644 --- a/pimd/Makefile.am +++ b/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 diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 6b2ac664..13812cd8 100644 --- a/pimd/pim_cmd.c +++ b/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, diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 3baddbfa..3657f2f9 100644 --- a/pimd/pim_igmpv3.c +++ b/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]; diff --git a/pimd/pim_int.c b/pimd/pim_int.c index 2ff1a116..0bdd772f 100644 --- a/pimd/pim_int.c +++ b/pimd/pim_int.c @@ -22,6 +22,7 @@ #include <string.h> #include <netinet/in.h> +#include <arpa/inet.h> #include "pim_int.h" diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index f6f4c953..f8ac650d 100644 --- a/pimd/pim_pim.c +++ b/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]; diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index fd1eac06..82e0722a 100644 --- a/pimd/pim_ssmpingd.c +++ b/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]; diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 6f241d59..129cbe4f 100644 --- a/pimd/pim_zebra.c +++ b/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, diff --git a/ripd/Makefile.am b/ripd/Makefile.am index 65a626dd..34c5f183 100644 --- a/ripd/Makefile.am +++ b/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 diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c index 2df815b0..2c7cd2c1 100644 --- a/ripd/rip_snmp.c +++ b/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)); diff --git a/ripngd/Makefile.am b/ripngd/Makefile.am index 9bd14ba0..0487459b 100644 --- a/ripngd/Makefile.am +++ b/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 diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 8c20a7a2..4c0b67df 100644 --- a/ripngd/ripngd.c +++ b/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; diff --git a/tests/Makefile.am b/tests/Makefile.am index 1fe28c70..b5420710 100644 --- a/tests/Makefile.am +++ b/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 diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c index 5f0e733d..d649e14d 100644 --- a/tests/bgp_mp_attr_test.c +++ b/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++) diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c index 3d0ecb78..35947537 100644 --- a/tests/bgp_mpath_test.c +++ b/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); diff --git a/tests/ecommunity_test.c b/tests/ecommunity_test.c index cd1681d5..f12aa71c 100644 --- a/tests/ecommunity_test.c +++ b/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)); diff --git a/tests/heavy-thread.c b/tests/heavy-thread.c index cd3a3b9d..c2e71c17 100644 --- a/tests/heavy-thread.c +++ b/tests/heavy-thread.c @@ -37,6 +37,8 @@ #include "memory.h" #include "log.h" +#include "tests.h" + extern struct thread_master *master; enum diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c index e5f688c2..2f133cc5 100644 --- a/tests/heavy-wq.c +++ b/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; diff --git a/tests/heavy.c b/tests/heavy.c index 577a4816..9af46c88 100644 --- a/tests/heavy.c +++ b/tests/heavy.c @@ -36,6 +36,8 @@ #include "memory.h" #include <math.h> +#include "tests.h" + enum { ITERS_FIRST = 0, diff --git a/tests/main.c b/tests/main.c index 5e7bdcb1..5396c7d5 100644 --- a/tests/main.c +++ b/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); diff --git a/tests/test-checksum.c b/tests/test-checksum.c index 9672e95a..b6741f30 100644 --- a/tests/test-checksum.c +++ b/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 */ diff --git a/tests/test-segv.c b/tests/test-segv.c index 55bd25a5..1b851fc3 100644 --- a/tests/test-segv.c +++ b/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; diff --git a/tests/test-sig.c b/tests/test-sig.c index 7415d7ae..f24da965 100644 --- a/tests/test-sig.c +++ b/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) { printf ("processed usr2\n"); diff --git a/tests/test-timer-correctness.c b/tests/test-timer-correctness.c index 94c8f1df..47c0b737 100644 --- a/tests/test-timer-correctness.c +++ b/tests/test-timer-correctness.c @@ -140,8 +140,9 @@ int main(int argc, char **argv) interval_msec = prng_rand(prng) % 5000; arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1); timers[i] = thread_add_timer_msec(master, timer_func, arg, interval_msec); - ret = snprintf(arg, TIMESTR_LEN + 1, "%ld.%06ld", - timers[i]->u.sands.tv_sec, timers[i]->u.sands.tv_usec); + ret = snprintf(arg, TIMESTR_LEN + 1, "%lld.%06lld", + (long long)timers[i]->u.sands.tv_sec, + (long long)timers[i]->u.sands.tv_usec); assert(ret > 0); assert((size_t)ret < TIMESTR_LEN + 1); timers_pending++; @@ -180,7 +181,9 @@ int main(int argc, char **argv) ret = snprintf(expected_buf + expected_buf_pos, expected_buf_len - expected_buf_pos, - "%ld.%06ld\n", alarms[i]->tv_sec, alarms[i]->tv_usec); + "%lld.%06lld\n", + (long long)alarms[i]->tv_sec, + (long long)alarms[i]->tv_usec); assert(ret > 0); expected_buf_pos += ret; assert(expected_buf_pos < expected_buf_len); diff --git a/tests/tests.h b/tests/tests.h new file mode 100644 index 00000000..a528e55f --- /dev/null +++ b/tests/tests.h @@ -0,0 +1,31 @@ +/* + * Test wrappers common header file + * + * Copyright (C) 2015 by David Lamparter, + * for Open Source Routing./ NetDEF, Inc. + * + * This file is part of Quagga + * + * Quagga is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * Quagga is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _QUAGGA_TESTS_H +#define _QUAGGA_TESTS_H + +extern void test_init (void); +extern void test_init_cmd (void); + +#endif /* _QUAGGA_TESTS_H */ diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am index a66615be..0cc6d5ba 100644 --- a/vtysh/Makefile.am +++ b/vtysh/Makefile.am @@ -5,7 +5,7 @@ DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" LIBS = @LIBS@ @CURSES@ @LIBPAM@ -AM_CFLAGS = $(PICFLAGS) +AM_CFLAGS = $(PICFLAGS) $(WERROR) AM_LDFLAGS = $(PILDFLAGS) bin_PROGRAMS = vtysh diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 984f8d39..fbbc88d0 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -251,7 +251,7 @@ vtysh_client_execute (struct vtysh_client *vclient, const char *line, FILE *fp) } } -void +static void vtysh_exit_ripd_only (void) { if (ripd_client) @@ -547,7 +547,7 @@ vtysh_config_from_file (struct vty *vty, FILE *fp) } /* We don't care about the point of the cursor when '?' is typed. */ -int +static int vtysh_rl_describe (void) { int ret; @@ -563,11 +563,11 @@ vtysh_rl_describe (void) if (vline == NULL) { vline = vector_init (1); - vector_set (vline, '\0'); + vector_set (vline, NULL); } else if (rl_end && isspace ((int) rl_line_buffer[rl_end - 1])) - vector_set (vline, '\0'); + vector_set (vline, NULL); describe = cmd_describe_command (vline, vty, &ret); @@ -657,7 +657,7 @@ command_generator (const char *text, int state) return NULL; if (rl_end && isspace ((int) rl_line_buffer[rl_end - 1])) - vector_set (vline, '\0'); + vector_set (vline, NULL); matched = cmd_complete_command (vline, vty, &complete_status); } @@ -821,7 +821,7 @@ static struct cmd_node keychain_key_node = extern struct cmd_node vty_node; /* When '^Z' is received from vty, move down to the enable mode. */ -int +static int vtysh_end (void) { switch (vty->node) @@ -1713,7 +1713,6 @@ DEFUN (vtysh_write_terminal, "Write to terminal\n") { u_int i; - int ret; char line[] = "write terminal\n"; FILE *fp = NULL; @@ -1735,7 +1734,7 @@ DEFUN (vtysh_write_terminal, vty_out (vty, "!%s", VTY_NEWLINE); for (i = 0; i < array_size(vtysh_client); i++) - ret = vtysh_client_config (&vtysh_client[i], line); + vtysh_client_config (&vtysh_client[i], line); /* Integrate vtysh specific configuration. */ vtysh_config_write (); @@ -1783,7 +1782,6 @@ static int write_config_integrated(void) { u_int i; - int ret; char line[] = "write terminal\n"; FILE *fp; char *integrate_sav = NULL; @@ -1809,7 +1807,7 @@ write_config_integrated(void) } for (i = 0; i < array_size(vtysh_client); i++) - ret = vtysh_client_config (&vtysh_client[i], line); + vtysh_client_config (&vtysh_client[i], line); vtysh_config_dump (fp); @@ -1948,7 +1946,6 @@ static int execute_command (const char *command, int argc, const char *arg1, const char *arg2) { - int ret; pid_t pid; int status; @@ -1967,13 +1964,13 @@ execute_command (const char *command, int argc, const char *arg1, switch (argc) { case 0: - ret = execlp (command, command, (const char *)NULL); + execlp (command, command, (const char *)NULL); break; case 1: - ret = execlp (command, command, arg1, (const char *)NULL); + execlp (command, command, arg1, (const char *)NULL); break; case 2: - ret = execlp (command, command, arg1, arg2, (const char *)NULL); + execlp (command, command, arg1, arg2, (const char *)NULL); break; } @@ -1985,7 +1982,7 @@ execute_command (const char *command, int argc, const char *arg1, { /* This is parent. */ execute_flag = 1; - ret = wait4 (pid, &status, 0, NULL); + wait4 (pid, &status, 0, NULL); execute_flag = 0; } return 0; diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index f9cb6a79..1ddaac05 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -47,19 +47,19 @@ struct config struct list *config_top; -int +static int line_cmp (char *c1, char *c2) { return strcmp (c1, c2); } -void +static void line_del (char *line) { XFREE (MTYPE_VTYSH_CONFIG_LINE, line); } -struct config * +static struct config * config_new () { struct config *config; @@ -67,13 +67,13 @@ config_new () return config; } -int +static int config_cmp (struct config *c1, struct config *c2) { return strcmp (c1->name, c2->name); } -void +static void config_del (struct config* config) { list_delete (config->line); @@ -82,7 +82,7 @@ config_del (struct config* config) XFREE (MTYPE_VTYSH_CONFIG, config); } -struct config * +static struct config * config_get (int index, const char *line) { struct config *config; @@ -121,13 +121,13 @@ config_get (int index, const char *line) return config; } -void +static void config_add_line (struct list *config, const char *line) { listnode_add (config, XSTRDUP (MTYPE_VTYSH_CONFIG_LINE, line)); } -void +static void config_add_line_uniq (struct list *config, const char *line) { struct listnode *node, *nnode; @@ -141,7 +141,7 @@ config_add_line_uniq (struct list *config, const char *line) listnode_add_sort (config, XSTRDUP (MTYPE_VTYSH_CONFIG_LINE, line)); } -void +static void vtysh_config_parse_line (const char *line) { char c; diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 48958f0f..aa7d0218 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -63,7 +63,7 @@ struct thread_master *master; FILE *logfile; /* SIGTSTP handler. This function care user's ^Z input. */ -void +static void sigtstp (int sig) { /* Execute "end" command. */ @@ -84,7 +84,7 @@ sigtstp (int sig) } /* SIGINT handler. This function care user's ^Z input. */ -void +static void sigint (int sig) { /* Check this process is not child process. */ @@ -98,10 +98,9 @@ sigint (int sig) /* Signale wrapper for vtysh. We don't use sigevent because * vtysh doesn't use threads. TODO */ -RETSIGTYPE * +static void vtysh_signal_set (int signo, void (*func)(int)) { - int ret; struct sigaction sig; struct sigaction osig; @@ -112,16 +111,11 @@ vtysh_signal_set (int signo, void (*func)(int)) sig.sa_flags |= SA_RESTART; #endif /* SA_RESTART */ - ret = sigaction (signo, &sig, &osig); - - if (ret < 0) - return (SIG_ERR); - else - return (osig.sa_handler); + sigaction (signo, &sig, &osig); } /* Initialization of signal handles. */ -void +static void vtysh_signal_init () { vtysh_signal_set (SIGINT, sigint); @@ -168,7 +162,7 @@ struct option longopts[] = }; /* Read a string, and return a pointer to it. Returns NULL on EOF. */ -char * +static char * vtysh_rl_gets () { HIST_ENTRY *last; @@ -202,9 +196,12 @@ static void log_it(const char *line) { time_t t = time(NULL); struct tm *tmp = localtime(&t); - char *user = getenv("USER") ? : "boot"; + const char *user = getenv("USER"); char tod[64]; + if (!user) + user = "boot"; + strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp); fprintf(logfile, "%s:%s %s\n", tod, user, line); diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index 58676c10..e1c611ce 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -37,6 +37,7 @@ #include "memory.h" #include "linklist.h" #include "command.h" +#include "vtysh_user.h" #ifdef USE_PAM static struct pam_conv conv = @@ -98,19 +99,21 @@ struct vtysh_user struct list *userlist; -struct vtysh_user * +static struct vtysh_user * user_new () { return XCALLOC (0, sizeof (struct vtysh_user)); } -void +#if 0 +static void user_free (struct vtysh_user *user) { XFREE (0, user); } +#endif -struct vtysh_user * +static struct vtysh_user * user_lookup (const char *name) { struct listnode *node, *nnode; @@ -124,7 +127,8 @@ user_lookup (const char *name) return NULL; } -void +#if 0 +static void user_config_write () { struct listnode *node, *nnode; @@ -136,8 +140,9 @@ user_config_write () printf (" username %s nopassword\n", user->name); } } +#endif -struct vtysh_user * +static struct vtysh_user * user_get (const char *name) { struct vtysh_user *user; @@ -166,7 +171,7 @@ DEFUN (username_nopassword, } int -vtysh_auth () +vtysh_auth (void) { struct vtysh_user *user; struct passwd *passwd; @@ -187,7 +192,7 @@ vtysh_auth () } void -vtysh_user_init () +vtysh_user_init (void) { userlist = list_new (); install_element (CONFIG_NODE, &username_nopassword_cmd); diff --git a/vtysh/vtysh_user.h b/vtysh/vtysh_user.h index 8d0a4cf6..c485c23f 100644 --- a/vtysh/vtysh_user.h +++ b/vtysh/vtysh_user.h @@ -22,6 +22,7 @@ #ifndef _VTYSH_USER_H #define _VTYSH_USER_H -int vtysh_auth (); +int vtysh_auth (void); +void vtysh_user_init (void); #endif /* _VTYSH_USER_H */ diff --git a/watchquagga/Makefile.am b/watchquagga/Makefile.am index 9256006c..939ecd71 100644 --- a/watchquagga/Makefile.am +++ b/watchquagga/Makefile.am @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib DEFS = @DEFS@ -DSTATEDIR=\"$(localstatedir)/\" -AM_CFLAGS = $(PICFLAGS) +AM_CFLAGS = $(PICFLAGS) $(WERROR) AM_LDFLAGS = $(PILDFLAGS) sbin_PROGRAMS = watchquagga diff --git a/watchquagga/watchquagga.c b/watchquagga/watchquagga.c index c1c88921..d92803d7 100644 --- a/watchquagga/watchquagga.c +++ b/watchquagga/watchquagga.c @@ -215,7 +215,8 @@ usage(const char *progname, int status) if (status != 0) fprintf(stderr, "Try `%s --help' for more information.\n", progname); else - printf("Usage : %s [OPTION...] <daemon name> ...\n\n\ + { + printf("Usage : %s [OPTION...] <daemon name> ...\n\n\ Watchdog program to monitor status of quagga daemons and try to restart\n\ them if they are down or unresponsive. It determines whether a daemon is\n\ up based on whether it can connect to the daemon's vty unix stream socket.\n\ @@ -259,8 +260,12 @@ the -m and -M options allow you to control the minimum delay between\n\ restart commands. The minimum restart delay is recalculated each time\n\ a restart is attempted: if the time since the last restart attempt exceeds\n\ twice the -M value, then the restart delay is set to the -m value.\n\ -Otherwise, the interval is doubled (but capped at the -M value).\n\n\ -Options:\n\ +Otherwise, the interval is doubled (but capped at the -M value).\n\n", + progname,mode_str[0],progname,mode_str[1],progname,mode_str[2], + progname,mode_str[3],progname,mode_str[4],progname,mode_str[2], + mode_str[3]); + + printf("Options:\n\ -d, --daemon Run in daemon mode. In this mode, error messages are sent\n\ to syslog instead of stdout.\n\ -S, --statedir Set the vty socket directory (default is %s)\n\ @@ -318,12 +323,12 @@ Options:\n\ it with a space. This is an ugly hack to circumvent problems\n\ passing command-line arguments with embedded spaces.\n\ -v, --version Print program version\n\ --h, --help Display this help and exit\n\ -", progname,mode_str[0],progname,mode_str[1],progname,mode_str[2], -progname,mode_str[3],progname,mode_str[4],progname,mode_str[2],mode_str[3], -VTYDIR,DEFAULT_LOGLEVEL,LOG_EMERG,LOG_DEBUG,LOG_DEBUG, -DEFAULT_MIN_RESTART,DEFAULT_MAX_RESTART, -DEFAULT_PERIOD,DEFAULT_TIMEOUT,DEFAULT_RESTART_TIMEOUT,DEFAULT_PIDFILE); +-h, --help Display this help and exit\n", + VTYDIR,DEFAULT_LOGLEVEL,LOG_EMERG,LOG_DEBUG,LOG_DEBUG, + DEFAULT_MIN_RESTART,DEFAULT_MAX_RESTART, + DEFAULT_PERIOD,DEFAULT_TIMEOUT,DEFAULT_RESTART_TIMEOUT, + DEFAULT_PIDFILE); + } return status; } @@ -381,7 +386,7 @@ restart_kill(struct thread *t_kill) time_elapsed(&delay,&restart->time); zlog_warn("Warning: %s %s child process %d still running after " "%ld seconds, sending signal %d", - restart->what,restart->name,(int)restart->pid,delay.tv_sec, + restart->what,restart->name,(int)restart->pid, (long)delay.tv_sec, (restart->kills ? SIGKILL : SIGTERM)); kill(-restart->pid,(restart->kills ? SIGKILL : SIGTERM)); restart->kills++; @@ -654,15 +659,17 @@ handle_read(struct thread *t_read) { dmn->state = DAEMON_UP; zlog_warn("%s state -> up : echo response received after %ld.%06ld " - "seconds", dmn->name,delay.tv_sec,delay.tv_usec); + "seconds", dmn->name, + (long)delay.tv_sec, (long)delay.tv_usec); } else zlog_warn("%s: slow echo response finally received after %ld.%06ld " - "seconds", dmn->name,delay.tv_sec,delay.tv_usec); + "seconds", dmn->name, + (long)delay.tv_sec, (long)delay.tv_usec); } else if (gs.loglevel > LOG_DEBUG+1) zlog_debug("%s: echo response received after %ld.%06ld seconds", - dmn->name,delay.tv_sec,delay.tv_usec); + dmn->name, (long)delay.tv_sec, (long)delay.tv_usec); SET_READ_HANDLER(dmn); if (dmn->t_wakeup) diff --git a/zebra/Makefile.am b/zebra/Makefile.am index 48087917..7dcbd660 100644 --- a/zebra/Makefile.am +++ b/zebra/Makefile.am @@ -20,7 +20,7 @@ if HAVE_NETLINK othersrc = zebra_fpm_netlink.c endif -AM_CFLAGS = $(PICFLAGS) +AM_CFLAGS = $(PICFLAGS) $(WERROR) AM_LDFLAGS = $(PILDFLAGS) sbin_PROGRAMS = zebra diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 86bd8ffe..87014160 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -23,12 +23,11 @@ #include <zebra.h> #include "zebra/zserv.h" - -extern int interface_lookup_netlink (void); +#include "rt_netlink.h" /* Interface information read by netlink. */ void interface_list (void) { - interface_lookup_netlink (); + interface_lookup_netlink (); } diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c index 5e809964..ffa6927d 100644 --- a/zebra/if_sysctl.c +++ b/zebra/if_sysctl.c @@ -29,6 +29,7 @@ #include "memory.h" #include "ioctl.h" #include "log.h" +#include "interface.h" #include "zebra/rt.h" #include "zebra/kernel_socket.h" diff --git a/zebra/interface.c b/zebra/interface.c index 0271061e..54d8b103 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -836,24 +836,29 @@ if_dump_vty (struct vty *vty, struct interface *ifp) #ifdef HAVE_NET_RT_IFLIST #if defined (__bsdi__) || defined (__NetBSD__) /* Statistics print out using sysctl (). */ - vty_out (vty, " input packets %qu, bytes %qu, dropped %qu," - " multicast packets %qu%s", - ifp->stats.ifi_ipackets, ifp->stats.ifi_ibytes, - ifp->stats.ifi_iqdrops, ifp->stats.ifi_imcasts, - VTY_NEWLINE); - - vty_out (vty, " input errors %qu%s", - ifp->stats.ifi_ierrors, VTY_NEWLINE); - - vty_out (vty, " output packets %qu, bytes %qu, multicast packets %qu%s", - ifp->stats.ifi_opackets, ifp->stats.ifi_obytes, - ifp->stats.ifi_omcasts, VTY_NEWLINE); - - vty_out (vty, " output errors %qu%s", - ifp->stats.ifi_oerrors, VTY_NEWLINE); - - vty_out (vty, " collisions %qu%s", - ifp->stats.ifi_collisions, VTY_NEWLINE); + vty_out (vty, " input packets %llu, bytes %llu, dropped %llu," + " multicast packets %llu%s", + (unsigned long long)ifp->stats.ifi_ipackets, + (unsigned long long)ifp->stats.ifi_ibytes, + (unsigned long long)ifp->stats.ifi_iqdrops, + (unsigned long long)ifp->stats.ifi_imcasts, + VTY_NEWLINE); + + vty_out (vty, " input errors %llu%s", + (unsigned long long)ifp->stats.ifi_ierrors, VTY_NEWLINE); + + vty_out (vty, " output packets %llu, bytes %llu," + " multicast packets %llu%s", + (unsigned long long)ifp->stats.ifi_opackets, + (unsigned long long)ifp->stats.ifi_obytes, + (unsigned long long)ifp->stats.ifi_omcasts, + VTY_NEWLINE); + + vty_out (vty, " output errors %llu%s", + (unsigned long long)ifp->stats.ifi_oerrors, VTY_NEWLINE); + + vty_out (vty, " collisions %llu%s", + (unsigned long long)ifp->stats.ifi_collisions, VTY_NEWLINE); #else /* Statistics print out using sysctl (). */ vty_out (vty, " input packets %lu, bytes %lu, dropped %lu," diff --git a/zebra/ioctl.c b/zebra/ioctl.c index d783b0a3..f7a7ff40 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -52,7 +52,7 @@ if_ioctl (u_long request, caddr_t buffer) { int sock; int ret; - int err; + int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) zlog (NULL, LOG_ERR, "Can't raise privileges"); @@ -85,7 +85,7 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) { int sock; int ret; - int err; + int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) zlog (NULL, LOG_ERR, "Can't raise privileges"); diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 75534916..916dad97 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -58,6 +58,12 @@ extern struct zebra_t zebrad; * Because of these varying conventions, the only sane approach is for * the <net/route.h> header to define some flavor of ROUNDUP macro. */ + +#if defined(SA_SIZE) +/* SAROUNDUP is the only thing we need, and SA_SIZE provides that */ +#define SAROUNDUP(a) SA_SIZE(a) +#else /* !SA_SIZE */ + #if defined(RT_ROUNDUP) #define ROUNDUP(a) RT_ROUNDUP(a) #endif /* defined(RT_ROUNDUP) */ @@ -114,6 +120,8 @@ extern struct zebra_t zebrad; ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr))) #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ +#endif /* !SA_SIZE */ + /* * We use a call to an inline function to copy (PNT) to (DEST) * 1. Calculating the length of the copy requires an #ifdef to determine @@ -121,7 +129,7 @@ extern struct zebra_t zebrad; * 2. So the compiler doesn't complain when DEST is NULL, which is only true * when we are skipping the copy and incrementing to the next SA */ -static void inline +static inline void rta_copy (union sockunion *dest, caddr_t src) { int len; #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN @@ -271,7 +279,7 @@ int routing_sock = -1; /* #define DEBUG */ /* Supported address family check. */ -static int inline +static inline int af_check (int family) { if (family == AF_INET) @@ -1114,15 +1122,6 @@ rtm_write (int message, msg.rtm.rtm_flags |= RTF_REJECT; -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN -#define SOCKADDRSET(X,R) \ - if (msg.rtm.rtm_addrs & (R)) \ - { \ - int len = ROUNDUP ((X)->sa.sa_len); \ - memcpy (pnt, (caddr_t)(X), len); \ - pnt += len; \ - } -#else #define SOCKADDRSET(X,R) \ if (msg.rtm.rtm_addrs & (R)) \ { \ @@ -1130,7 +1129,6 @@ rtm_write (int message, memcpy (pnt, (caddr_t)(X), len); \ pnt += len; \ } -#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ pnt = (caddr_t) msg.buf; diff --git a/zebra/misc_null.c b/zebra/misc_null.c index b4416e63..18977d2f 100644 --- a/zebra/misc_null.c +++ b/zebra/misc_null.c @@ -27,16 +27,27 @@ #include "zebra/interface.h" #include "zebra/zebra_fpm.h" -void ifstat_update_proc (void) { return; } #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA -#pragma weak rtadv_config_write = ifstat_update_proc -#pragma weak irdp_config_write = ifstat_update_proc -#pragma weak ifstat_update_sysctl = ifstat_update_proc +void _quagga_noop (void); +void _quagga_noop (void) { return; } +#pragma weak rtadv_config_write = _quagga_noop +#pragma weak irdp_config_write = _quagga_noop +#ifdef HAVE_NET_RT_IFLIST +#pragma weak ifstat_update_sysctl = _quagga_noop +#endif +#ifdef HAVE_PROC_NET_DEV +#pragma weak ifstat_update_proc = _quagga_noop +#endif #else void rtadv_config_write (struct vty *vty, struct interface *ifp) { return; } void irdp_config_write (struct vty *vty, struct interface *ifp) { return; } +#ifdef HAVE_PROC_NET_DEV +void ifstat_update_proc (void) { return; } +#endif +#ifdef HAVE_NET_RT_IFLIST void ifstat_update_sysctl (void) { return; } #endif +#endif void zfpm_trigger_update (struct route_node *rn, const char *reason) diff --git a/zebra/router-id.c b/zebra/router-id.c index 94a29419..bfafc272 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -245,8 +245,8 @@ router_id_init (void) 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; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 2350070c..7e410729 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1368,80 +1368,6 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl) return netlink_parse_info (netlink_talk_filter, nl); } -/* Routing table change via netlink interface. */ -static int -netlink_route (int cmd, int family, void *dest, int length, void *gate, - int index, int zebra_flags, int table) -{ - int ret; - int bytelen; - struct sockaddr_nl snl; - int discard; - - struct - { - struct nlmsghdr n; - struct rtmsg r; - char buf[NL_PKT_BUF_SIZE]; - } req; - - memset (&req, 0, sizeof req - NL_PKT_BUF_SIZE); - - bytelen = (family == AF_INET ? 4 : 16); - - req.n.nlmsg_len = NLMSG_LENGTH (sizeof (struct rtmsg)); - req.n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST; - req.n.nlmsg_type = cmd; - req.r.rtm_family = family; - req.r.rtm_table = table; - req.r.rtm_dst_len = length; - req.r.rtm_protocol = RTPROT_ZEBRA; - req.r.rtm_scope = RT_SCOPE_UNIVERSE; - - if ((zebra_flags & ZEBRA_FLAG_BLACKHOLE) - || (zebra_flags & ZEBRA_FLAG_REJECT)) - discard = 1; - else - discard = 0; - - if (cmd == RTM_NEWROUTE) - { - if (discard) - { - if (zebra_flags & ZEBRA_FLAG_BLACKHOLE) - req.r.rtm_type = RTN_BLACKHOLE; - else if (zebra_flags & ZEBRA_FLAG_REJECT) - req.r.rtm_type = RTN_UNREACHABLE; - else - assert (RTN_BLACKHOLE != RTN_UNREACHABLE); /* false */ - } - else - req.r.rtm_type = RTN_UNICAST; - } - - if (dest) - addattr_l (&req.n, sizeof req, RTA_DST, dest, bytelen); - - if (!discard) - { - if (gate) - addattr_l (&req.n, sizeof req, RTA_GATEWAY, gate, bytelen); - if (index > 0) - addattr32 (&req.n, sizeof req, RTA_OIF, index); - } - - /* Destination netlink address. */ - memset (&snl, 0, sizeof snl); - snl.nl_family = AF_NETLINK; - - /* Talk to netlink socket. */ - ret = netlink_talk (&req.n, &netlink_cmd); - if (ret < 0) - return -1; - - return 0; -} - /* This function takes a nexthop as argument and adds * the appropriate netlink attributes to an existing * netlink message. diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index 0facd49e..d8f9db85 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -41,6 +41,9 @@ extern const char * nl_rtproto_to_str (u_char rtproto); +extern int interface_lookup_netlink (void); +extern int netlink_route_read (void); + #endif /* HAVE_NETLINK */ #endif /* _ZEBRA_RT_NETLINK_H */ diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 63470adc..d8c947c6 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -271,67 +271,6 @@ sin6_masklen (struct in6_addr mask) /* Interface between zebra message and rtm message. */ static int -kernel_rtm_ipv6 (int message, struct prefix_ipv6 *dest, - struct in6_addr *gate, int index, int flags) -{ - struct sockaddr_in6 *mask; - struct sockaddr_in6 sin_dest, sin_mask, sin_gate; - - memset (&sin_dest, 0, sizeof (struct sockaddr_in6)); - sin_dest.sin6_family = AF_INET6; -#ifdef SIN6_LEN - sin_dest.sin6_len = sizeof (struct sockaddr_in6); -#endif /* SIN6_LEN */ - - memset (&sin_mask, 0, sizeof (struct sockaddr_in6)); - - memset (&sin_gate, 0, sizeof (struct sockaddr_in6)); - sin_gate.sin6_family = AF_INET6; -#ifdef SIN6_LEN - sin_gate.sin6_len = sizeof (struct sockaddr_in6); -#endif /* SIN6_LEN */ - - sin_dest.sin6_addr = dest->prefix; - - if (gate) - memcpy (&sin_gate.sin6_addr, gate, sizeof (struct in6_addr)); - - /* Under kame set interface index to link local address. */ -#ifdef KAME - -#define SET_IN6_LINKLOCAL_IFINDEX(a, i) \ - do { \ - (a).s6_addr[2] = ((i) >> 8) & 0xff; \ - (a).s6_addr[3] = (i) & 0xff; \ - } while (0) - - if (gate && IN6_IS_ADDR_LINKLOCAL(gate)) - SET_IN6_LINKLOCAL_IFINDEX (sin_gate.sin6_addr, index); -#endif /* KAME */ - - if (gate && dest->prefixlen == 128) - mask = NULL; - else - { - masklen2ip6 (dest->prefixlen, &sin_mask.sin6_addr); - sin_mask.sin6_family = AF_INET6; -#ifdef SIN6_LEN - sin_mask.sin6_len = sin6_masklen (sin_mask.sin6_addr); -#endif /* SIN6_LEN */ - mask = &sin_mask; - } - - return rtm_write (message, - (union sockunion *) &sin_dest, - (union sockunion *) mask, - gate ? (union sockunion *)&sin_gate : NULL, - index, - flags, - 0); -} - -/* Interface between zebra message and rtm message. */ -static int kernel_rtm_ipv6_multipath (int cmd, struct prefix *p, struct rib *rib, int family) { diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 21ca6da9..9a3fd265 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1201,7 +1201,8 @@ DEFUN (ipv6_nd_prefix, if (argc > 1) { - if ((isdigit(argv[1][0])) || strncmp (argv[1], "i", 1) == 0) + if ((isdigit((unsigned char)argv[1][0])) + || strncmp (argv[1], "i", 1) == 0) { if ( strncmp (argv[1], "i", 1) == 0) rp.AdvValidLifetime = UINT32_MAX; diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c index 066e8443..7abbc590 100644 --- a/zebra/rtread_netlink.c +++ b/zebra/rtread_netlink.c @@ -23,8 +23,7 @@ #include <zebra.h> #include "zebra/zserv.h" - -extern void netlink_route_read (void); +#include "rt_netlink.h" void route_read (void) { diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 0750e6eb..cc7f48fa 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -78,7 +78,7 @@ static vector vrf_vector; /* RPF lookup behaviour */ static enum multicast_mode ipv4_multicast_mode = MCAST_NO_CONFIG; -static void +static void __attribute__((format (printf, 4, 5))) _rnode_zlog(const char *_func, struct route_node *rn, int priority, const char *msgfmt, ...) { @@ -1394,8 +1394,9 @@ rib_process (struct route_node *rn) if (rib != fib) { if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "rn %p, removing rib %p", rn, rib); - rib_unlink (rn, rib); + rnode_debug (rn, "rn %p, removing rib %p", + (void *)rn, (void *)rib); + rib_unlink (rn, rib); } else del = rib; @@ -1466,7 +1467,7 @@ rib_process (struct route_node *rn) { if (IS_ZEBRA_DEBUG_RIB) rnode_debug (rn, "Updating existing route, select %p, fib %p", - select, fib); + (void *)select, (void *)fib); if (CHECK_FLAG (select->flags, ZEBRA_FLAG_CHANGED)) { if (info->safi == SAFI_UNICAST) @@ -1511,7 +1512,7 @@ rib_process (struct route_node *rn) if (fib) { if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "Removing existing route, fib %p", fib); + rnode_debug (rn, "Removing existing route, fib %p", (void *)fib); if (info->safi == SAFI_UNICAST) zfpm_trigger_update (rn, "removing existing route"); @@ -1532,7 +1533,7 @@ rib_process (struct route_node *rn) if (select) { if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "Adding route, select %p", select); + rnode_debug (rn, "Adding route, select %p", (void *)select); if (info->safi == SAFI_UNICAST) zfpm_trigger_update (rn, "new route selected"); @@ -1550,13 +1551,13 @@ rib_process (struct route_node *rn) if (del) { if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "Deleting fib %p, rn %p", del, rn); + rnode_debug (rn, "Deleting fib %p, rn %p", (void *)del, (void *)rn); rib_unlink (rn, del); } end: if (IS_ZEBRA_DEBUG_RIB_Q) - rnode_debug (rn, "rn %p dequeued", rn); + rnode_debug (rn, "rn %p dequeued", (void *)rn); /* * Check if the dest can be deleted now. @@ -1651,7 +1652,7 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn) { if (IS_ZEBRA_DEBUG_RIB_Q) rnode_debug (rn, "rn %p is already queued in sub-queue %u", - rn, qindex); + (void *)rn, qindex); continue; } @@ -1662,7 +1663,7 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn) if (IS_ZEBRA_DEBUG_RIB_Q) rnode_debug (rn, "queued rn %p into sub-queue %u", - rn, qindex); + (void *)rn, qindex); } } @@ -1676,7 +1677,7 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn) if (!rnode_to_ribs (rn)) { zlog_debug ("%s: called for route_node (%p, %d) with no ribs", - __func__, rn, rn->lock); + __func__, (void *)rn, rn->lock); zlog_backtrace(LOG_DEBUG); return; } @@ -1706,7 +1707,7 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn) rib_meta_queue_add (zebra->mq, rn); if (IS_ZEBRA_DEBUG_RIB_Q) - rnode_debug (rn, "rn %p queued", rn); + rnode_debug (rn, "rn %p queued", (void *)rn); return; } @@ -1807,7 +1808,7 @@ rib_link (struct route_node *rn, struct rib *rib) assert (rib && rn); if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "rn %p, rib %p", rn, rib); + rnode_debug (rn, "rn %p, rib %p", (void *)rn, (void *)rib); dest = rib_dest_from_rnode (rn); if (!dest) @@ -1840,7 +1841,7 @@ rib_addnode (struct route_node *rn, struct rib *rib) if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED)) { if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "rn %p, un-removed rib %p", rn, rib); + rnode_debug (rn, "rn %p, un-removed rib %p", (void *)rn, (void *)rib); UNSET_FLAG (rib->status, RIB_ENTRY_REMOVED); return; @@ -1865,7 +1866,7 @@ rib_unlink (struct route_node *rn, struct rib *rib) assert (rn && rib); if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "rn %p, rib %p", rn, rib); + rnode_debug (rn, "rn %p, rib %p", (void *)rn, (void *)rib); dest = rib_dest_from_rnode (rn); @@ -1889,7 +1890,7 @@ static void rib_delnode (struct route_node *rn, struct rib *rib) { if (IS_ZEBRA_DEBUG_RIB) - rnode_debug (rn, "rn %p, rib %p, removing", rn, rib); + rnode_debug (rn, "rn %p, rib %p, removing", (void *)rn, (void *)rib); SET_FLAG (rib->status, RIB_ENTRY_REMOVED); rib_queue_add (&zebrad, rn); } @@ -1983,14 +1984,16 @@ rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p, /* Link new rib to node.*/ if (IS_ZEBRA_DEBUG_RIB) - zlog_debug ("%s: calling rib_addnode (%p, %p)", __func__, rn, rib); + zlog_debug ("%s: calling rib_addnode (%p, %p)", + __func__, (void *)rn, (void *)rib); rib_addnode (rn, rib); /* Free implicit route.*/ if (same) { if (IS_ZEBRA_DEBUG_RIB) - zlog_debug ("%s: calling rib_delnode (%p, %p)", __func__, rn, rib); + zlog_debug ("%s: calling rib_delnode (%p, %p)", + __func__, (void *)rn, (void *)rib); rib_delnode (rn, same); } @@ -2012,7 +2015,8 @@ void _rib_dump (const char * func, int recursing; inet_ntop (p->family, &p->u.prefix, straddr, INET6_ADDRSTRLEN); - zlog_debug ("%s: dumping RIB entry %p for %s/%d", func, rib, straddr, p->prefixlen); + zlog_debug ("%s: dumping RIB entry %p for %s/%d", func, (void *)rib, + straddr, p->prefixlen); zlog_debug ( "%s: refcnt == %lu, uptime == %lu, type == %u, table == %d", @@ -2097,8 +2101,8 @@ void rib_lookup_and_dump (struct prefix_ipv4 * p) ( "%s: rn %p, rib %p: %s, %s", __func__, - rn, - rib, + (void *)rn, + (void *)rib, (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED) ? "removed" : "NOT removed"), (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) ? "selected" : "NOT selected") ); @@ -2210,7 +2214,7 @@ rib_add_ipv4_multipath (struct prefix_ipv4 *p, struct rib *rib, safi_t safi) if (IS_ZEBRA_DEBUG_RIB) { zlog_debug ("%s: called rib_addnode (%p, %p) on new RIB entry", - __func__, rn, rib); + __func__, (void *)rn, (void *)rib); rib_dump (p, rib); } @@ -2220,7 +2224,7 @@ rib_add_ipv4_multipath (struct prefix_ipv4 *p, struct rib *rib, safi_t safi) if (IS_ZEBRA_DEBUG_RIB) { zlog_debug ("%s: calling rib_delnode (%p, %p) on existing RIB entry", - __func__, rn, same); + __func__, (void *)rn, (void *)same); rib_dump (p, same); } rib_delnode (rn, same); @@ -2771,7 +2775,7 @@ rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p, if (IS_ZEBRA_DEBUG_RIB) { zlog_debug ("%s: called rib_addnode (%p, %p) on new RIB entry", - __func__, rn, rib); + __func__, (void *)rn, (void *)rib); rib_dump (p, rib); } @@ -2781,7 +2785,7 @@ rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p, if (IS_ZEBRA_DEBUG_RIB) { zlog_debug ("%s: calling rib_delnode (%p, %p) on existing RIB entry", - __func__, rn, same); + __func__, (void *)rn, (void *)same); rib_dump (p, same); } rib_delnode (rn, same); diff --git a/zebra/zserv.c b/zebra/zserv.c index afd722a1..432c3182 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1558,7 +1558,7 @@ zebra_serv () zebra_event (ZEBRA_SERV, accept_sock, NULL); } -#endif /* HAVE_TCP_ZEBRA */ +#else /* HAVE_TCP_ZEBRA */ /* For sockaddr_un. */ #include <sys/un.h> @@ -1624,6 +1624,7 @@ zebra_serv_un (const char *path) zebra_event (ZEBRA_SERV, sock, NULL); } +#endif /* HAVE_TCP_ZEBRA */ static void |