frr icon indicating copy to clipboard operation
frr copied to clipboard

Malformed JSON output on "show ip prefix-list" command

Open fdomain opened this issue 1 year ago • 3 comments


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

  1. Define a prefix-lsit
ip prefix-list PF-NET1 seq 5 permit 10.0.0.0/24
  1. 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

fdomain avatar Feb 01 '24 17:02 fdomain

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.

fdomain avatar Feb 01 '24 17:02 fdomain

As a note all show ip prefix-list [detail|summary] json are broken and all need to be fixed.

donaldsharp avatar Feb 06 '24 15:02 donaldsharp

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"
        }
      ]
    }
  }
}

fdomain avatar Apr 15 '24 12:04 fdomain

Fixed already, closing.

ton31337 avatar Jul 03 '24 10:07 ton31337