+// SPDX-License-Identifier: GPL-2.0-or-later
/* Zebra PW code
* Copyright (C) 2016 Volta Networks, Inc.
- *
- * This program is free software; you can redistribute it 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.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301 USA
*/
#include <zebra.h>
#include "log.h"
#include "memory.h"
-#include "thread.h"
+#include "frrevent.h"
#include "command.h"
#include "vrf.h"
#include "lib/json.h"
static int zebra_pw_enabled(struct zebra_pw *);
static void zebra_pw_install(struct zebra_pw *);
static void zebra_pw_uninstall(struct zebra_pw *);
-static int zebra_pw_install_retry(struct thread *);
+static void zebra_pw_install_retry(struct event *thread);
static int zebra_pw_check_reachability(const struct zebra_pw *);
static void zebra_pw_update_status(struct zebra_pw *, int);
if (pw->status == PW_FORWARDING) {
hook_call(pw_uninstall, pw);
dplane_pw_uninstall(pw);
- } else if (pw->install_retry_timer)
- thread_cancel(&pw->install_retry_timer);
+ }
+
+ EVENT_OFF(pw->install_retry_timer);
/* unlink and release memory */
RB_REMOVE(zebra_pw_head, &zvrf->pseudowires, pw);
if (pw->protocol == ZEBRA_ROUTE_STATIC)
RB_REMOVE(zebra_static_pw_head, &zvrf->static_pseudowires, pw);
+
XFREE(MTYPE_PW, pw);
}
pw->vrf_id, pw->ifname, PW_INSTALL_RETRY_INTERVAL);
/* schedule to retry later */
- thread_cancel(&pw->install_retry_timer);
- thread_add_timer(zrouter.master, zebra_pw_install_retry, pw,
- PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer);
+ EVENT_OFF(pw->install_retry_timer);
+ event_add_timer(zrouter.master, zebra_pw_install_retry, pw,
+ PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer);
zebra_pw_update_status(pw, pwstatus);
}
-static int zebra_pw_install_retry(struct thread *thread)
+static void zebra_pw_install_retry(struct event *thread)
{
- struct zebra_pw *pw = THREAD_ARG(thread);
+ struct zebra_pw *pw = EVENT_ARG(thread);
- pw->install_retry_timer = NULL;
zebra_pw_install(pw);
-
- return 0;
}
static void zebra_pw_update_status(struct zebra_pw *pw, int status)
const char *ifname;
int idx = 0;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return CMD_WARNING;
const char *ifname;
int idx = 0;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return CMD_WARNING;
struct zebra_vrf *zvrf;
struct zebra_pw *pw;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return 0;
struct nexthop *nexthop;
struct nexthop_group *nhg;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return;
struct zebra_vrf *zvrf;
struct zebra_pw *pw;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return;
struct zebra_vrf *zvrf;
struct zebra_pw *pw;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return 0;