summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2024-06-05 23:18:21 -0500
committerGitHub <noreply@github.com>2024-06-05 23:18:21 -0500
commit9285b37cc6e00e3a79923a69c749a79e181d235a (patch)
treeed14063c183cc05b0c4fdca33d0903a27012252e
parent493025375239f8ba718ae6b8598ebb3a187aef58 (diff)
parent69807d747605c31f81a980a4874a7d5c05c9cfd7 (diff)
Merge pull request #16175 from FRRouting/mergify/bp/stable/10.0/pr-16170
nhrpd: cleans up shortcut cache entries on termination (backport #16170)
-rw-r--r--nhrpd/nhrp_main.c4
-rw-r--r--nhrpd/nhrp_shortcut.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c
index 5d492249d3..adb8be36d3 100644
--- a/nhrpd/nhrp_main.c
+++ b/nhrpd/nhrp_main.c
@@ -83,13 +83,13 @@ static void nhrp_request_stop(void)
debugf(NHRP_DEBUG_COMMON, "Exiting...");
frr_early_fini();
- vrf_terminate();
+ nhrp_shortcut_terminate();
nhrp_nhs_terminate();
nhrp_zebra_terminate();
vici_terminate();
evmgr_terminate();
+ vrf_terminate();
nhrp_vc_terminate();
- nhrp_shortcut_terminate();
debugf(NHRP_DEBUG_COMMON, "Done.");
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c
index 04dad2aea6..e83ce7f58f 100644
--- a/nhrpd/nhrp_shortcut.c
+++ b/nhrpd/nhrp_shortcut.c
@@ -19,7 +19,8 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_SHORTCUT, "NHRP shortcut");
static struct route_table *shortcut_rib[AFI_MAX];
static void nhrp_shortcut_do_purge(struct event *t);
-static void nhrp_shortcut_delete(struct nhrp_shortcut *s);
+static void nhrp_shortcut_delete(struct nhrp_shortcut *s,
+ void *arg __attribute__((__unused__)));
static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s);
static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
@@ -72,7 +73,7 @@ static void nhrp_shortcut_cache_notify(struct notifier_block *n,
s->route_installed = 0;
}
if (cmd == NOTIFY_CACHE_DELETE)
- nhrp_shortcut_delete(s);
+ nhrp_shortcut_delete(s, NULL);
break;
}
}
@@ -132,7 +133,8 @@ static void nhrp_shortcut_update_binding(struct nhrp_shortcut *s,
}
}
-static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
+static void nhrp_shortcut_delete(struct nhrp_shortcut *s,
+ void *arg __attribute__((__unused__)))
{
struct route_node *rn;
afi_t afi = family2afi(PREFIX_FAMILY(s->p));
@@ -158,7 +160,7 @@ static void nhrp_shortcut_do_purge(struct event *t)
{
struct nhrp_shortcut *s = EVENT_ARG(t);
s->t_timer = NULL;
- nhrp_shortcut_delete(s);
+ nhrp_shortcut_delete(s, NULL);
}
static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
@@ -469,6 +471,8 @@ void nhrp_shortcut_init(void)
void nhrp_shortcut_terminate(void)
{
+ nhrp_shortcut_foreach(AFI_IP, nhrp_shortcut_delete, NULL);
+ nhrp_shortcut_foreach(AFI_IP6, nhrp_shortcut_delete, NULL);
route_table_finish(shortcut_rib[AFI_IP]);
route_table_finish(shortcut_rib[AFI_IP6]);
}