Bug 165544 - tc -s class show output confuses bits with bytes
tc -s class show output confuses bits with bytes
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: iproute (Show other bugs)
3
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Radek Vokal
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-10 07:41 EDT by Trevor Cordes
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 2.6.13-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-08-11 04:17:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Trevor Cordes 2005-08-10 07:41:58 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

Description of problem:
The output of "tc -s class show dev ppp0" shows current flow rates like
"rate 2009bit 3pps".  The "bit" text should read "byte".  The number given
is Bytes per second (Bps), not bps.  This is obvious from empirical study
as well as in the source:

pkt_sched.h : struct tc_stats
  __u32   bps;                    /* Current flow byte rate */

tc_qdisc.c : print_tcstats_attr
  fprintf(fp, "%s ", sprint_rate(st.bps, b1));
  (st is struct tc_stats and so bps is BYTES as per comment above)

tc_util.c : print_rate
  double tmp = (double)rate*8;
  (is bogus since it's already bytes, by are we * 8??)

  snprintf(buf, len, "%ubit", rate);
  (rate unmodified is bytes, not bits, and why do we use tmp for the other
  snprintfs but not here?)


The easy solution is change print_rate to operate on rate in bytes, not do
any *8 and change the literal strings to reflect this fact.

I've just posted to the netfilter mailing list as well with a pointer here.


Version-Release number of selected component (if applicable):
iproute-2.6.9-3

How reproducible:
Always

Steps to Reproduce:
1. setup a system with QoS qdiscs
2. tc -s class show dev ppp0
3. 
  

Actual Results:  observe where it says "rate: XXbits" it should read "bytes"

Expected Results:  should show the correct units

Additional info:
Comment 1 Radek Vokal 2005-08-11 04:17:16 EDT
(In reply to comment #0)
>   snprintf(buf, len, "%ubit", rate);
>   (rate unmodified is bytes, not bits, and why do we use tmp for the other
>   snprintfs but not here?)

Seems like this was the bug here, tmp should be used rather than rate. Than the
output is in bits and not bytes. Fixed in rawhide. 

Note You need to log in before you can comment on or make changes to this bug.