lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 5 Sep 2014 17:02:22 -0700
From:	Stephen Hemminger <stephen@...workplumber.org>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2] ip: support of usec rtt in tcp_metrics

On Fri, 05 Sep 2014 16:54:04 -0700
Eric Dumazet <eric.dumazet@...il.com> wrote:

> +			if (i != TCP_METRIC_RTT &&
> +			    i != TCP_METRIC_RTT_US &&
> +			    i != TCP_METRIC_RTTVAR &&
> +			    i != TCP_METRIC_RTTVAR_US) {
> +				if (metric_name[i])
> +					fprintf(fp, " %s ", metric_name[i]);
> +				else
> +					fprintf(fp, " metric_%d ", i);

Why not put new metrics in metric_name array? and make the check something like:

			if (i < ARRAY_SIZE(metric_name) && metric_name[i])
				fprintf(fp, " %s ", metric_name[i]);
			else
				fprintf(fp, " metric_%d ", i)

This makes it future proof, and gets rid of the silly test.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ