summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-10-03 23:53:11 +0200
committerChristian Hopps <chopps@labn.net>2023-12-28 18:53:40 +0100
commitef91d34f01bcabb23a631523e31fceb973b711a3 (patch)
tree0609f28a55b5da0bc83ee0e5da251279ced84750 /zebra
parentlib: add dedicated API functions for native msgs (diff)
downloadfrr-ef91d34f01bcabb23a631523e31fceb973b711a3.tar.xz
frr-ef91d34f01bcabb23a631523e31fceb973b711a3.zip
zebra: add zebra to mgmtd oper-state
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/debug.c4
-rw-r--r--zebra/main.c7
-rw-r--r--zebra/zebra_nb_state.c4
3 files changed, 15 insertions, 0 deletions
diff --git a/zebra/debug.c b/zebra/debug.c
index 68bedaf05..cf1701be1 100644
--- a/zebra/debug.c
+++ b/zebra/debug.c
@@ -7,6 +7,7 @@
#include <zebra.h>
#include "command.h"
#include "debug.h"
+#include "mgmt_be_client.h"
#include "zebra/debug_clippy.c"
@@ -846,4 +847,7 @@ void zebra_debug_init(void)
install_element(CONFIG_NODE, &no_debug_zebra_pbr_cmd);
install_element(CONFIG_NODE, &debug_zebra_mlag_cmd);
install_element(CONFIG_NODE, &debug_zebra_evpn_mh_cmd);
+
+ /* Init mgmtd backend client debug commands. */
+ mgmt_be_client_lib_vty_init();
}
diff --git a/zebra/main.c b/zebra/main.c
index 604d8974b..be3b22590 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -25,6 +25,7 @@
#include "affinitymap.h"
#include "routemap.h"
#include "routing_nb.h"
+#include "mgmt_be_client.h"
#include "zebra/zebra_router.h"
#include "zebra/zebra_errors.h"
@@ -58,6 +59,8 @@ pid_t pid;
/* Pacify zclient.o in libfrr, which expects this variable. */
struct event_loop *master;
+struct mgmt_be_client *mgmt_be_client;
+
/* Route retain mode flag. */
int retain_mode = 0;
@@ -142,6 +145,8 @@ static void sigint(void)
zlog_notice("Terminating on signal");
+ mgmt_be_client_destroy(mgmt_be_client);
+
atomic_store_explicit(&zrouter.in_shutdown, true,
memory_order_relaxed);
@@ -430,6 +435,8 @@ int main(int argc, char **argv)
zebra_ns_init();
router_id_cmd_init();
zebra_vty_init();
+ mgmt_be_client = mgmt_be_client_create("zebra", NULL, 0,
+ zrouter.master);
access_list_init();
prefix_list_init();
diff --git a/zebra/zebra_nb_state.c b/zebra/zebra_nb_state.c
index ba537475c..4fa6587b0 100644
--- a/zebra/zebra_nb_state.c
+++ b/zebra/zebra_nb_state.c
@@ -156,6 +156,8 @@ const void *lib_vrf_zebra_ribs_rib_get_next(struct nb_cb_get_next_args *args)
safi_t safi;
zvrf = zebra_vrf_lookup_by_id(vrf->vrf_id);
+ if (!zvrf)
+ return NULL;
if (args->list_entry == NULL) {
afi = AFI_IP;
@@ -198,6 +200,8 @@ lib_vrf_zebra_ribs_rib_lookup_entry(struct nb_cb_lookup_entry_args *args)
uint32_t table_id = 0;
zvrf = zebra_vrf_lookup_by_id(vrf->vrf_id);
+ if (!zvrf)
+ return NULL;
yang_afi_safi_identity2value(args->keys->key[0], &afi, &safi);
table_id = yang_str2uint32(args->keys->key[1]);