Hoi,

I can see a number of bugs here, they are all present at HEAD also.
- as you called out, format_base10 expects uword but we send it u32
- we talk about bytes/sec delta but call it 'bps', which should be either
*8 or 'Bps'
- And what's that %c doing there at the end of the string? :)

Luckily format_base10 is only called from this one place, fix is in
https://gerrit.fd.io/r/c/vpp/+/36703

groet,
Pim


On Tue, Jul 19, 2022 at 9:35 AM <aihua1...@163.com> wrote:

> In vpp 22.02
>
> I get inaccurate results with monitor interface command,tx data is
> incorrect
>
> DBGvpp# monitor interface local0 interval 10 count 1
> rx: 0pps 0bps tx: 2314885530.28Gpps 18446744069.41Gbps
>
> in  src/vnet/interface/monitor.c
> there use u32,but in  format_base10 it expects uword.
> This looks out of bounds.
>
> format_base10 (u8 *s, va_list *va)
> {
>   uword size = va_arg (*va, uword);
>
>  92       vlib_cli_output (
>  93     vm, "rx: %Upps %Ubps tx: %Upps %Ubps%c", format_base10,
>  94     (u32) ((vrx[spin].packets - vrx[spin ^ 1].packets) / tsd),
>  95     format_base10, (u32) ((vrx[spin].bytes - vrx[spin ^ 1].bytes) /
> tsd),
>  96     format_base10,
>  97     (u32) ((vtx[spin].packets - vtx[spin ^ 1].packets) / tsd),
>  98     format_base10, (u32) ((vtx[spin].bytes - vtx[spin ^ 1].bytes) /
> tsd));
>  99     }
>
>
> 
>
>

-- 
Pim van Pelt <p...@ipng.nl>
PBVP1-RIPE - http://www.ipng.nl/
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#21682): https://lists.fd.io/g/vpp-dev/message/21682
Mute This Topic: https://lists.fd.io/mt/92478151/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to