]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: fix incorrect json output in bgp_show_table_rd()
authorLouis Scalbert <louis.scalbert@6wind.com>
Wed, 7 Jun 2023 13:15:30 +0000 (15:15 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 16 Jun 2023 12:18:25 +0000 (14:18 +0200)
commita04d32b36649c0e14c76ec121d17a46d95db5697
tree7fe4522f195045139fbaed616ac2d5cd984b093d
parentaf79038c4be1b5cec7da9f67b81280d6f14e2479
bgpd: fix incorrect json output in bgp_show_table_rd()

'{}' extra output may present JSON output from bgp_show_table_rd() when
no prefix are seen.

> {
>  "vrfId": 0,
>  "vrfName": "default",
>  "tableVersion": 0,
>  "routerId": "1.1.1.1",
>  "defaultLocPrf": 100,
>  "localAS": 65500,
>  "routes": {  "routeDistinguishers" : { "444:1" : {  }  }  }  }
> {}

Do not output '{}' when bgp_show_table() returns a valid JSON.
Tested without rd in config, bgp_show_table() returns nothing and the
JSON output is only '{}'

Fixes: 0224b3296c ("bgpd: Print empty JSON `{}` if no entries under `show bgp ipv4 vpn json`")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
bgpd/bgp_route.c