Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIMD: Fix pim_mroute_del crash while killing pimd. #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pimd/pim_ifchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch)
ifchannel list is empty before deleting upstream_del
ref count will take care of it.
*/
pim_upstream_del(pim_ifp->pim, ch->upstream, __PRETTY_FUNCTION__);
ch->upstream = NULL;

if (!(ch->upstream->flags & PIM_UPSTREAM_FLAG_DEL)) {
pim_upstream_del(pim_ifp->pim, ch->upstream, __PRETTY_FUNCTION__);
ch->upstream = NULL;
}

THREAD_OFF(ch->t_ifjoin_expiry_timer);
THREAD_OFF(ch->t_ifjoin_prune_pending_timer);
Expand Down
3 changes: 3 additions & 0 deletions pimd/pim_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
if (up->ref_count >= 1)
return up;

up->flags |= PIM_UPSTREAM_FLAG_DEL;

THREAD_OFF(up->t_ka_timer);
THREAD_OFF(up->t_rs_timer);
THREAD_OFF(up->t_msdp_reg_timer);
Expand Down Expand Up @@ -230,6 +232,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
__PRETTY_FUNCTION__, up->sg_str, buf);
}
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
up->flags &= (~PIM_UPSTREAM_FLAG_DEL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems, there is no need to reset the flag; as upstream is going to delete.


XFREE(MTYPE_PIM_UPSTREAM, up);

Expand Down
1 change: 1 addition & 0 deletions pimd/pim_upstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define PIM_UPSTREAM_FLAG_MASK_SRC_MSDP (1 << 6)
#define PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE (1 << 7)
#define PIM_UPSTREAM_FLAG_MASK_SRC_LHR (1 << 8)
#define PIM_UPSTREAM_FLAG_DEL (1 << 9)
#define PIM_UPSTREAM_FLAG_ALL 0xFFFFFFFF

#define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
Expand Down