Skip to content

Commit

Permalink
Merge pull request FRRouting#13020 from SaiGomathiN/2462808-3
Browse files Browse the repository at this point in the history
pimd: PIM not sending register packets after changing from non DR to DR
  • Loading branch information
donaldsharp authored May 2, 2023
2 parents 99a1ab0 + 1c883ae commit f7a775a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pimd/pim_neighbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "pim_jp_agg.h"
#include "pim_bfd.h"
#include "pim_register.h"
#include "pim_oil.h"

static void dr_election_by_addr(struct interface *ifp)
{
Expand Down Expand Up @@ -123,9 +124,10 @@ int pim_if_dr_election(struct interface *ifp)
pim_if_update_could_assert(ifp);
pim_if_update_assert_tracking_desired(ifp);

if (PIM_I_am_DR(pim_ifp))
if (PIM_I_am_DR(pim_ifp)) {
pim_ifp->am_i_dr = true;
else {
pim_clear_nocache_state(pim_ifp);
} else {
if (pim_ifp->am_i_dr == true) {
pim_reg_del_on_couldreg_fail(ifp);
pim_ifp->am_i_dr = false;
Expand Down
25 changes: 25 additions & 0 deletions pimd/pim_oil.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,31 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
return c_oil;
}


/*
* Clean up mroute and channel oil created for dropping pkts from directly
* connected source when the interface was non DR.
*/
void pim_clear_nocache_state(struct pim_interface *pim_ifp)
{
struct channel_oil *c_oil;

frr_each_safe (rb_pim_oil, &pim_ifp->pim->channel_oil_head, c_oil) {

if ((!c_oil->up) ||
!(PIM_UPSTREAM_FLAG_TEST_SRC_NOCACHE(c_oil->up->flags)))
continue;

if (*oil_parent(c_oil) != pim_ifp->mroute_vif_index)
continue;

THREAD_OFF(c_oil->up->t_ka_timer);
PIM_UPSTREAM_FLAG_UNSET_SRC_NOCACHE(c_oil->up->flags);
PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(c_oil->up->flags);
pim_upstream_del(pim_ifp->pim, c_oil->up, __func__);
}
}

struct channel_oil *pim_channel_oil_del(struct channel_oil *c_oil,
const char *name)
{
Expand Down
1 change: 1 addition & 0 deletions pimd/pim_oil.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
pim_sgaddr *sg);
struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
pim_sgaddr *sg, const char *name);
void pim_clear_nocache_state(struct pim_interface *pim_ifp);
struct channel_oil *pim_channel_oil_del(struct channel_oil *c_oil,
const char *name);

Expand Down

0 comments on commit f7a775a

Please sign in to comment.