From 9a8a7b0ed1e9f464ab26b6271940eb802b6c77f5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 7 Jun 2019 09:25:53 -0400 Subject: [PATCH 1/4] lib, pimd, sharpd: Various output string cleanups Various compilers in our CI system were complaining about various auto-conversions. Let's get these cleaned up a bit more. Signed-off-by: Donald Sharp --- lib/plist.c | 2 +- lib/thread.c | 2 +- pimd/pim_cmd.c | 12 +++++++----- sharpd/sharp_vty.c | 2 +- sharpd/sharp_zebra.c | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index 9957ff1f51..54ea742c66 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1009,7 +1009,7 @@ static int vty_prefix_list_uninstall(struct vty *vty, afi_t afi, if (pentry == NULL) { vty_out(vty, - "%% Can't find prefix-list %s with sequence number %lu\n", + "%% Can't find prefix-list %s with sequence number %" PRIu64 "\n", name, seqnum); return CMD_WARNING_CONFIG_FAILED; } diff --git a/lib/thread.c b/lib/thread.c index d3fb2cdf36..3879e936a1 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -95,7 +95,7 @@ static void cpu_record_hash_free(void *a) static void vty_out_cpu_thread_history(struct vty *vty, struct cpu_thread_history *a) { - vty_out(vty, "%5zu %10zu.%03lu %9zu %8zu %9zu %8lu %9lu", + vty_out(vty, "%5zu %10zu.%03zu %9zu %8zu %9zu %8zu %9zu", a->total_active, a->cpu.total / 1000, a->cpu.total % 1000, a->total_calls, a->cpu.total / a->total_calls, a->cpu.max, a->real.total / a->total_calls, a->real.max); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 7788191454..6591bdc32e 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1536,7 +1536,7 @@ static void pim_show_interface_traffic(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, - "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7lu/%-7lu \n", + "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7" PRIu64 "/%-7" PRIu64 "\n", ifp->name, pim_ifp->pim_ifstat_hello_recv, pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv, @@ -1629,7 +1629,7 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, - "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7lu/%-7lu \n", + "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7" PRIu64 "/%-7" PRIu64 "\n", ifp->name, pim_ifp->pim_ifstat_hello_recv, pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv, @@ -3238,9 +3238,11 @@ static void pim_show_statistics(struct pim_instance *pim, struct vty *vty, } else { vty_out(vty, "BSM Statistics :\n"); vty_out(vty, "----------------\n"); - vty_out(vty, "Number of Received BSMs : %ld\n", pim->bsm_rcvd); - vty_out(vty, "Number of Forwared BSMs : %ld\n", pim->bsm_sent); - vty_out(vty, "Number of Dropped BSMs : %ld\n", + vty_out(vty, "Number of Received BSMs : %" PRIu64 "\n", + pim->bsm_rcvd); + vty_out(vty, "Number of Forwared BSMs : %" PRIu64 "\n", + pim->bsm_sent); + vty_out(vty, "Number of Dropped BSMs : %" PRIu64 "\n", pim->bsm_dropped); } diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index fbcbbe3fdc..cde2edcaf1 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -150,7 +150,7 @@ DEFPY (install_routes_data_dump, sg.r.total_routes, sg.r.installed_routes, sg.r.removed_routes, - r.tv_sec, r.tv_usec); + r.tv_sec, (long int)r.tv_usec); return CMD_SUCCESS; } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 19c7e556ca..7447076993 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -213,7 +213,7 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) monotime(&sg.r.t_end); timersub(&sg.r.t_end, &sg.r.t_start, &r); zlog_debug("Installed All Items %ld.%ld", r.tv_sec, - r.tv_usec); + (long int)r.tv_usec); handle_repeated(true); } break; @@ -229,7 +229,7 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) monotime(&sg.r.t_end); timersub(&sg.r.t_end, &sg.r.t_start, &r); zlog_debug("Removed all Items %ld.%ld", r.tv_sec, - r.tv_usec); + (long int)r.tv_usec); handle_repeated(false); } break; From 3711fdb77c08f02156f4ee29d9bbd9790175faf4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 7 Jun 2019 09:26:46 -0400 Subject: [PATCH 2/4] lib: Include proper header bcopy is being used in the new printf code. Let's actually include the proper header for it. Signed-off-by: Donald Sharp --- lib/printf/printf-pos.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/printf/printf-pos.c b/lib/printf/printf-pos.c index 399573e6c1..1f5f283e82 100644 --- a/lib/printf/printf-pos.c +++ b/lib/printf/printf-pos.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include "printflocal.h" From adc109b5a26897568f616aa565b9b18019722993 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 7 Jun 2019 09:27:38 -0400 Subject: [PATCH 3/4] lib: On some platforms function did not return anything On some compiler platforms the md5 setup function was not returning anything. Place failure case on the bottom to properly handle this situation. Signed-off-by: Donald Sharp --- lib/sockopt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/sockopt.c b/lib/sockopt.c index 89f3d5b594..8e38a29278 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -701,6 +701,12 @@ int sockopt_tcp_signature_ext(int sock, union sockunion *su, uint16_t prefixlen, } return ret; #endif /* HAVE_TCP_MD5SIG */ + + /* + * Making compiler happy. If we get to this point we probably + * have done something really really wrong. + */ + return -2; } int sockopt_tcp_signature(int sock, union sockunion *su, const char *password) From 42e01756c1027d603007d0e33fbdee970c549a6c Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 7 Jun 2019 09:28:39 -0400 Subject: [PATCH 4/4] pimd: Compiler warning about unset usage While this is impossible, make the compilers a bit happier for those of us having to use something old. Signed-off-by: Donald Sharp mroute_add_last = pim_time_monotonic_sec(); @@ -985,9 +985,11 @@ int pim_mroute_add(struct channel_oil *c_oil, const char *name) if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) c_oil->oil.mfcc_ttls[c_oil->oil.mfcc_parent] = orig; - if (pimreg_ttl_reset) + if (pimreg_ttl_reset) { + assert(pim_reg_ifp); c_oil->oil.mfcc_ttls[pim_reg_ifp->mroute_vif_index] = orig_pimreg_ttl; + } if (orig_term_ttl_reset) c_oil->oil.mfcc_ttls[vxlan_ifp->mroute_vif_index] =