[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190405095259.6ca08f67@shemminger-XPS-13-9360>
Date: Fri, 5 Apr 2019 09:52:59 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
Cc: Roopa Prabhu <roopa@...ulusnetworks.com>,
David Ahern <dsa@...ulusnetworks.com>,
network dev <netdev@...r.kernel.org>
Subject: Re: bridge mdb json output broken/invalid
On Fri, 5 Apr 2019 15:59:03 +0300
Nikolay Aleksandrov <nikolay@...ulusnetworks.com> wrote:
> Hi Stephen,
> It seems that commit c7c1a1ef51aea ("bridge: colorize output and use JSON print library") broke
> bridge mdb's json output. The json after that commit is invalid, more below.
>
> Setup: 2 bridges - virbr0 and br-test
>
> non-json bridge mdb show:
> 3: virbr0 vnet3 239.10.10.50 temp
> 3: virbr0 vnet3 225.1.2.3 temp
> 14: br-test v1 224.224.224.224 permanent
>
> json bridge -d -p -j mdb show before c7c1a1ef51aea:
> {
> "mdb": [ {
> "dev": "virbr0",
> "port": "vnet3",
> "grp": "239.10.10.50",
> "state": "temp"
> },{
> "dev": "virbr0",
> "port": "vnet3",
> "grp": "225.1.2.3",
> "state": "temp"
> },{
> "dev": "br-test",
> "port": "v1",
> "grp": "224.224.224.224",
> "state": "permanent"
> } ],
> "router": {
> "virbr0": [ {
> "port": "vnet3"
> } ],
> "br-test": [ {
> "port": "v1"
> } ]
> }
> }
>
> json bridge -d -p -j mdb show after c7c1a1ef51aea:
> [
> "mdb": [ {
> "index": 3,
> "dev": "virbr0",
> "port": "vnet3",
> "grp": "239.10.10.50",
> "state": "temp",
> "flags": [ ]
> },{
> "index": 3,
> "dev": "virbr0",
> "port": "vnet3",
> "grp": "225.1.2.3",
> "state": "temp",
> "flags": [ ]
> } ],
> "router": [
> "virbr0": [ {
> "port": "vnet3"
> } ] ],
> "mdb": [ ],
> "mdb": [ {
> "index": 14,
> "dev": "br-test",
> "port": "v1",
> "grp": "224.224.224.224",
> "state": "permanent",
> "flags": [ ]
> } ],
> "router": [
> "br-test": [ {
> "port": "v1"
> } ] ] ]
>
>
> Obviously this is not a valid object array and even if it was converted, it must not contain
> duplicate entries. The "mdb" and "router" array entries must be unique and should contain
> all the single entries inside, also the global context shouldn't be array.
>
> Cheers,
> Nik
Yes this is wrong, sending the list twice.
Not sure why that is happening, the original code had some awkward flags to handle this.
Powered by blists - more mailing lists