mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
if_rmap: move vtysh routemap to daemon
Install daemon specific if_rmap cmd direcly through daemon cli, which are installed by mgmtd. This won't require anymore to filter those commands for vtysh. Signed-off-by: Loïc Sang <loic.sang@6wind.com>
This commit is contained in:
parent
5d4c7d2ece
commit
bddd1fb254
|
@ -225,7 +225,7 @@ int main(int argc, char **argv, char **envp)
|
|||
/*eigrp_route_map_init();
|
||||
route_map_add_hook (eigrp_rmap_update);
|
||||
route_map_delete_hook (eigrp_rmap_update);*/
|
||||
/*if_rmap_init (EIGRP_NODE); */
|
||||
/* intall eigrp related routemap cmds in eigrp_cli.c */
|
||||
|
||||
frr_config_fork();
|
||||
frr_run(master);
|
||||
|
|
|
@ -138,9 +138,8 @@ static void if_rmap_unset(struct if_rmap_ctx *ctx, const char *ifname,
|
|||
}
|
||||
}
|
||||
|
||||
static int if_route_map_handler(struct vty *vty, bool no, const char *dir,
|
||||
const char *other_dir, const char *ifname,
|
||||
const char *route_map)
|
||||
int if_route_map_handler(struct vty *vty, bool no, const char *dir, const char *other_dir,
|
||||
const char *ifname, const char *route_map)
|
||||
{
|
||||
enum nb_operation op = no ? NB_OP_DESTROY : NB_OP_MODIFY;
|
||||
const struct lyd_node *dnode;
|
||||
|
@ -179,67 +178,6 @@ static int if_route_map_handler(struct vty *vty, bool no, const char *dir,
|
|||
return nb_cli_apply_changes(vty, NULL);
|
||||
}
|
||||
|
||||
DEFPY_YANG(if_ipv4_route_map, if_ipv4_route_map_cmd,
|
||||
"route-map ROUTE-MAP <in$in|out> IFNAME",
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, false, dir, other_dir, ifname,
|
||||
route_map);
|
||||
}
|
||||
|
||||
DEFPY_YANG(no_if_ipv4_route_map, no_if_ipv4_route_map_cmd,
|
||||
"no route-map [ROUTE-MAP] <in$in|out> IFNAME",
|
||||
NO_STR
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, true, dir, other_dir, ifname,
|
||||
route_map);
|
||||
}
|
||||
|
||||
/*
|
||||
* CLI infra requires new handlers for ripngd
|
||||
*/
|
||||
DEFPY_YANG(if_ipv6_route_map, if_ipv6_route_map_cmd,
|
||||
"route-map ROUTE-MAP <in$in|out> IFNAME",
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, false, dir, other_dir, ifname,
|
||||
route_map);
|
||||
}
|
||||
|
||||
DEFPY_YANG(no_if_ipv6_route_map, no_if_ipv6_route_map_cmd,
|
||||
"no route-map [ROUTE-MAP] <in$in|out> IFNAME",
|
||||
NO_STR
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, true, dir, other_dir, ifname,
|
||||
route_map);
|
||||
}
|
||||
|
||||
void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode,
|
||||
bool show_defaults)
|
||||
{
|
||||
|
@ -296,17 +234,6 @@ struct if_rmap_ctx *if_rmap_ctx_create(const char *name)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
void if_rmap_init(int node)
|
||||
{
|
||||
if (node == RIP_NODE) {
|
||||
install_element(RIP_NODE, &if_ipv4_route_map_cmd);
|
||||
install_element(RIP_NODE, &no_if_ipv4_route_map_cmd);
|
||||
} else if (node == RIPNG_NODE) {
|
||||
install_element(RIPNG_NODE, &if_ipv6_route_map_cmd);
|
||||
install_element(RIPNG_NODE, &no_if_ipv6_route_map_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void if_rmap_terminate(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ extern struct if_rmap_ctx *if_rmap_ctx_create(const char *name);
|
|||
extern void if_rmap_ctx_delete(struct if_rmap_ctx *ctx);
|
||||
extern void if_rmap_init(int node);
|
||||
extern void if_rmap_terminate(void);
|
||||
int if_route_map_handler(struct vty *vty, bool no, const char *dir, const char *other_dir,
|
||||
const char *ifname, const char *route_map);
|
||||
void if_rmap_hook_add(struct if_rmap_ctx *ctx,
|
||||
void (*func)(struct if_rmap_ctx *ctx,
|
||||
struct if_rmap *));
|
||||
|
|
|
@ -217,9 +217,6 @@ class CommandEntry:
|
|||
"VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD"
|
||||
}
|
||||
|
||||
if defun_file == "lib/if_rmap.c":
|
||||
return {"VTYSH_MGMTD"}
|
||||
|
||||
return {}
|
||||
|
||||
def __repr__(self):
|
||||
|
|
|
@ -1250,6 +1250,33 @@ DEFPY_YANG (clear_ip_rip,
|
|||
return nb_cli_rpc(vty, "/frr-ripd:clear-rip-route", NULL);
|
||||
}
|
||||
|
||||
DEFPY_YANG(if_ipv4_route_map, if_ipv4_route_map_cmd,
|
||||
"route-map ROUTE-MAP <in$in|out> IFNAME",
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, false, dir, other_dir, ifname, route_map);
|
||||
}
|
||||
|
||||
DEFPY_YANG(no_if_ipv4_route_map, no_if_ipv4_route_map_cmd,
|
||||
"no route-map [ROUTE-MAP] <in$in|out> IFNAME",
|
||||
NO_STR
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, true, dir, other_dir, ifname, route_map);
|
||||
}
|
||||
|
||||
/* RIP node structure. */
|
||||
static struct cmd_node rip_node = {
|
||||
.name = "rip",
|
||||
|
@ -1314,7 +1341,8 @@ void rip_cli_init(void)
|
|||
|
||||
install_element(ENABLE_NODE, &clear_ip_rip_cmd);
|
||||
|
||||
if_rmap_init(RIP_NODE);
|
||||
install_element(RIP_NODE, &if_ipv4_route_map_cmd);
|
||||
install_element(RIP_NODE, &no_if_ipv4_route_map_cmd);
|
||||
}
|
||||
/* clang-format off */
|
||||
const struct frr_yang_module_info frr_ripd_cli_info = {
|
||||
|
|
|
@ -641,6 +641,36 @@ DEFPY_YANG (clear_ipv6_rip,
|
|||
return nb_cli_rpc(vty, "/frr-ripngd:clear-ripng-route", NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* CLI infra requires new handlers for ripngd
|
||||
*/
|
||||
DEFPY_YANG(if_ipv6_route_map, if_ipv6_route_map_cmd,
|
||||
"route-map ROUTE-MAP <in$in|out> IFNAME",
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, false, dir, other_dir, ifname, route_map);
|
||||
}
|
||||
|
||||
DEFPY_YANG(no_if_ipv6_route_map, no_if_ipv6_route_map_cmd,
|
||||
"no route-map [ROUTE-MAP] <in$in|out> IFNAME",
|
||||
NO_STR
|
||||
"Route map set\n"
|
||||
"Route map name\n"
|
||||
"Route map set for input filtering\n"
|
||||
"Route map set for output filtering\n" INTERFACE_STR)
|
||||
{
|
||||
const char *dir = in ? "in" : "out";
|
||||
const char *other_dir = in ? "out" : "in";
|
||||
|
||||
return if_route_map_handler(vty, true, dir, other_dir, ifname, route_map);
|
||||
}
|
||||
|
||||
/* RIPng node structure. */
|
||||
static struct cmd_node cmd_ripng_node = {
|
||||
.name = "ripng",
|
||||
|
@ -682,7 +712,8 @@ void ripng_cli_init(void)
|
|||
|
||||
install_element(ENABLE_NODE, &clear_ipv6_rip_cmd);
|
||||
|
||||
if_rmap_init(RIPNG_NODE);
|
||||
install_element(RIPNG_NODE, &if_ipv6_route_map_cmd);
|
||||
install_element(RIPNG_NODE, &no_if_ipv6_route_map_cmd);
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
|
|
Loading…
Reference in a new issue