]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Drop newline in JSON output for `show bgp afi safi json detail` 15763/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sat, 13 Apr 2024 19:17:01 +0000 (22:17 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 16 Apr 2024 14:16:39 +0000 (14:16 +0000)
Before:

```
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 2,
 "routerId": "1.1.1.1",
 "defaultLocPrf": 100,
 "localAS": 65001,
 "routes": { "192.168.1.0/24": {
"prefix": "192.168.1.0/24",
"version": "1",

"paths": [{"aspath":{"string":"Local","segments":[],"length":0},"origin":"IGP","metric":0,"weight":32768,"valid":true,"version":1,"sourced":true,"local":true,"bestpath":{"overall":true,"selectionReason":"First path received"},"lastUpdate":{"epoch":1713035588,"string":"Sat Apr 13 22:13:08 2024\n"},"nexthops":[{"ip":"0.0.0.0","hostname":"donatas.net","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"0.0.0.0","routerId":"1.1.1.1"}}]
} ,"192.168.11.0/24": {
"prefix": "192.168.11.0/24",
"version": "2",

"paths": [{"aspath":{"string":"Local","segments":[],"length":0},"origin":"IGP","metric":0,"weight":32768,"valid":true,"version":2,"sourced":true,"local":true,"bestpath":{"overall":true,"selectionReason":"First path received"},"lastUpdate":{"epoch":1713035588,"string":"Sat Apr 13 22:13:08 2024\n"},"nexthops":[{"ip":"0.0.0.0","hostname":"donatas.net","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"0.0.0.0","routerId":"1.1.1.1"}}]
}  }  }
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 1dc28e1d735614715bab5d438bddcb2def6c8f3c)

bgpd/bgp_route.c

index 38983e29913db083919417184e2bb0a0828650cb..fb679e35c3e169ccaf4d7d20a4e9b16e65eaf960 100644 (file)
@@ -11875,7 +11875,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
                } else {
                        if (incremental_print) {
                                vty_out(vty, "\"prefix\": \"%pFX\",\n", p);
-                               vty_out(vty, "\"version\": \"%" PRIu64 "\",\n",
+                               vty_out(vty, "\"version\": \"%" PRIu64 "\",",
                                        dest->version);
                        } else {
                                json_object_string_addf(json, "prefix", "%pFX",