From owner-freebsd-bugs Sat Jan 18 18:10: 6 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 531B737B405 for ; Sat, 18 Jan 2003 18:10:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B3FFB43F6B for ; Sat, 18 Jan 2003 18:10:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h0J2A3NS037027 for ; Sat, 18 Jan 2003 18:10:03 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h0J2A3C6037026; Sat, 18 Jan 2003 18:10:03 -0800 (PST) Date: Sat, 18 Jan 2003 18:10:03 -0800 (PST) Message-Id: <200301190210.h0J2A3C6037026@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Giorgos Keramidas Subject: Re: bin/47196: ipfw won't format correctly output from 'ipfw show' command Reply-To: Giorgos Keramidas Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/47196; it has been noted by GNATS. From: Giorgos Keramidas To: Alexandr Kovalenko Cc: bug-followup@freebsd.org Subject: Re: bin/47196: ipfw won't format correctly output from 'ipfw show' command Date: Sun, 19 Jan 2003 01:17:31 +0200 (EET) On 2003-01-18 21:55, Alexandr Kovalenko wrote: > ipfw won't give correctly formatted output sometimes: > > # ipfw show > 00100 17414412 24493518226 pipe 1 tcp from 131.159.72.23 to me > 00200 13555157 744076885 pipe 2 tcp from me to 131.159.72.23 > 65535 120556691 99880809179 allow ip from any to any This is a result of a small buglet in ipfw2.c. In the function show_ipfw() a width specifier of 10 characters is used for a quad_t number, which is obviously not sufficient: In revision 1.21 of src/sbin/ipfw/ipfw2.c this is near lines: 825 if (do_acct) 826 printf("%10qu %10qu ", rule->pcnt, rule->bcnt); Similar bugs exist elsewhere in the same file: 1215 printf("%05d %10qu %10qu (%ds)", 1216 d->rulenum, d->pcnt, d->bcnt, d->expire); 1306 printf("%4qu %8qu %2u %4u %3u\n", 1307 q[l].tot_pkts, q[l].tot_bytes, 1308 q[l].len, q[l].len_bytes, q[l].drops); Since an unsigned quad_t can possibly have a value that is wider than 10 characters, all these should be changed to at least a width that can easily accomodate unsigned 64-bit numbers: 20 characters. This will push a lot of stuff to the right though, making it difficult to read `ipfw show' output in 80-column terminals... but we can't have it all, can we? - Giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message