+// SPDX-License-Identifier: ISC
/* $OpenBSD$ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <zebra.h>
#include "log.h"
static __inline int adj_compare(const struct adj *, const struct adj *);
-static int adj_itimer(struct thread *);
+static void adj_itimer(struct thread *);
static __inline int tnbr_compare(const struct tnbr *, const struct tnbr *);
static void tnbr_del(struct ldpd_conf *, struct tnbr *);
static void tnbr_start(struct tnbr *);
static void tnbr_stop(struct tnbr *);
-static int tnbr_hello_timer(struct thread *);
+static void tnbr_hello_timer(struct thread *);
static void tnbr_start_hello_timer(struct tnbr *);
static void tnbr_stop_hello_timer(struct tnbr *);
/* adjacency timers */
/* ARGSUSED */
-static int
-adj_itimer(struct thread *thread)
+static void adj_itimer(struct thread *thread)
{
struct adj *adj = THREAD_ARG(thread);
log_debug("%s: lsr-id %pI4", __func__, &adj->lsr_id);
if (adj->source.type == HELLO_TARGETED) {
- if (!(adj->source.target->flags & F_TNBR_CONFIGURED) &&
- adj->source.target->pw_count == 0) {
+ if (!CHECK_FLAG(adj->source.target->flags, F_TNBR_CONFIGURED) &&
+ adj->source.target->pw_count == 0 &&
+ adj->source.target->rlfa_count == 0) {
/* remove dynamic targeted neighbor */
tnbr_del(leconf, adj->source.target);
- return (0);
+ return;
}
}
adj_del(adj, S_HOLDTIME_EXP);
-
- return (0);
}
void
adj_start_itimer(struct adj *adj)
{
- thread_cancel(&adj->inactivity_timer);
+ THREAD_OFF(adj->inactivity_timer);
adj->inactivity_timer = NULL;
thread_add_timer(master, adj_itimer, adj, adj->holdtime,
&adj->inactivity_timer);
void
adj_stop_itimer(struct adj *adj)
{
- thread_cancel(&adj->inactivity_timer);
+ THREAD_OFF(adj->inactivity_timer);
}
/* targeted neighbors */
struct tnbr *
tnbr_check(struct ldpd_conf *xconf, struct tnbr *tnbr)
{
- if (!(tnbr->flags & (F_TNBR_CONFIGURED|F_TNBR_DYNAMIC)) &&
- tnbr->pw_count == 0) {
+ if (!CHECK_FLAG(tnbr->flags, (F_TNBR_CONFIGURED|F_TNBR_DYNAMIC)) &&
+ tnbr->pw_count == 0 && tnbr->rlfa_count == 0) {
tnbr_del(xconf, tnbr);
return (NULL);
}
/* target neighbors timers */
/* ARGSUSED */
-static int
-tnbr_hello_timer(struct thread *thread)
+static void tnbr_hello_timer(struct thread *thread)
{
struct tnbr *tnbr = THREAD_ARG(thread);
tnbr->hello_timer = NULL;
send_hello(HELLO_TARGETED, NULL, tnbr);
tnbr_start_hello_timer(tnbr);
-
- return (0);
}
static void
tnbr_start_hello_timer(struct tnbr *tnbr)
{
- thread_cancel(&tnbr->hello_timer);
+ THREAD_OFF(tnbr->hello_timer);
tnbr->hello_timer = NULL;
thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
&tnbr->hello_timer);
static void
tnbr_stop_hello_timer(struct tnbr *tnbr)
{
- thread_cancel(&tnbr->hello_timer);
+ THREAD_OFF(tnbr->hello_timer);
}
struct ctl_adj *
}
actl.holdtime = adj->holdtime;
actl.holdtime_remaining =
- thread_timer_remain_second(adj->inactivity_timer);
+ thread_timer_remain_second(adj->inactivity_timer);
actl.trans_addr = adj->trans_addr;
actl.ds_tlv = adj->ds_tlv;