]> git.proxmox.com Git - mirror_frr.git/commit
bgpd: Fix graceful-restart JSON outputs and the crash
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 11 Dec 2022 19:00:19 +0000 (21:00 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 11 Dec 2022 19:31:49 +0000 (21:31 +0200)
commit403e64f834b685e7a5bccccb8d8b808c32491bee
treea20550e2de6afba471b8931dc02fddee3090b486
parentf88420c3a57c71fba83d6523066cc5e93ffcc49b
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>
bgpd/bgp_vty.c
bgpd/bgp_vty.h