Merge pull request #5877 from donaldsharp/pim_shutdown_cleanup

Pim shutdown cleanup
This commit is contained in:
Donatas Abraitis 2020-03-10 17:05:12 +02:00 committed by GitHub
commit fcf6ec4cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 12 deletions

View File

@ -85,8 +85,16 @@ static void pim_vxlan_do_reg_work(void)
if (PIM_DEBUG_VXLAN)
zlog_debug("vxlan SG %s periodic NULL register",
vxlan_sg->sg_str);
pim_null_register_send(vxlan_sg->up);
++work_cnt;
/*
* If we are on the work queue *and* the rpf
* has been lost on the vxlan_sg->up let's
* make sure that we don't send it.
*/
if (vxlan_sg->up->rpf.source_nexthop.interface) {
pim_null_register_send(vxlan_sg->up);
++work_cnt;
}
}
if (work_cnt > vxlan_info.max_work_cnt) {
@ -217,6 +225,7 @@ static void pim_vxlan_orig_mr_up_del(struct pim_vxlan_sg *vxlan_sg)
vxlan_sg->sg_str);
vxlan_sg->up = NULL;
if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG) {
/* clear out all the vxlan properties */
up->flags &= ~(PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG |
@ -754,14 +763,8 @@ struct pim_vxlan_sg *pim_vxlan_sg_add(struct pim_instance *pim,
return vxlan_sg;
}
void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg)
static void pim_vxlan_sg_del_item(struct pim_vxlan_sg *vxlan_sg)
{
struct pim_vxlan_sg *vxlan_sg;
vxlan_sg = pim_vxlan_sg_find(pim, sg);
if (!vxlan_sg)
return;
vxlan_sg->flags |= PIM_VXLAN_SGF_DEL_IN_PROG;
pim_vxlan_del_work(vxlan_sg);
@ -771,14 +774,24 @@ void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg)
else
pim_vxlan_term_mr_del(vxlan_sg);
hash_release(vxlan_sg->pim->vxlan.sg_hash, vxlan_sg);
if (PIM_DEBUG_VXLAN)
zlog_debug("vxlan SG %s free", vxlan_sg->sg_str);
XFREE(MTYPE_PIM_VXLAN_SG, vxlan_sg);
}
void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg)
{
struct pim_vxlan_sg *vxlan_sg;
vxlan_sg = pim_vxlan_sg_find(pim, sg);
if (!vxlan_sg)
return;
pim_vxlan_sg_del_item(vxlan_sg);
hash_release(pim->vxlan.sg_hash, vxlan_sg);
}
/******************************* MLAG handling *******************************/
bool pim_vxlan_do_mlag_reg(void)
{
@ -1153,8 +1166,14 @@ void pim_vxlan_init(struct pim_instance *pim)
void pim_vxlan_exit(struct pim_instance *pim)
{
if (pim->vxlan.sg_hash) {
hash_clean(pim->vxlan.sg_hash, NULL);
hash_clean(pim->vxlan.sg_hash,
(void (*)(void *))pim_vxlan_sg_del_item);
hash_free(pim->vxlan.sg_hash);
pim->vxlan.sg_hash = NULL;
}
}
void pim_vxlan_terminate(void)
{
pim_vxlan_work_timer_setup(false);
}

View File

@ -148,4 +148,6 @@ extern bool pim_vxlan_do_mlag_reg(void);
extern void pim_vxlan_inherit_mlag_flags(struct pim_instance *pim,
struct pim_upstream *up, bool inherit);
/* Shutdown of PIM stop the thread */
extern void pim_vxlan_terminate(void);
#endif /* PIM_VXLAN_H */

View File

@ -39,6 +39,7 @@
#include "pim_static.h"
#include "pim_rp.h"
#include "pim_ssm.h"
#include "pim_vxlan.h"
#include "pim_zlookup.h"
#include "pim_zebra.h"
@ -135,6 +136,7 @@ void pim_terminate(void)
prefix_list_delete_hook(NULL);
prefix_list_reset();
pim_vxlan_terminate();
pim_vrf_terminate();
zclient = pim_zebra_zclient_get();