]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/adjacency.c
Merge pull request #12920 from sri-mohan1/sri-mohan-ldp
[mirror_frr.git] / ldpd / adjacency.c
index d390e70ad0d0cd8b9d794e683557173d41633444..42c3ef05351aec8855156e4b319bc0d2e48d9722 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: ISC
 /*     $OpenBSD$ */
 
 /*
@@ -5,18 +6,6 @@
  * 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 *);
 
@@ -172,8 +161,7 @@ adj_get_af(const struct adj *adj)
 /* adjacency timers */
 
 /* ARGSUSED */
-static int
-adj_itimer(struct thread *thread)
+static void adj_itimer(struct thread *thread)
 {
        struct adj *adj = THREAD_ARG(thread);
 
@@ -182,24 +170,22 @@ adj_itimer(struct thread *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) &&
+               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);
@@ -208,7 +194,7 @@ adj_start_itimer(struct adj *adj)
 void
 adj_stop_itimer(struct adj *adj)
 {
-       thread_cancel(&adj->inactivity_timer);
+       THREAD_OFF(adj->inactivity_timer);
 }
 
 /* targeted neighbors */
@@ -259,7 +245,7 @@ tnbr_find(struct ldpd_conf *xconf, int af, union ldpd_addr *addr)
 struct tnbr *
 tnbr_check(struct ldpd_conf *xconf, struct tnbr *tnbr)
 {
-       if (!(tnbr->flags & (F_TNBR_CONFIGURED|F_TNBR_DYNAMIC)) &&
+       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);
@@ -345,22 +331,19 @@ tnbr_get_hello_interval(struct tnbr *tnbr)
 /* 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);
@@ -369,7 +352,7 @@ tnbr_start_hello_timer(struct tnbr *tnbr)
 static void
 tnbr_stop_hello_timer(struct tnbr *tnbr)
 {
-       thread_cancel(&tnbr->hello_timer);
+       THREAD_OFF(tnbr->hello_timer);
 }
 
 struct ctl_adj *
@@ -392,7 +375,7 @@ adj_to_ctl(struct adj *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;