netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bridge mdb json output broken/invalid
@ 2019-04-05 12:59 Nikolay Aleksandrov
  2019-04-05 16:52 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolay Aleksandrov @ 2019-04-05 12:59 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Roopa Prabhu, David Ahern, network dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-17 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-05 12:59 bridge mdb json output broken/invalid Nikolay Aleksandrov
2019-04-05 16:52 ` Stephen Hemminger
2019-04-12 15:30   ` [PATCH iproute2] bridge: mdb: restore valid json output Nikolay Aleksandrov
2019-04-17 23:35     ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).