static struct ptm_client *pc_lookup(uint32_t pid);
static struct ptm_client *pc_new(uint32_t pid);
static void pc_free(struct ptm_client *pc);
+static void pc_free_all(void);
static struct ptm_client_notification *pcn_new(struct ptm_client *pc,
struct bfd_session *bs);
static struct ptm_client_notification *pcn_lookup(struct ptm_client *pc,
{
struct stream *msg = zc->obuf;
+ /* Clean-up and free ptm clients data memory. */
+ pc_free_all();
+
/*
* The replay is an empty message just to trigger client daemons
* configuration replay.
void bfdd_zclient_stop(void)
{
zclient_stop(zclient);
+
+ /* Clean-up and free ptm clients data memory. */
+ pc_free_all();
}
XFREE(MTYPE_BFDD_CONTROL, pc);
}
+static void pc_free_all(void)
+{
+ struct ptm_client *pc;
+
+ while (!TAILQ_EMPTY(&pcqueue)) {
+ pc = TAILQ_FIRST(&pcqueue);
+ pc_free(pc);
+ }
+}
+
static struct ptm_client_notification *pcn_new(struct ptm_client *pc,
struct bfd_session *bs)
{
static struct ptm_process *pp_new(pid_t pid, struct zserv *zs);
static struct ptm_process *pp_lookup_byzs(struct zserv *zs);
static void pp_free(struct ptm_process *pp);
+static void pp_free_all(void);
static void zebra_ptm_send_bfdd(struct stream *msg);
static void zebra_ptm_send_clients(struct stream *msg);
XFREE(MTYPE_ZEBRA_PTM_BFD_PROCESS, pp);
}
+static void pp_free_all(void)
+{
+ struct ptm_process *pp;
+
+ while (!TAILQ_EMPTY(&ppqueue)) {
+ pp = TAILQ_FIRST(&ppqueue);
+ pp_free(pp);
+ }
+}
+
/*
* Use the FRR's internal daemon implementation.
hook_register(zserv_client_close, _zebra_ptm_bfd_client_deregister);
}
+void zebra_ptm_finish(void)
+{
+ /* Remove the client disconnect hook and free all memory. */
+ hook_unregister(zserv_client_close, _zebra_ptm_bfd_client_deregister);
+ pp_free_all();
+}
+
/*
* Message handling.
/*
* Unused functions.
*/
-void zebra_ptm_finish(void)
-{
- /* NOTHING */
-}
void zebra_ptm_if_init(struct zebra_if *zifp __attribute__((__unused__)))
{
/* NOTHING */