From: Rick Jones Date: Thu, 2 Jun 2011 17:56:08 +0000 (-0700) Subject: The ifSpeed field of a generic interface counter in sFlow is 64 bits. X-Git-Tag: tcpdump-4.2.1~47 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/96c2a764eb27e7073d3722740ce938fead87266c The ifSpeed field of a generic interface counter in sFlow is 64 bits. The "overlay" definition in print-sflow.c is correct, but the actual extract for printing is using EXTRACT_32BITS rather than EXTRACT_64BITS, which leads to an incorrect report for speed. Reviewed-By: Guy Harris --- diff --git a/print-sflow.c b/print-sflow.c index f27370a4..79a3fdf1 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -313,10 +313,10 @@ print_sflow_counter_generic(const u_char *pointer, u_int len) { sflow_gen_counter = (const struct sflow_generic_counter_t *)pointer; - printf("\n\t ifindex %u, iftype %u, ifspeed %u, ifdirection %u (%s)", + printf("\n\t ifindex %u, iftype %u, ifspeed %" PRIu64 ", ifdirection %u (%s)", EXTRACT_32BITS(sflow_gen_counter->ifindex), EXTRACT_32BITS(sflow_gen_counter->iftype), - EXTRACT_32BITS(sflow_gen_counter->ifspeed), + EXTRACT_64BITS(sflow_gen_counter->ifspeed), EXTRACT_32BITS(sflow_gen_counter->ifdirection), tok2str(sflow_iface_direction_values, "Unknown", EXTRACT_32BITS(sflow_gen_counter->ifdirection)));