Bug 1758457

Summary: bridge -j vlan show output invalid json
Product: Red Hat Enterprise Linux 8 Reporter: Quique Llorente <ellorent>
Component: iprouteAssignee: Andrea Claudi <aclaudi>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: low Docs Contact:
Priority: low    
Version: 8.0CC: atragler, jaster
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.2   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: iproute-5.3.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:44:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1752857    
Bug Blocks:    

Description Quique Llorente 2019-10-04 08:11:39 UTC
Description of problem:

Playing around with linux-bridges and vlan filtering functionality with iproute command 'bridge' we found that it outputs a invalid json and that's a problemn for our processing tools.





rpm version: iproute-4.18.0-11.el8.x86_64
os: Red Hat Enterprise Linux CoreOS release 4.1
[core@test-1-mfqwp-master-0 ~]$ rpm-ostree status 
State: idle
AutomaticUpdates: disabled
Deployments:
* pivot://quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:fb025ff2b405cf5902a451675cd27a9d702ced7c88b5a33280d42069524874c6
              CustomOrigin: Managed by pivot tool
                   Version: 410.8.20190904.0 (2019-09-04T20:31:27Z)

  pivot://quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:53389c9b4a00d7afebb98f7bd9d20348deb1d77ca4baf194f0ae1b582b7e965b
              CustomOrigin: Provisioned from oscontainer
                   Version: 410.8.20190520.0 (2019-05-20T22:55:04Z)

How reproducible:


[root@bed1c2009bd8 /]# ip link add br0 type bridge
[root@bed1c2009bd8 /]# ip link set br0 up
[root@bed1c2009bd8 /]# ip link set br0 type bridge vlan_filtering 1
[root@bed1c2009bd8 /]# bridge vlan show 
port	vlan ids
br0
	 1 PVID untagged


Actual results:

[root@bed1c2009bd8 /]# bridge -j vlan show 
["br0","vlan":[{"vlan":1,"pvid":null,"untagged":null}]]


Expected results:

The correct output format need structs to be with brackets:
["br0",{"vlan":[{"vlan":1,"pvid":null,"untagged":null}]}]


Additional info:

Also same thing at centos:7 has better output, since network interfaces are struct fields too:

```
[root@69aabb0f165e /]# bridge vlan show 
port	vlan ids
br0	 1 PVID Egress Untagged

[root@69aabb0f165e /]# bridge -j vlan show 
{
    "br0": [{
            "vlan": 1,
            "flags": ["PVID","Egress Untagged"
            ]
        }
    ]
}
```

Comment 1 Andrea Claudi 2019-10-04 14:53:08 UTC
This is fixed upstream with:

commit 0f36267485e30099a4f735c3aadfa58b5efa1918
Author: Stephen Hemminger <stephen>
Date:   Thu Sep 6 14:42:46 2018 +0100

    bridge: fix vlan show formatting

Comment 5 errata-xmlrpc 2020-04-28 16:44:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1785