Bug 1868467

Summary: bridge outputting invalid JSON
Product: Red Hat Enterprise Linux 8 Reporter: Madison Kelly <mkelly>
Component: iprouteAssignee: Andrea Claudi <aclaudi>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: atragler, jiji, mshi
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: iproute-5.9.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:00:18 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: 1896011    
Bug Blocks:    
Attachments:
Description Flags
Network config details
none
Invalid JSON parse on independent JSON parsing app.
none
verified.log none

Description Madison Kelly 2020-08-12 18:51:21 UTC
Created attachment 1711216 [details]
Network config details

Description of problem:

The output of 'bridge -json -details link show' generates invalid JSON for the given network config and status;

====
[{"ifindex":9,"ifname":"bcn1_bridge1","flags":["BROADCAST","MULTICAST","UP","LOWER_UP"],"mtu":1500,"master":"bcn1_bridge1"},{"ifindex":10,"ifname":"ifn1_bridge1","flags":["BROADCAST","MULTICAST","UP","LOWER_UP"],"mtu":1500,"master":"ifn1_bridge1"},{"ifindex":11,"ifname":"ifn1_bond1","flags":["BROADCAST","MULTICAST","MASTER","UP","LOWER_UP"],"mtu":1500,"master":"ifn1_bridge1","state":"forwarding","priority":32,"cost":100,"hairpin":false,"guard":false,"root_block":false,"fastleave":false,"learning":true,"flood":true,"mcast_flood":true,"mcast_to_unicast":false,"neigh_suppress":false,"vlan_tunnel":false,"isolated":false,{"ifname":"ifn1_bond1","vlans":[]}},{"ifindex":12,"ifname":"bcn1_bond1","flags":["BROADCAST","MULTICAST","MASTER","UP","LOWER_UP"],"mtu":1500,"master":"bcn1_bridge1","state":"forwarding","priority":32,"cost":100,"hairpin":false,"guard":false,"root_block":false,"fastleave":false,"learning":true,"flood":true,"mcast_flood":true,"mcast_to_unicast":false,"neigh_suppress":false,"vlan_tunnel":false,"isolated":false,{"ifname":"bcn1_bond1","vlans":[]}}]
====

This generates the error in one parser of:

unexpected end of string while parsing JSON string, at character offset 625 (before ""ifname":"ifn1_bond1...")

I verified that the JSON is invalid with http://json.parser.online.fr/ (see attached screen shot).


Version-Release number of selected component (if applicable):

v5.3.0


How reproducible:

100% 


Steps to Reproduce:
1. Configure a machine with 6 interfaces as shown in the network config attachments.
2. Run 'bridge -json -details link show'
3. Validate the output JSON.

Actual results:

Invalid JSON


Expected results:

Valid JSON


Additional info:

Comment 1 Madison Kelly 2020-08-12 18:52:25 UTC
Created attachment 1711217 [details]
Invalid JSON parse on independent JSON parsing app.

Invalid JSON parse on independent JSON parsing app.

Comment 2 Madison Kelly 2020-08-27 22:36:40 UTC
Any update?

Comment 5 Andrea Claudi 2020-11-26 14:29:26 UTC
Hi Madison, sorry for the late reply. This is fixed upstream with commit b262a9becbcb9 ("bridge: Fix output with empty vlan lists"), and the fix will be included in iproute-5.9.0-1.el8 for rhel-8.4.

Comment 6 Madison Kelly 2020-11-26 14:35:10 UTC
Excellent, thanks.

Comment 9 Mingyu Shi 2021-01-05 08:23:56 UTC
Verified iproute-5.9.0-1.el8.x86_64

Comment 10 Mingyu Shi 2021-01-05 08:35:13 UTC
Created attachment 1744517 [details]
verified.log

reproduced with iproute-5.3.0-5.el8.x86_64, verified with iproute-5.9.0-1.el8.x86_64

Comment 12 errata-xmlrpc 2021-05-18 15:00:18 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 (iproute bug fix and enhancement update), 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-2021:1653