Page MenuHomeVyOS Platform

Show vpn ipsec sa show unexpected prefix 'B' in packets
Closed, ResolvedPublicBUG

Description

Cosmetic bug
show vpn ipsec sa shows unexpected prefix B in packets

vyos@r14:~$ show vpn ipsec sa
Connection                 State    Uptime    Bytes In/Out    Packets In/Out    Remote address    Remote ID    Proposal
-------------------------  -------  --------  --------------  ----------------  ----------------  -----------  ------------------------
peer_192-0-2-2_tunnel_0    up       21m20s    420B/420B       5B/5B             192.0.2.2         192.0.2.2    AES_GCM_16_256/MODP_2048

It seems filesize.size if wrong option for packets
https://github.com/vyos/vyos-1x/blob/38d753f830887c35abe4fbcf1bb73b6f26be1fdf/src/op_mode/show_ipsec_sa.py#L75-L78

Could be fixed with replace https://github.com/vyos/vyos-1x/blob/494f1f3473d07947e3e03ce410ac0690eaeb9ed9/src/op_mode/show_ipsec_sa.py#L74-L75

Or suggestion from @zsdc

if sa_packets_in and sa_packets_out:
    if int(sa_packets_in.decode()) < 1000:
        packets_in = sa_packets_in
    else:
        packets_in = filesize.size(int(sa_packets_in.decode()),
                                   system=filesize.si)
    if int(sa_packets_out.decode()) < 1000:
        packets_out = sa_packets_out
    else:
        packets_out = filesize.size(int(
            sa_packets_out.decode()),
                                    system=filesize.si)
    sa_out_packets = f'{packets_in}/{packets_out}'

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.4-rolling-202207111030
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Cosmetic issue (typos etc.)