Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2004 18:34:26 +0200 (CEST)
From:      Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/70311: ipfw(8) pipe/queue show N displays data not only for N
Message-ID:  <20040811163426.E06283474C2@shellma.zin.lublin.pl>
Resent-Message-ID: <200408111640.i7BGec6x028389@freefall.freebsd.org>

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

>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:



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