mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 15:17:15 +00:00
bgpd: Fix crash when shutdown
The process of BGP shutdown hard free's memory irrelevant to the fact that another process may be using that memory still in route leaking scenario's. As a temporary fix find the default instance and free it last. Ticket: CM-21068 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
c93a3b77e6
commit
0e42e319d5
@ -168,7 +168,7 @@ void sigusr1(void)
|
|||||||
*/
|
*/
|
||||||
static __attribute__((__noreturn__)) void bgp_exit(int status)
|
static __attribute__((__noreturn__)) void bgp_exit(int status)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp, *bgp_default;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
|
|
||||||
/* it only makes sense for this to be called on a clean exit */
|
/* it only makes sense for this to be called on a clean exit */
|
||||||
@ -180,9 +180,15 @@ static __attribute__((__noreturn__)) void bgp_exit(int status)
|
|||||||
|
|
||||||
bgp_close();
|
bgp_close();
|
||||||
|
|
||||||
|
bgp_default = bgp_get_default();
|
||||||
|
|
||||||
/* reverse bgp_master_init */
|
/* reverse bgp_master_init */
|
||||||
for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
|
for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) {
|
||||||
|
if (bgp_default == bgp)
|
||||||
|
continue;
|
||||||
bgp_delete(bgp);
|
bgp_delete(bgp);
|
||||||
|
}
|
||||||
|
bgp_delete(bgp_default);
|
||||||
|
|
||||||
/* reverse bgp_dump_init */
|
/* reverse bgp_dump_init */
|
||||||
bgp_dump_finish();
|
bgp_dump_finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user