- a couple small fixes for ripd conversion as well.
Signed-off-by: Christian Hopps <chopps@labn.net>
#ifdef HAVE_RIPD
"ripd",
#endif
+#ifdef HAVE_RIPNGD
+ "ripngd",
+#endif
#ifdef HAVE_STATICD
"staticd",
#endif
const char *mgmt_be_client_names[MGMTD_BE_CLIENT_ID_MAX + 1] = {
[MGMTD_BE_CLIENT_ID_ZEBRA] = "zebra",
-#ifdef HAVE_STATICD
+#ifdef HAVE_RIPD
[MGMTD_BE_CLIENT_ID_RIPD] = "ripd",
#endif
+#ifdef HAVE_RIPNGD
+ [MGMTD_BE_CLIENT_ID_RIPNGD] = "ripngd",
+#endif
#ifdef HAVE_STATICD
[MGMTD_BE_CLIENT_ID_STATICD] = "staticd",
#endif
};
#endif
+#if HAVE_RIPNGD
+static const char *const ripngd_config_xpaths[] = {
+ "/frr-filter:lib",
+ "/frr-interface:lib/interface",
+ "/frr-ripngd:ripngd",
+ "/frr-route-map:lib",
+ "/frr-vrf:lib",
+ NULL,
+};
+static const char *const ripngd_oper_xpaths[] = {
+ "/frr-ripd:ripd",
+ NULL,
+};
+#endif
+
#if HAVE_STATICD
static const char *const staticd_config_xpaths[] = {
"/frr-vrf:lib",
#ifdef HAVE_RIPD
[MGMTD_BE_CLIENT_ID_RIPD] = ripd_config_xpaths,
#endif
+#ifdef HAVE_RIPNGD
+ [MGMTD_BE_CLIENT_ID_RIPNGD] = ripngd_config_xpaths,
+#endif
#ifdef HAVE_STATICD
[MGMTD_BE_CLIENT_ID_STATICD] = staticd_config_xpaths,
#endif
static const char *const *be_client_oper_xpaths[MGMTD_BE_CLIENT_ID_MAX] = {
#ifdef HAVE_RIPD
[MGMTD_BE_CLIENT_ID_RIPD] = ripd_oper_xpaths,
+#endif
+#ifdef HAVE_RIPNGD
+ [MGMTD_BE_CLIENT_ID_RIPNGD] = ripngd_oper_xpaths,
#endif
[MGMTD_BE_CLIENT_ID_ZEBRA] = zebra_oper_xpaths,
};
#define MGMTD_BE_CONN_INIT_DELAY_MSEC 50
-#define MGMTD_FIND_ADAPTER_BY_INDEX(adapter_index) \
+#define MGMTD_FIND_ADAPTER_BY_INDEX(adapter_index) \
mgmt_adaptr_ref[adapter_index]
/**
#ifdef HAVE_RIPD
MGMTD_BE_CLIENT_ID_RIPD,
#endif
+#ifdef HAVE_RIPNGD
+ MGMTD_BE_CLIENT_ID_RIPNGD,
+#endif
#ifdef HAVE_STATICD
MGMTD_BE_CLIENT_ID_STATICD,
#endif
#include "mgmtd/mgmt.h"
#include "mgmtd/mgmt_ds.h"
#include "ripd/rip_nb.h"
+#include "ripngd/ripng_nb.h"
#include "routing_nb.h"
#ifdef HAVE_RIPD
&frr_ripd_cli_info,
#endif
+#ifdef HAVE_RIPNGD
+ &frr_ripngd_cli_info,
+#endif
#ifdef HAVE_STATICD
&frr_staticd_cli_info,
#endif
#include <zebra.h>
#include "command.h"
+#include "filter.h"
#include "json.h"
#include "network.h"
#include "northbound_cli.h"
#include "mgmtd/mgmt_history.h"
#include "mgmtd/mgmt_vty_clippy.c"
-#include "ripd/ripd.h"
+#include "ripd/rip_nb.h"
+#include "ripngd/ripng_nb.h"
#include "staticd/static_vty.h"
extern struct frr_daemon_info *mgmt_daemon_info;
#if HAVE_RIPD
rip_cli_init();
#endif
+#if HAVE_RIPNGD
+ ripng_cli_init();
+#endif
#if HAVE_STATICD
static_vty_init();
#endif
# end
endif
+if RIPNGD
+nodist_mgmtd_mgmtd_SOURCES += \
+ yang/frr-ripngd.yang.c \
+ # end
+mgmtd_libmgmt_be_nb_la_SOURCES += \
+ ripngd/ripng_cli.c \
+ # end
+endif
+
if STATICD
nodist_mgmtd_mgmtd_SOURCES += \
yang/frr-staticd.yang.c \
}
if defun_file == "lib/if_rmap.c":
- if v6_cmd:
- return {"VTYSH_RIPNGD"}
- else:
- return {"VTYSH_MGMTD"}
+ return {"VTYSH_MGMTD"}
return {}
extern void ripd_notif_send_auth_type_failure(const char *ifname);
extern void ripd_notif_send_auth_failure(const char *ifname);
+extern void rip_cli_init(void);
+
#endif /* _FRR_RIP_NB_H_ */
extern void rip_vrf_init(void);
extern void rip_vrf_terminate(void);
-extern void rip_cli_init(void);
extern struct zebra_privs_t ripd_privs;
extern struct rip_instance_head rip_instances;
#include <zebra.h>
#include "if.h"
+#include "if_rmap.h"
#include "vrf.h"
#include "log.h"
#include "prefix.h"
return nb_cli_apply_changes(vty, NULL);
}
+/* RIPng node structure. */
+static struct cmd_node cmd_ripng_node = {
+ .name = "ripng",
+ .node = RIPNG_NODE,
+ .parent_node = CONFIG_NODE,
+ .prompt = "%s(config-router)# ",
+};
+
void ripng_cli_init(void)
{
+ /* Install RIPNG_NODE. */
+ install_node(&cmd_ripng_node);
+ install_default(RIPNG_NODE);
+
install_element(CONFIG_NODE, &router_ripng_cmd);
install_element(CONFIG_NODE, &no_router_ripng_cmd);
install_element(INTERFACE_NODE, &ipv6_ripng_split_horizon_cmd);
install_element(ENABLE_NODE, &clear_ipv6_rip_cmd);
-}
+
+ if_rmap_init(RIPNG_NODE);
+}
+
+/* clang-format off */
+const struct frr_yang_module_info frr_ripngd_cli_info = {
+ .name = "frr-ripngd",
+ .ignore_cfg_cbs = true,
+ .nodes = {
+ {
+ .xpath = "/frr-ripngd:ripngd/instance",
+ .cbs.cli_show = cli_show_router_ripng,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/allow-ecmp",
+ .cbs.cli_show = cli_show_ripng_allow_ecmp,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/default-information-originate",
+ .cbs.cli_show = cli_show_ripng_default_information_originate,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/default-metric",
+ .cbs.cli_show = cli_show_ripng_default_metric,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/network",
+ .cbs.cli_show = cli_show_ripng_network_prefix,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/interface",
+ .cbs.cli_show = cli_show_ripng_network_interface,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/offset-list",
+ .cbs.cli_show = cli_show_ripng_offset_list,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/passive-interface",
+ .cbs.cli_show = cli_show_ripng_passive_interface,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/distribute-list/in/access-list",
+ .cbs.cli_show = group_distribute_list_ipv6_cli_show,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/distribute-list/out/access-list",
+ .cbs.cli_show = group_distribute_list_ipv6_cli_show,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/distribute-list/in/prefix-list",
+ .cbs.cli_show = group_distribute_list_ipv6_cli_show,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/distribute-list/out/prefix-list",
+ .cbs.cli_show = group_distribute_list_ipv6_cli_show,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/redistribute",
+ .cbs.cli_show = cli_show_ripng_redistribute,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/if-route-maps/if-route-map",
+ .cbs.cli_show = cli_show_if_route_map,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/static-route",
+ .cbs.cli_show = cli_show_ripng_route,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/aggregate-address",
+ .cbs.cli_show = cli_show_ripng_aggregate_address,
+ },
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/timers",
+ .cbs.cli_show = cli_show_ripng_timers,
+ },
+ {
+ .xpath = "/frr-interface:lib/interface/frr-ripngd:ripng/split-horizon",
+ .cbs = {
+ .cli_show = cli_show_ipv6_ripng_split_horizon,
+ },
+ },
+ {
+ .xpath = NULL,
+ },
+ }
+};
hook_register_prio(if_del, 0, ripng_if_delete_hook);
/* Install interface node. */
- if_cmd_init_default();
hook_register_prio(if_real, 0, ripng_ifp_create);
hook_register_prio(if_up, 0, ripng_ifp_up);
hook_register_prio(if_down, 0, ripng_ifp_down);
#include "if_rmap.h"
#include "libfrr.h"
#include "routemap.h"
+#include "mgmt_be_client.h"
#include "ripngd/ripngd.h"
#include "ripngd/ripng_nb.h"
/* Master of threads. */
struct event_loop *master;
+struct mgmt_be_client *mgmt_be_client;
+
static struct frr_daemon_info ripngd_di;
/* SIGHUP handler. */
zlog_notice("Terminating on signal");
+ nb_oper_cancel_all_walks();
+ mgmt_be_client_destroy(mgmt_be_client);
+ mgmt_be_client = NULL;
+
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (!vrf->info)
continue;
.yang_modules = ripngd_yang_modules,
.n_yang_modules = array_size(ripngd_yang_modules),
+
+ /* mgmtd will load the per-daemon config file now */
+ .flags = FRR_NO_SPLIT_CONFIG,
);
#define DEPRECATED_OPTIONS ""
/* RIPngd inits. */
ripng_init();
- ripng_cli_init();
+
+ mgmt_be_client = mgmt_be_client_create("ripngd", NULL, 0, master);
+
zebra_init(master);
frr_config_fork();
{
.xpath = "/frr-ripngd:ripngd/instance",
.cbs = {
- .cli_show = cli_show_router_ripng,
.create = ripngd_instance_create,
.destroy = ripngd_instance_destroy,
.get_keys = ripngd_instance_get_keys,
{
.xpath = "/frr-ripngd:ripngd/instance/allow-ecmp",
.cbs = {
- .cli_show = cli_show_ripng_allow_ecmp,
.modify = ripngd_instance_allow_ecmp_modify,
},
},
{
.xpath = "/frr-ripngd:ripngd/instance/default-information-originate",
.cbs = {
- .cli_show = cli_show_ripng_default_information_originate,
.modify = ripngd_instance_default_information_originate_modify,
},
},
{
.xpath = "/frr-ripngd:ripngd/instance/default-metric",
.cbs = {
- .cli_show = cli_show_ripng_default_metric,
.modify = ripngd_instance_default_metric_modify,
},
},
{
.xpath = "/frr-ripngd:ripngd/instance/network",
.cbs = {
- .cli_show = cli_show_ripng_network_prefix,
.create = ripngd_instance_network_create,
.destroy = ripngd_instance_network_destroy,
},
{
.xpath = "/frr-ripngd:ripngd/instance/interface",
.cbs = {
- .cli_show = cli_show_ripng_network_interface,
.create = ripngd_instance_interface_create,
.destroy = ripngd_instance_interface_destroy,
},
{
.xpath = "/frr-ripngd:ripngd/instance/offset-list",
.cbs = {
- .cli_show = cli_show_ripng_offset_list,
.create = ripngd_instance_offset_list_create,
.destroy = ripngd_instance_offset_list_destroy,
},
{
.xpath = "/frr-ripngd:ripngd/instance/passive-interface",
.cbs = {
- .cli_show = cli_show_ripng_passive_interface,
.create = ripngd_instance_passive_interface_create,
.destroy = ripngd_instance_passive_interface_destroy,
},
.cbs = {
.modify = group_distribute_list_ipv6_modify,
.destroy = group_distribute_list_ipv6_destroy,
- .cli_show = group_distribute_list_ipv6_cli_show,
}
},
{
.cbs = {
.modify = group_distribute_list_ipv6_modify,
.destroy = group_distribute_list_ipv6_destroy,
- .cli_show = group_distribute_list_ipv6_cli_show,
}
},
{
.cbs = {
.modify = group_distribute_list_ipv6_modify,
.destroy = group_distribute_list_ipv6_destroy,
- .cli_show = group_distribute_list_ipv6_cli_show,
}
},
{
.cbs = {
.modify = group_distribute_list_ipv6_modify,
.destroy = group_distribute_list_ipv6_destroy,
- .cli_show = group_distribute_list_ipv6_cli_show,
}
},
{
.xpath = "/frr-ripngd:ripngd/instance/redistribute",
.cbs = {
.apply_finish = ripngd_instance_redistribute_apply_finish,
- .cli_show = cli_show_ripng_redistribute,
.create = ripngd_instance_redistribute_create,
.destroy = ripngd_instance_redistribute_destroy,
},
.cbs = {
.create = ripngd_instance_if_route_maps_if_route_map_create,
.destroy = ripngd_instance_if_route_maps_if_route_map_destroy,
- .cli_show = cli_show_if_route_map,
}
},
{
{
.xpath = "/frr-ripngd:ripngd/instance/static-route",
.cbs = {
- .cli_show = cli_show_ripng_route,
.create = ripngd_instance_static_route_create,
.destroy = ripngd_instance_static_route_destroy,
},
{
.xpath = "/frr-ripngd:ripngd/instance/aggregate-address",
.cbs = {
- .cli_show = cli_show_ripng_aggregate_address,
.create = ripngd_instance_aggregate_address_create,
.destroy = ripngd_instance_aggregate_address_destroy,
},
.xpath = "/frr-ripngd:ripngd/instance/timers",
.cbs = {
.apply_finish = ripngd_instance_timers_apply_finish,
- .cli_show = cli_show_ripng_timers,
},
},
{
{
.xpath = "/frr-interface:lib/interface/frr-ripngd:ripng/split-horizon",
.cbs = {
- .cli_show = cli_show_ipv6_ripng_split_horizon,
.modify = lib_interface_ripng_split_horizon_modify,
},
},
#include "northbound.h"
extern const struct frr_yang_module_info frr_ripngd_info;
+extern const struct frr_yang_module_info frr_ripngd_cli_info;
/* Mandatory callbacks. */
int ripngd_instance_create(struct nb_cb_create_args *args);
const struct lyd_node *dnode,
bool show_defaults);
+extern void ripng_cli_init(void);
+
#endif /* _FRR_RIPNG_NB_H_ */
void ripng_route_map_init(void)
{
- route_map_init();
+ route_map_init_new(true);
route_map_match_interface_hook(generic_match_add);
route_map_no_match_interface_hook(generic_match_delete);
#include "lib_errors.h"
#include "northbound_cli.h"
#include "network.h"
+#include "mgmt_be_client.h"
#include "ripngd/ripngd.h"
#include "ripngd/ripng_route.h"
}
}
-/* RIPng configuration write function. */
-static int ripng_config_write(struct vty *vty)
-{
- struct ripng *ripng;
- int write = 0;
-
- RB_FOREACH(ripng, ripng_instance_head, &ripng_instances) {
- char xpath[XPATH_MAXLEN];
- struct lyd_node *dnode;
-
- snprintf(xpath, sizeof(xpath),
- "/frr-ripngd:ripngd/instance[vrf='%s']",
- ripng->vrf_name);
-
- dnode = yang_dnode_get(running_config->dnode, xpath);
- assert(dnode);
-
- nb_cli_show_dnode_cmds(vty, dnode, false);
-
- vty_out(vty, "exit\n");
-
- write = 1;
- }
-
- return write;
-}
-
-static int ripng_config_write(struct vty *vty);
-/* RIPng node structure. */
-static struct cmd_node cmd_ripng_node = {
- .name = "ripng",
- .node = RIPNG_NODE,
- .parent_node = CONFIG_NODE,
- .prompt = "%s(config-router)# ",
- .config_write = ripng_config_write,
-};
-
static void ripng_distribute_update(struct distribute_ctx *ctx,
struct distribute *dist)
{
{
vrf_init(ripng_vrf_new, ripng_vrf_enable, ripng_vrf_disable,
ripng_vrf_delete);
-
- vrf_cmd_init(NULL);
}
void ripng_vrf_terminate(void)
/* Initialize ripng structure and set commands. */
void ripng_init(void)
{
- /* Install RIPNG_NODE. */
- install_node(&cmd_ripng_node);
-
/* Install ripng commands. */
install_element(VIEW_NODE, &show_ipv6_ripng_cmd);
install_element(VIEW_NODE, &show_ipv6_ripng_status_cmd);
- install_default(RIPNG_NODE);
-
ripng_if_init();
ripng_debug_init();
+ /* Enable mgmt be debug */
+ mgmt_be_client_lib_vty_init();
+
/* Access list install. */
- access_list_init();
+ access_list_init_new(true);
access_list_add_hook(ripng_distribute_update_all_wrapper);
access_list_delete_hook(ripng_distribute_update_all_wrapper);
route_map_add_hook(ripng_routemap_update);
route_map_delete_hook(ripng_routemap_update);
-
- if_rmap_init(RIPNG_NODE);
}
extern void ripng_vrf_init(void);
extern void ripng_vrf_terminate(void);
-extern void ripng_cli_init(void);
extern uint32_t zebra_ecmp_count;
endif
ripngd_ripngd_SOURCES = \
- ripngd/ripng_cli.c \
ripngd/ripng_debug.c \
ripngd/ripng_interface.c \
ripngd/ripng_nexthop.c \
#endif /* HAVE_RIPD */
#ifdef HAVE_RIPNGD
-DEFUNSH(VTYSH_RIPNGD, router_ripng, router_ripng_cmd, "router ripng [vrf NAME]",
+DEFUNSH(VTYSH_MGMTD, router_ripng, router_ripng_cmd, "router ripng [vrf NAME]",
ROUTER_STR "RIPng\n" VRF_CMD_HELP_STR)
{
vty->node = RIPNG_NODE;
#endif /* HAVE_RIPD */
#ifdef HAVE_RIPNGD
-DEFUNSH(VTYSH_RIPNGD, vtysh_exit_ripngd, vtysh_exit_ripngd_cmd, "exit",
+DEFUNSH(VTYSH_MGMTD, vtysh_exit_ripngd, vtysh_exit_ripngd_cmd, "exit",
"Exit current mode and down to previous mode\n")
{
return vtysh_exit(vty);
}
-DEFUNSH(VTYSH_RIPNGD, vtysh_quit_ripngd, vtysh_quit_ripngd_cmd, "quit",
+DEFUNSH(VTYSH_MGMTD, vtysh_quit_ripngd, vtysh_quit_ripngd_cmd, "quit",
"Exit current mode and down to previous mode\n")
{
return vtysh_exit_ripngd(self, vty, argc, argv);
VTYSH_BFDD | VTYSH_BABELD | VTYSH_BGPD | VTYSH_EIGRPD | VTYSH_ISISD | \
VTYSH_FABRICD | VTYSH_LDPD | VTYSH_NHRPD | VTYSH_OSPF6D | \
VTYSH_OSPFD | VTYSH_PBRD | VTYSH_PIMD | VTYSH_PIM6D | \
- VTYSH_RIPNGD | VTYSH_VRRPD | VTYSH_ZEBRA | VTYSH_MGMTD
+ VTYSH_VRRPD | VTYSH_ZEBRA | VTYSH_MGMTD
#define VTYSH_ACL_SHOW \
VTYSH_BFDD | VTYSH_BABELD | VTYSH_BGPD | VTYSH_EIGRPD | VTYSH_ISISD | \
VTYSH_FABRICD | VTYSH_LDPD | VTYSH_NHRPD | VTYSH_OSPF6D | \
#define VTYSH_AFFMAP VTYSH_ZEBRA | VTYSH_ISISD
#define VTYSH_RMAP_CONFIG \
- VTYSH_ZEBRA | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | VTYSH_BGPD | \
- VTYSH_ISISD | VTYSH_PIMD | VTYSH_EIGRPD | VTYSH_FABRICD | \
- VTYSH_MGMTD
+ VTYSH_ZEBRA | VTYSH_OSPFD | VTYSH_OSPF6D | VTYSH_BGPD | VTYSH_ISISD | \
+ VTYSH_PIMD | VTYSH_EIGRPD | VTYSH_FABRICD | VTYSH_MGMTD
#define VTYSH_RMAP_SHOW \
VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | \
VTYSH_BGPD | VTYSH_ISISD | VTYSH_PIMD | VTYSH_EIGRPD | \
VTYSH_FABRICD
#define VTYSH_INTERFACE_SUBSET \
- VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | \
+ VTYSH_ZEBRA | VTYSH_OSPFD | VTYSH_OSPF6D | \
VTYSH_ISISD | VTYSH_PIMD | VTYSH_PIM6D | VTYSH_NHRPD | \
VTYSH_EIGRPD | VTYSH_BABELD | VTYSH_PBRD | VTYSH_FABRICD | \
VTYSH_VRRPD | VTYSH_MGMTD
#define VTYSH_NH_GROUP VTYSH_PBRD|VTYSH_SHARPD
#define VTYSH_SR VTYSH_ZEBRA|VTYSH_PATHD
#define VTYSH_DPDK VTYSH_ZEBRA
-#define VTYSH_MGMT_BACKEND VTYSH_RIPD | VTYSH_STATICD | VTYSH_ZEBRA
+#define VTYSH_MGMT_BACKEND \
+ VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_STATICD | VTYSH_ZEBRA
#define VTYSH_MGMT_FRONTEND VTYSH_MGMTD
enum vtysh_write_integrated {