summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-03-10 17:05:12 +0200
committerGitHub <noreply@github.com>2020-03-10 17:05:12 +0200
commitfcf6ec4cb465504fc4801580e2a7f82d6d7a5e2c (patch)
tree59f5e50e175aaa17af5ebebe1d5533a4fd3ce817
parent2bdced5ab3f1f9726b5bbf7cf45b4b0b86a969c3 (diff)
parent7a11dc746f5bf7256069f6e2b7aa9048f02b4830 (diff)
Merge pull request #5877 from donaldsharp/pim_shutdown_cleanup
Pim shutdown cleanup
-rw-r--r--pimd/pim_vxlan.c43
-rw-r--r--pimd/pim_vxlan.h2
-rw-r--r--pimd/pimd.c2
3 files changed, 35 insertions, 12 deletions
diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c
index bff8017b43..569b04d278 100644
--- a/pimd/pim_vxlan.c
+++ b/pimd/pim_vxlan.c
@@ -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);
+}
diff --git a/pimd/pim_vxlan.h b/pimd/pim_vxlan.h
index 198d1c3281..18f1b74175 100644
--- a/pimd/pim_vxlan.h
+++ b/pimd/pim_vxlan.h
@@ -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 */
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 889d63c518..5ccbac32f2 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -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();