From owner-freebsd-bugs@FreeBSD.ORG Wed Aug 11 16:40:40 2004 Return-Path: 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 5A89816A510 for ; Wed, 11 Aug 2004 16:40:40 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D76D543D68 for ; Wed, 11 Aug 2004 16:40:38 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i7BGecYi028390 for ; Wed, 11 Aug 2004 16:40:38 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i7BGec6x028389; Wed, 11 Aug 2004 16:40:38 GMT (envelope-from gnats) Resent-Date: Wed, 11 Aug 2004 16:40:38 GMT Resent-Message-Id: <200408111640.i7BGec6x028389@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, Pawel Malachowski Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E53B916A4CE for ; Wed, 11 Aug 2004 16:35:39 +0000 (GMT) Received: from shellma.zin.lublin.pl (shellma.zin.lublin.pl [212.182.126.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B63243D1D for ; Wed, 11 Aug 2004 16:35:37 +0000 (GMT) (envelope-from pm@zin.lublin.pl) Received: by shellma.zin.lublin.pl (Postfix, from userid 1018) id E06283474C2; Wed, 11 Aug 2004 18:34:26 +0200 (CEST) Message-Id: <20040811163426.E06283474C2@shellma.zin.lublin.pl> Date: Wed, 11 Aug 2004 18:34:26 +0200 (CEST) From: Pawel Malachowski To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/70311: ipfw(8) pipe/queue show N displays data not only for N X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Pawel Malachowski List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2004 16:40:40 -0000 >Number: 70311 >Category: bin >Synopsis: ipfw(8) pipe/queue show N displays data not only for N >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Aug 11 16:40:37 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Paweł Małachowski >Release: FreeBSD 4.10-STABLE i386 >Organization: ZiN >Environment: FreeBSD 4.10-STABLE #7: Tue Jul 27 18:06:15 CEST 2004 with IPFW2 (same with IPFW1 I guess). >Description: `ipfw pipe show N' displays data for pipe N and *all queues*. `ipfw queue show N' displays data for *pipe N* and *all queues*. *x* == x is incorrect. >How-To-Repeat: % ipfw pipe 998 config bw 2Mbit/s % ipfw queue 999 config weight 1 pipe 998 // Define other pipes and queues if You want. % ipfw pipe show 998 // Shows pipe 998 and all queues in system. % ipfw pipe show 999 // Shows no pipes (there is no pipe 999) and all queues in system. % ipfw queue show 999 // Shows no pipes and all queues in system. % ipfw queue show 998 // Shows pipe 998 (there is no queue 998) and all queues in system. >Fix: Patch against 4.10-STABLE/IPFW2. Two versions (I prefer second one because it is more useful in real environment). 1. After patching: `ipfw pipe show N' displays data for pipe N and no queues. `ipfw queue show N' displays data for queue N and no pipes. *** /usr/src/sbin/ipfw/ipfw2.c.orig Wed Aug 11 18:08:27 2004 --- /usr/src/sbin/ipfw/ipfw2.c Wed Aug 11 18:08:34 2004 *************** *** 1498,1504 **** next = (char *)p + l; nbytes -= l; ! if (rulenum != 0 && rulenum != p->pipe_nr) continue; /* --- 1498,1504 ---- next = (char *)p + l; nbytes -= l; ! if ( (rulenum != 0 && rulenum != p->pipe_nr) || (do_pipe==2) ) continue; /* *************** *** 1532,1537 **** --- 1532,1541 ---- l = sizeof(*fs) + fs->rq_elements * sizeof(*q); next = (char *)fs + l; nbytes -= l; + + if ( (rulenum != 0 && rulenum != fs->fs_nr) || (do_pipe==1) ) + continue; + q = (struct dn_flow_queue *)(fs+1); sprintf(prefix, "q%05d: weight %d pipe %d ", fs->fs_nr, fs->weight, fs->parent_nr); 2. After patching: `ipfw pipe show N' displays data for pipe N and queues with parentpipe=N. `ipfw queue show N' displays data for queue N and no pipes. *** /usr/src/sbin/ipfw/ipfw2.c.orig Wed Aug 11 18:08:27 2004 --- /usr/src/sbin/ipfw/ipfw2.c Wed Aug 11 18:27:21 2004 *************** *** 1498,1504 **** next = (char *)p + l; nbytes -= l; ! if (rulenum != 0 && rulenum != p->pipe_nr) continue; /* --- 1498,1504 ---- next = (char *)p + l; nbytes -= l; ! if ( (rulenum != 0 && rulenum != p->pipe_nr) || (do_pipe==2) ) continue; /* *************** *** 1532,1537 **** --- 1532,1542 ---- l = sizeof(*fs) + fs->rq_elements * sizeof(*q); next = (char *)fs + l; nbytes -= l; + + if (rulenum != 0 && ((rulenum != fs->fs_nr && do_pipe==2) + || (rulenum != fs->parent_nr && do_pipe==1))) + continue; + q = (struct dn_flow_queue *)(fs+1); sprintf(prefix, "q%05d: weight %d pipe %d ", fs->fs_nr, fs->weight, fs->parent_nr); >Release-Note: >Audit-Trail: >Unformatted: