From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 30 11:50:01 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A27A61065670 for ; Wed, 30 Apr 2008 11:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 840468FC22 for ; Wed, 30 Apr 2008 11:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m3UBo18J028397 for ; Wed, 30 Apr 2008 11:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m3UBo153028396; Wed, 30 Apr 2008 11:50:01 GMT (envelope-from gnats) Resent-Date: Wed, 30 Apr 2008 11:50:01 GMT Resent-Message-Id: <200804301150.m3UBo153028396@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eugenio Maffione Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74BA81065688 for ; Wed, 30 Apr 2008 11:42:37 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id CFBCF8FC25 for ; Wed, 30 Apr 2008 11:42:36 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m3UBfvrf041106 for ; Wed, 30 Apr 2008 11:41:57 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m3UBfvaK041105; Wed, 30 Apr 2008 11:41:57 GMT (envelope-from nobody) Message-Id: <200804301141.m3UBfvaK041105@www.freebsd.org> Date: Wed, 30 Apr 2008 11:41:57 GMT From: Eugenio Maffione To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/123255: mistake in ng_bpf manpage X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2008 11:50:01 -0000 >Number: 123255 >Category: kern >Synopsis: mistake in ng_bpf manpage >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 30 11:50:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Eugenio Maffione >Release: 6.2 >Organization: Telecomitalia >Environment: GENERIC! >Description: I'm writing to you because I think to have found a little mistake in the ng_bpf man page. Actually the mistake is in the script proposed in the manpage. I notice that in some cases the statement printf " { code=%d jt=%d jf=%d k=%d }", \$1, \$2, \$3, \$4; causes an incorrect programming of the bpf filter. This happens when the "k" value exceed the MAX_INTEGER value as when, for example, the tcpdump expression refers a network where the the first octect is greater than 128. In that case the awk generates a negative value for "k" and the bpf matches always (I don't understand why, but it happens). >How-To-Repeat: This happens when the "k" value exceed the MAX_INTEGER value as when, for example, the tcpdump expression refers a network where the the first octect is greater than 128. (e.g . PATTERN="udp and dst net 255.255.0.0/16") >Fix: I tried to change the printf statement changing the format for using a conversion to unsigned (%u) but the poor result is to have the absolute value of "k" (so just deleting the minus) [this probably is a problem in awk]. Finallly, I've found that the working one format for the printg in the manpage is " { code=%d jt=%d jf=%d k=%s }" that preserves the right unsigned integer values. Hopefully this help some other novice... >Release-Note: >Audit-Trail: >Unformatted: