Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 May 2013 23:05:03 GMT
From:      Kevin Zheng <kevinz5000@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   docs/178959: Incorrect column descriptions for `ipfw -a list` output in handbook
Message-ID:  <201305242305.r4ON53Ib096419@oldred.FreeBSD.org>
Resent-Message-ID: <201305242310.r4ONA0Kt090974@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         178959
>Category:       docs
>Synopsis:       Incorrect column descriptions for `ipfw -a list` output in handbook
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 24 23:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Kevin Zheng
>Release:        9.1-RELEASE-p3
>Organization:
>Environment:
FreeBSD sigma.local 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Mon Apr 29 18:11:52 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
The FreeBSD Handbook incorrectly documents the columns that appear as output to the `ipfw show` command (also `ipfw -a list`).

http://www.freebsd.org/doc/handbook/firewalls-ipfw.html

>From the Handbook: ~~~~~~~~~~~~~~~~~~~~
The next example lists accounting information and the packet count for matched rules along with the rules themselves. The first column is the rule number, followed by the number of outgoing matched packets, followed by the number of incoming matched packets, followed by the rule itself.

# ipfw -a list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The first column is indeed the rule number. The second column, however, is simply the amount of packets matched (in and out). Furthermore, the third column is a byte counter, not a packet counter. The fourth column is indeed the rule itself.

You can verify this in "/usr/src/sbin/ipfw/ipfw2.c" when you search for the function "ipfw_list". This is what you'll find:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* if showing stats, figure out column widths ahead of time */
bcwidth = pcwidth = 0;
if (show_counters) {
	for (n = 0, r = data; n < nstat; n++, r = NEXT(r)) {
		/* skip rules from another set */
		if (co.use_set && r->set != co.use_set - 1)
			continue;

		/* packet counter */
		width = pr_u64(&r->pcnt, 0);
		if (width > pcwidth)
			pcwidth = width;

		/* byte counter */
		width = pr_u64(&r->bcnt, 0);
		if (width > bcwidth)
			bcwidth = width;
	}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>How-To-Repeat:
Read the IPFW section in the FreeBSD Handbook.
>Fix:
The IPFW page in the Handbook should be corrected to reflect the correct purposes of the columns in `ipfw show` output.

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305242305.r4ON53Ib096419>