Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Cc: Roopa Prabhu <roopa@cumulusnetworks.com>,
	David Ahern <dsa@cumulusnetworks.com>,
	network dev <netdev@vger.kernel.org>
Subject: Re: bridge mdb json output broken/invalid
Date: Fri, 5 Apr 2019 09:52:59 -0700	[thread overview]
Message-ID: <20190405095259.6ca08f67@shemminger-XPS-13-9360> (raw)
In-Reply-To: <7dcef766-2307-c639-4c4c-74df2afd2910@cumulusnetworks.com>

On Fri, 5 Apr 2019 15:59:03 +0300
Nikolay Aleksandrov <nikolay@cumulusnetworks.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.

  reply	other threads:[~2019-04-05 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 12:59 bridge mdb json output broken/invalid Nikolay Aleksandrov
2019-04-05 16:52 ` Stephen Hemminger [this message]
2019-04-12 15:30   ` [PATCH iproute2] bridge: mdb: restore valid json output Nikolay Aleksandrov
2019-04-17 23:35     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190405095259.6ca08f67@shemminger-XPS-13-9360 \
    --to=stephen@networkplumber.org \
    --cc=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox