diff options
Diffstat (limited to '')
-rw-r--r-- | pimd/pim_vxlan.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 9650da8..f1f315c 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -32,6 +32,30 @@ static void pim_vxlan_work_timer_setup(bool start); static void pim_vxlan_set_peerlink_rif(struct pim_instance *pim, struct interface *ifp); +#define PIM_VXLAN_STARTUP_NULL_REGISTERS 10 + +static void pim_vxlan_rp_send_null_register_startup(struct event *e) +{ + struct pim_vxlan_sg *vxlan_sg = EVENT_ARG(e); + + vxlan_sg->null_register_sent++; + + if (vxlan_sg->null_register_sent > PIM_VXLAN_STARTUP_NULL_REGISTERS) { + if (PIM_DEBUG_VXLAN) + zlog_debug("Null registering stopping for %s", + vxlan_sg->sg_str); + return; + } + + pim_null_register_send(vxlan_sg->up); + + if (PIM_DEBUG_VXLAN) + zlog_debug("Sent null register for %s", vxlan_sg->sg_str); + + event_add_timer(router->master, pim_vxlan_rp_send_null_register_startup, + vxlan_sg, PIM_VXLAN_WORK_TIME, &vxlan_sg->null_register); +} + /* * The rp info has gone from no path to having a * path. Let's immediately send out the null pim register @@ -61,8 +85,13 @@ void pim_vxlan_rp_info_is_alive(struct pim_instance *pim, * If the rp is the same we should send */ if (rpg == rpg_changed) { - zlog_debug("VXLAN RP INFO is alive sending"); - pim_null_register_send(vxlan_sg->up); + if (PIM_DEBUG_VXLAN) + zlog_debug("VXLAN RP info for %s alive sending", + vxlan_sg->sg_str); + vxlan_sg->null_register_sent = 0; + event_add_event(router->master, + pim_vxlan_rp_send_null_register_startup, + vxlan_sg, 0, &vxlan_sg->null_register); } } } @@ -201,8 +230,18 @@ void pim_vxlan_update_sg_reg_state(struct pim_instance *pim, */ if (reg_join) pim_vxlan_add_work(vxlan_sg); - else + else { + /* + * Stop the event that is sending NULL Registers on startup + * there is no need to keep spamming it + */ + if (PIM_DEBUG_VXLAN) + zlog_debug("Received Register stop for %s", + vxlan_sg->sg_str); + + EVENT_OFF(vxlan_sg->null_register); pim_vxlan_del_work(vxlan_sg); + } } static void pim_vxlan_work_timer_cb(struct event *t) @@ -804,6 +843,7 @@ static void pim_vxlan_sg_del_item(struct pim_vxlan_sg *vxlan_sg) { vxlan_sg->flags |= PIM_VXLAN_SGF_DEL_IN_PROG; + EVENT_OFF(vxlan_sg->null_register); pim_vxlan_del_work(vxlan_sg); if (pim_vxlan_is_orig_mroute(vxlan_sg)) @@ -1210,6 +1250,9 @@ void pim_vxlan_exit(struct pim_instance *pim) { hash_clean_and_free(&pim->vxlan.sg_hash, (void (*)(void *))pim_vxlan_sg_del_item); + + if (vxlan_info.work_list) + list_delete(&vxlan_info.work_list); } void pim_vxlan_terminate(void) |