summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-06-01 09:54:31 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2023-02-23 20:50:07 +0100
commit5d279b4317aa0ca1b997a8fb0d19b85b4aa613cd (patch)
tree44672bb03634dd0d0c76a8ebe125a7124d9050e6
parent57cbb1cc331854816eb51d35f2134f698040f60c (diff)
pimd: try to reinstall MFC when we get NOCACHE
Whether due to a pimd bug, some expiry, or someone just deleting MFC entries, when we're in NOCACHE we *know* there's no MFC entry. Add an install call to make sure pimd's MFC view aligns with the actual kernel MFC. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--pimd/pim_mroute.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 995c2d910b..24b251b583 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -47,6 +47,8 @@
#include "pim_msg.h"
static void mroute_read_on(struct pim_instance *pim);
+static int pim_upstream_mroute_update(struct channel_oil *c_oil,
+ const char *name);
int pim_mroute_set(struct pim_instance *pim, int enable)
{
@@ -160,6 +162,7 @@ int pim_mroute_msg_nocache(int fd, struct interface *ifp, const kernmsg *msg)
struct pim_upstream *up;
struct pim_rpf *rpg;
pim_sgaddr sg;
+ bool desync = false;
memset(&sg, 0, sizeof(sg));
sg.src = msg->msg_im_src;
@@ -232,6 +235,12 @@ int pim_mroute_msg_nocache(int fd, struct interface *ifp, const kernmsg *msg)
up = pim_upstream_find_or_add(&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR,
__func__);
+ if (up->channel_oil->installed) {
+ zlog_warn(
+ "%s: NOCACHE for %pSG, MFC entry disappeared - reinstalling",
+ ifp->name, &sg);
+ desync = true;
+ }
/*
* I moved this debug till after the actual add because
@@ -255,6 +264,11 @@ int pim_mroute_msg_nocache(int fd, struct interface *ifp, const kernmsg *msg)
/* if we have receiver, inherit from parent */
pim_upstream_inherited_olist_decide(pim_ifp->pim, up);
+ /* we just got NOCACHE from the kernel, so... MFC is not in the
+ * kernel for some reason or another. Try installing again.
+ */
+ if (desync)
+ pim_upstream_mroute_update(up->channel_oil, __func__);
return 0;
}