From owner-svn-src-head@FreeBSD.ORG Sun Oct 18 13:55:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7C5D106566B; Sun, 18 Oct 2009 13:55:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B26FF8FC3C; Sun, 18 Oct 2009 13:55:38 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 3CEBE46B29; Sun, 18 Oct 2009 09:55:38 -0400 (EDT) Date: Sun, 18 Oct 2009 14:55:38 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Evans In-Reply-To: <20091016154905.E8438@delplex.bde.org> Message-ID: References: <200910151031.n9FAVOvU070664@svn.freebsd.org> <20091016154905.E8438@delplex.bde.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198118 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2009 13:55:38 -0000 On Fri, 16 Oct 2009, Bruce Evans wrote: > On Thu, 15 Oct 2009, Robert Watson wrote: > >> Log: >> Print routing statistics as unsigned short rather than unsigned int, >> otherwise sign extension leads to unlikely values when in the negative >> range of the signed short structure fields that hold the statistics. >> The type used to hold routing statistics is arguably also incorrect. > > This enlarges the bug. With signed types you get advance warning of > overflow (you actually get overflow earlier but it usually just results in > obviously wrong values being printed), and repeated warnings on overflow > (every time the overflowing values wrap back to negative). With unsigned > types or this change, you get unobviously wrong values after the first > overflow, and no repeated warnings (unless you watch the values carefully > enough to see them go backwards). Using unsigned bytes only delays the > overflow for a whole factor of 2. Yes, a preferable fix would be to move to a u_long (or the like) for the statistics, but unfortunately it's too late in the game to fix that for 8.0. I'll change the statistics types in 9.0 at some point. Robert N M Watson Computer Laboratory University of Cambridge