lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9fbd551fd077af9cfced7d6b75b79019caa9547f.camel@debian.org>
Date:   Sat, 28 Nov 2020 17:59:56 +0000
From:   Luca Boccassi <bluca@...ian.org>
To:     Stephen Hemminger <stephen@...workplumber.org>
Cc:     netdev@...r.kernel.org
Subject: Re: [RFC iproute2] tc/mqprio: json-ify output

On Sat, 2020-11-28 at 09:34 -0800, Stephen Hemminger wrote:
> On Sat, 28 Nov 2020 12:17:00 +0000
> Luca Boccassi <bluca@...ian.org> wrote:
> 
> > On Fri, 2020-11-27 at 21:21 -0800, Stephen Hemminger wrote:
> > > On Fri, 27 Nov 2020 15:26:25 +0000
> > > Luca Boccassi <bluca@...ian.org> wrote:
> > >   
> > > > As reported by a Debian user, mqprio output in json mode is
> > > > invalid:
> > > > 
> > > > {
> > > >      "kind": "mqprio",
> > > >      "handle": "8021:",
> > > >      "dev": "enp1s0f0",
> > > >      "root": true,
> > > >      "options": { tc 2 map 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0
> > > >           queues:(0:3) (4:7)
> > > >           mode:channel
> > > >           shaper:dcb}
> > > > }
> > > > 
> > > > json-ify it, while trying to maintain the same formatting
> > > > for standard output.
> > > > 
> > > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=972784
> > > > 
> > > > Signed-off-by: Luca Boccassi <bluca@...ian.org>  
> > > 
> > > Did you try feeding that into the python parser?
> > > What is before/after?  
> > 
> > Uh, which python parser?
> > 
> > The reporter tested the patch, there's a small error. Before is
> > above,
> > after is:
> > 
> > {
> >     "kind": "mqprio",
> >     "handle": "8001:",
> >     "root": true,
> >     "options": {
> >         "tc": 2,
> >         "map": [ 0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0 ],
> >         "queues": [
> >             "": [ 0,3 ],
> >             "": [ 4,7 ] ],
> >         "mode": "channel",
> >         "shaper": "dcb"
> >     }
> > }
> > 
> > Will fix the "queues" to remove the empty name in v2.
> 
> Try:
>   $ tc -j qdisc | pythom -m json.tools
> 
> The empty tags are non-standard practice can it be done better?

Yes, v2 that I sent earlier fixed the empty tags. Python's json.tools
is happy.

The test of v2 from the reporter gave this output:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=972784#27

[{"kind":"mqprio","handle":"8001:","root":true,"options":{"tc":2,"map":[0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0],"queues":[[0,3],[4,7]],"mode":"channel","shaper":"dcb"}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:8","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:7","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:6","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:5","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:4","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:3","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:2","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}},{"kind":"pfifo_fast","handle":"0:","parent":"8001:1","options":{"bands":3,"priomap ":[1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1],"multiqueue":false}}]

Which when fed to python3 -m json.utils gives:

[
    {
        "kind": "mqprio",
        "handle": "8001:",
        "root": true,
        "options": {
            "tc": 2,
            "map": [
                0,
                0,
                0,
                1,
                0,
                1,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            "queues": [
                [
                    0,
                    3
                ],
                [
                    4,
                    7
                ]
            ],
            "mode": "channel",
            "shaper": "dcb"
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:8",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:7",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:6",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:5",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:4",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:3",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:2",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    },
    {
        "kind": "pfifo_fast",
        "handle": "0:",
        "parent": "8001:1",
        "options": {
            "bands": 3,
            "priomap ": [
                1,
                2,
                2,
                2,
                1,
                2,
                0,
                0,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "multiqueue": false
        }
    }
]

-- 
Kind regards,
Luca Boccassi

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ