bin/70311: ipfw(8) pipe/queue show N displays data not only for N

Pawel Malachowski pawmal-posting at freebsd.lublin.pl
Wed Aug 11 09:40:40 PDT 2004


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


More information about the freebsd-bugs mailing list