+// SPDX-License-Identifier: GPL-2.0-or-later
/* NHRP cache
* Copyright (c) 2014-2015 Timo Teräs
- *
- * This file is free software: you may copy, redistribute and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
*/
#include "zebra.h"
debugf(NHRP_DEBUG_COMMON, "Deleting cache entry");
nhrp_cache_counts[c->cur.type]--;
notifier_call(&c->notifier_list, NOTIFY_CACHE_DELETE);
- zassert(!notifier_active(&c->notifier_list));
+ assert(!notifier_active(&c->notifier_list));
hash_release(nifp->cache_hash, c);
THREAD_OFF(c->t_timeout);
THREAD_OFF(c->t_auth);
create ? nhrp_cache_alloc : NULL);
}
-static int nhrp_cache_do_free(struct thread *t)
+static void nhrp_cache_do_free(struct thread *t)
{
struct nhrp_cache *c = THREAD_ARG(t);
c->t_timeout = NULL;
nhrp_cache_free(c);
- return 0;
}
-static int nhrp_cache_do_timeout(struct thread *t)
+static void nhrp_cache_do_timeout(struct thread *t)
{
struct nhrp_cache *c = THREAD_ARG(t);
if (c->cur.type != NHRP_CACHE_INVALID)
nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL,
NULL);
- return 0;
}
static void nhrp_cache_update_route(struct nhrp_cache *c)
static void nhrp_cache_reset_new(struct nhrp_cache *c)
{
THREAD_OFF(c->t_auth);
- if (list_hashed(&c->newpeer_notifier.notifier_entry))
+ if (notifier_list_anywhere(&c->newpeer_notifier))
nhrp_peer_notify_del(c->new.peer, &c->newpeer_notifier);
nhrp_peer_unref(c->new.peer);
memset(&c->new, 0, sizeof(c->new));
thread_add_timer_msec(master, nhrp_cache_do_free, c, 10,
&c->t_timeout);
break;
- default:
+ case NHRP_CACHE_INCOMPLETE:
+ case NHRP_CACHE_NEGATIVE:
+ case NHRP_CACHE_CACHED:
+ case NHRP_CACHE_DYNAMIC:
+ case NHRP_CACHE_NHS:
+ case NHRP_CACHE_STATIC:
+ case NHRP_CACHE_LOCAL:
+ case NHRP_CACHE_NUM_TYPES:
if (c->cur.expires)
thread_add_timer(master, nhrp_cache_do_timeout, c,
c->cur.expires - monotime(NULL),
nhrp_cache_update_timers(c);
}
-static int nhrp_cache_do_auth_timeout(struct thread *t)
+static void nhrp_cache_do_auth_timeout(struct thread *t)
{
struct nhrp_cache *c = THREAD_ARG(t);
c->t_auth = NULL;
nhrp_cache_authorize_binding(&c->eventid, (void *)"timeout");
- return 0;
}
static void nhrp_cache_newpeer_notifier(struct notifier_block *n,
void nhrp_cache_notify_del(struct nhrp_cache *c, struct notifier_block *n)
{
- notifier_del(n);
+ notifier_del(n, &c->notifier_list);
}