Signalize termination to functions so they can avoid accessing pointers
that might be no longer available.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
static void pim_instance_terminate(struct pim_instance *pim)
{
+ pim->stopping = true;
+
pim_vxlan_exit(pim);
if (pim->ssm_info) {
uint64_t gm_rx_drop_sys;
+ bool stopping;
+
#if PIM_IPV == 6
struct {
/** Embedded RP enable state. */
Making the call to pim_channel_del_oif and ignoring the return code
fixes the issue without ill effect, similar to
pim_forward_stop below.
+
+ Also on shutdown when the PIM upstream is removed the channel removal
+ may have already happened, so just return here instead of trying to
+ access an invalid pointer.
*/
+ if (pim->stopping)
+ return;
+
result = pim_channel_del_oif(*oilp, oif, PIM_OIF_FLAG_PROTO_GM,
__func__);
if (result) {