diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-12-11 20:00:19 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-12-11 20:31:49 +0100 |
commit | 403e64f834b685e7a5bccccb8d8b808c32491bee (patch) | |
tree | a20550e2de6afba471b8931dc02fddee3090b486 /bgpd/bgp_vty.h | |
parent | Merge pull request #12477 from opensourcerouting/feature/add_addpath_labeled_... (diff) | |
download | frr-403e64f834b685e7a5bccccb8d8b808c32491bee.tar.xz frr-403e64f834b685e7a5bccccb8d8b808c32491bee.zip |
bgpd: Fix graceful-restart JSON outputs and the crash
Without this patch:
```
donatas-pc# show bgp neighbors graceful-restart json
vtysh: error reading from bgpd: Resource temporarily unavailable (11)Warning: closing connection to bgpd because of an I/O error!
donatas-pc#
```
And, invalid JSON generated when multiple neighbors exist due to json_neighbor
being freed in a loop.
After the patch:
```
donatas-pc# show bgp ipv4 neighbors 192.168.10.124 graceful-restart json
{
"192.168.10.124":{
"neighborAddr":"192.168.10.124",
"localGrMode":"Helper*",
"remoteGrMode":"Restart",
"rBit":false,
"nBit":true,
"timers":{
"configuredRestartTimer":120,
"receivedRestartTimer":120
},
"ipv4Unicast":{
"fBit":true,
"endOfRibStatus":{
"endOfRibSend":true,
"endOfRibSentAfterUpdate":false,
"endOfRibRecv":true
},
"timers":{
"stalePathTimer":360
}
}
}
}
donatas-pc# show bgp neighbors graceful-restart json
{
"192.168.10.124":{
"neighborAddr":"192.168.10.124",
"localGrMode":"Helper*",
"remoteGrMode":"Restart",
"rBit":false,
"nBit":true,
"timers":{
"configuredRestartTimer":120,
"receivedRestartTimer":120
},
"ipv4Unicast":{
"fBit":true,
"endOfRibStatus":{
"endOfRibSend":true,
"endOfRibSentAfterUpdate":false,
"endOfRibRecv":true
},
"timers":{
"stalePathTimer":360
}
}
},
"2a02:4780:abc::2":{
"neighborAddr":"2a02:4780:abc::2",
"localGrMode":"Helper*",
"remoteGrMode":"Restart",
"rBit":false,
"nBit":true,
"timers":{
"configuredRestartTimer":120,
"receivedRestartTimer":120
},
"ipv4Unicast":{
"fBit":true,
"endOfRibStatus":{
"endOfRibSend":true,
"endOfRibSentAfterUpdate":false,
"endOfRibRecv":true
},
"timers":{
"stalePathTimer":360
}
},
"ipv6Unicast":{
"fBit":true,
"endOfRibStatus":{
"endOfRibSend":true,
"endOfRibSentAfterUpdate":true,
"endOfRibRecv":true
},
"timers":{
"stalePathTimer":360
}
}
}
}
donatas-pc#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_vty.h')
-rw-r--r-- | bgpd/bgp_vty.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 9526b50fb..019789dff 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -56,18 +56,14 @@ struct bgp; "V AS LocalAS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc\n" #define BGP_SHOW_SUMMARY_HEADER_FAILED "EstdCnt DropCnt ResetTime Reason\n" -#define BGP_SHOW_PEER_GR_CAPABILITY(vty, p, use_json, json) \ +#define BGP_SHOW_PEER_GR_CAPABILITY(vty, p, json) \ do { \ - bgp_show_neighbor_graceful_restart_local_mode(vty, p, \ - use_json, json); \ - bgp_show_neighbor_graceful_restart_remote_mode( \ - vty, p, use_json, json); \ - bgp_show_neighnor_graceful_restart_flags(vty, p, use_json, \ - json); \ - bgp_show_neighbor_graceful_restart_time(vty, p, use_json, \ - json); \ + bgp_show_neighbor_graceful_restart_local_mode(vty, p, json); \ + bgp_show_neighbor_graceful_restart_remote_mode(vty, p, json); \ + bgp_show_neighnor_graceful_restart_flags(vty, p, json); \ + bgp_show_neighbor_graceful_restart_time(vty, p, json); \ bgp_show_neighbor_graceful_restart_capability_per_afi_safi( \ - vty, p, use_json, json); \ + vty, p, json); \ } while (0) #define VTY_BGP_GR_DEFINE_LOOP_VARIABLE \ |