Date: Sat, 18 Jan 2003 18:10:03 -0800 (PST) From: Giorgos Keramidas <keramida@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/47196: ipfw won't format correctly output from 'ipfw show' command Message-ID: <200301190210.h0J2A3C6037026@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR bin/47196; it has been noted by GNATS.
From: Giorgos Keramidas <keramida@freebsd.org>
To: Alexandr Kovalenko <never@nevermind.kiev.ua>
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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301190210.h0J2A3C6037026>
