diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2022-03-10 11:22:48 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2022-03-12 22:47:08 +0100 |
commit | d6890c49b2f689fd679cd845d0011eecb80c326a (patch) | |
tree | f892215e0abce04f4d08db86a92e08313c067db2 /pimd/pim_oil.c | |
parent | Merge pull request #10744 from opensourcerouting/igmp-json-leave-typo (diff) | |
download | frr-d6890c49b2f689fd679cd845d0011eecb80c326a.tar.xz frr-d6890c49b2f689fd679cd845d0011eecb80c326a.zip |
pimd: add safety check to OIL add/del
These will corrupt memory if mroute_vif_index is -1 (e.g. interface not
operating.) That shouldn't happen, but it does while doing development
work, so trip an assert rather than corrupting memory.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_oil.c')
-rw-r--r-- | pimd/pim_oil.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index a499c884b..d5e459b44 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -216,6 +216,10 @@ int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif, pim_ifp = oif->info; + assertf(pim_ifp->mroute_vif_index >= 0, + "trying to del OIF %s with VIF (%d)", oif->name, + pim_ifp->mroute_vif_index); + /* * Don't do anything if we've been asked to remove a source * that is not actually on it. @@ -418,6 +422,10 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif, pim_ifp = oif->info; + assertf(pim_ifp->mroute_vif_index >= 0, + "trying to add OIF %s with VIF (%d)", oif->name, + pim_ifp->mroute_vif_index); + /* Prevent single protocol from subscribing same interface to channel (S,G) multiple times */ if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask) { |