frr
frr copied to clipboard
Malformed JSON output on "show ip prefix-list" command
Describe the bug This is a new issue following #15177 because the original issue has been closed prematurely.
JSON output from "show ip prefix-list <prefix_list_name> json" is not valid: There are 2 consecutive JSON objects concatenated, one from the Zebra perspective, and another one for BGP, making the output invalid for a JSON parser.
- [X] Did you check if this is a duplicate issue?
- [X] Did you test it on the latest FRRouting/frr master branch? (tested on stable/9.1)
To Reproduce
- Define a prefix-lsit
ip prefix-list PF-NET1 seq 5 permit 10.0.0.0/24
- Run the following "show ip prefix-list
json"
{
"ZEBRA":{
"PF-NET1":{
"addressFamily":"IPv4",
"entries":[
{
"sequenceNumber":5,
"type":"permit",
"prefix":"10.0.0.0/24"
}
]
}
}
}
{
"BGP":{
"PF-NET1":{
"addressFamily":"IPv4",
"entries":[
{
"sequenceNumber":5,
"type":"permit",
"prefix":"10.0.0.0/24"
}
]
}
}
}
Expected behavior
{
"ZEBRA": {
"PF-NET1": {
"addressFamily": "IPv4",
"entries": [
{
"sequenceNumber": 5,
"type": "permit",
"prefix": "10.0.0.0/24"
}
]
}
},
"BGP": {
"PF-NET1": {
"addressFamily": "IPv4",
"entries": [
{
"sequenceNumber": 5,
"type": "permit",
"prefix": "10.0.0.0/24"
}
]
}
}
}
Screenshots
Versions
- OS Version: Debian 22.04
- Kernel: 6.1.71
- FRR Version: 9.1
Additional context
I believe the issue might be also present on another "show" commands. As said in #15177 by @donaldsharp it has been fixed for route-map only with the following PR https://github.com/FRRouting/frr/pull/14856.
As a note all show ip prefix-list [detail|summary] json are broken and all need to be fixed.
I found a workaround by connecting vtysh only to the bgpd daemon, that way we don't output the zebra definition:
# sudo vtysh -d bgpd
rtr# show ip prefix-list PF-TEST json
{
"BGP":{
"PF-TEST":{
"addressFamily":"IPv4",
"entries":[
{
"sequenceNumber":5,
"type":"permit",
"prefix":"10.0.0.0/8"
}
]
}
}
}
Fixed already, closing.