Skip to content

Commit 9285b37

Browse files
authored
Merge pull request #16175 from FRRouting/mergify/bp/stable/10.0/pr-16170
nhrpd: cleans up shortcut cache entries on termination (backport #16170)
2 parents 4930253 + 69807d7 commit 9285b37

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

nhrpd/nhrp_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ static void nhrp_request_stop(void)
8383
debugf(NHRP_DEBUG_COMMON, "Exiting...");
8484
frr_early_fini();
8585

86-
vrf_terminate();
86+
nhrp_shortcut_terminate();
8787
nhrp_nhs_terminate();
8888
nhrp_zebra_terminate();
8989
vici_terminate();
9090
evmgr_terminate();
91+
vrf_terminate();
9192
nhrp_vc_terminate();
92-
nhrp_shortcut_terminate();
9393

9494
debugf(NHRP_DEBUG_COMMON, "Done.");
9595

nhrpd/nhrp_shortcut.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_SHORTCUT, "NHRP shortcut");
1919
static struct route_table *shortcut_rib[AFI_MAX];
2020

2121
static void nhrp_shortcut_do_purge(struct event *t);
22-
static void nhrp_shortcut_delete(struct nhrp_shortcut *s);
22+
static void nhrp_shortcut_delete(struct nhrp_shortcut *s,
23+
void *arg __attribute__((__unused__)));
2324
static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s);
2425

2526
static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
@@ -72,7 +73,7 @@ static void nhrp_shortcut_cache_notify(struct notifier_block *n,
7273
s->route_installed = 0;
7374
}
7475
if (cmd == NOTIFY_CACHE_DELETE)
75-
nhrp_shortcut_delete(s);
76+
nhrp_shortcut_delete(s, NULL);
7677
break;
7778
}
7879
}
@@ -132,7 +133,8 @@ static void nhrp_shortcut_update_binding(struct nhrp_shortcut *s,
132133
}
133134
}
134135

135-
static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
136+
static void nhrp_shortcut_delete(struct nhrp_shortcut *s,
137+
void *arg __attribute__((__unused__)))
136138
{
137139
struct route_node *rn;
138140
afi_t afi = family2afi(PREFIX_FAMILY(s->p));
@@ -158,7 +160,7 @@ static void nhrp_shortcut_do_purge(struct event *t)
158160
{
159161
struct nhrp_shortcut *s = EVENT_ARG(t);
160162
s->t_timer = NULL;
161-
nhrp_shortcut_delete(s);
163+
nhrp_shortcut_delete(s, NULL);
162164
}
163165

164166
static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
@@ -469,6 +471,8 @@ void nhrp_shortcut_init(void)
469471

470472
void nhrp_shortcut_terminate(void)
471473
{
474+
nhrp_shortcut_foreach(AFI_IP, nhrp_shortcut_delete, NULL);
475+
nhrp_shortcut_foreach(AFI_IP6, nhrp_shortcut_delete, NULL);
472476
route_table_finish(shortcut_rib[AFI_IP]);
473477
route_table_finish(shortcut_rib[AFI_IP6]);
474478
}

0 commit comments

Comments
 (0)