From 46a9ea8bfa753472e786268ed97444b41ce94fa8 Mon Sep 17 00:00:00 2001 From: saravanank Date: Thu, 19 Mar 2020 18:05:11 -0700 Subject: pimd: When DR becomes non DR, couldreg state events not handled. RCA: Upstreams which are in register state other than noinfo, doesnt remove register tunnel from oif after it becomes nonDR Fix: scan upstreams with iif as the old dr and check if couldReg becomes false. If couldreg becomes false from true, remove regiface and stop reg timer. Do not disturb the entry. Later the entry shall be removed by kat expiry. Signed-off-by: Saravanan K --- pimd/pim_register.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'pimd/pim_register.c') diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 19baecb9c2..92c3033718 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -498,3 +498,32 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr, return 0; } + +/* + * This routine scan all upstream and update register state and remove pimreg + * when couldreg becomes false. + */ +void pim_reg_del_on_couldreg_fail(struct interface *ifp) +{ + struct pim_interface *pim_ifp = ifp->info; + struct pim_instance *pim; + struct pim_upstream *up; + + if (!pim_ifp) + return; + + pim = pim_ifp->pim; + + frr_each (rb_pim_upstream, &pim->upstream_head, up) { + if (ifp != up->rpf.source_nexthop.interface) + continue; + + if (!pim_upstream_could_register(up) + && (up->reg_state != PIM_REG_NOINFO)) { + pim_channel_del_oif(up->channel_oil, pim->regiface, + PIM_OIF_FLAG_PROTO_PIM, __func__); + THREAD_OFF(up->t_rs_timer); + up->reg_state = PIM_REG_NOINFO; + } + } +} -- cgit v1.2.3