summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2024-01-24 17:35:19 +0100
committerChristian Hopps <chopps@labn.net>2024-01-26 18:34:23 +0100
commit63ca751c1186483f82f0d464bc1c8c43e3a2755f (patch)
tree3c61ebdb0ba2977de423a335abae057ae4ed6631
parentlib: convert route-map to mgmtd (diff)
downloadfrr-63ca751c1186483f82f0d464bc1c8c43e3a2755f.tar.xz
frr-63ca751c1186483f82f0d464bc1c8c43e3a2755f.zip
lib: convert filters to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to '')
-rw-r--r--lib/filter.c12
-rw-r--r--lib/filter.h5
-rw-r--r--lib/filter_nb.c32
-rw-r--r--mgmtd/mgmt_main.c2
-rw-r--r--mgmtd/mgmt_vty.c1
-rw-r--r--python/xref2vtysh.py4
-rw-r--r--vtysh/vtysh.h12
7 files changed, 60 insertions, 8 deletions
diff --git a/lib/filter.c b/lib/filter.c
index f86adab5d..a0adff0e3 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -885,7 +885,7 @@ static void access_list_init_ipv6(void)
install_element(ENABLE_NODE, &show_ipv6_access_list_name_cmd);
}
-void access_list_init(void)
+void access_list_init_new(bool in_backend)
{
cmd_variable_handler_register(access_list_handlers);
@@ -893,7 +893,15 @@ void access_list_init(void)
access_list_init_ipv6();
access_list_init_mac();
- filter_cli_init();
+ if (!in_backend) {
+ /* we do not want to handle config commands in the backend */
+ filter_cli_init();
+ }
+}
+
+void access_list_init(void)
+{
+ access_list_init_new(false);
}
void access_list_reset(void)
diff --git a/lib/filter.h b/lib/filter.h
index e092f0771..bd9e22d38 100644
--- a/lib/filter.h
+++ b/lib/filter.h
@@ -114,6 +114,7 @@ struct access_master {
/* Prototypes for access-list. */
extern void access_list_init(void);
+extern void access_list_init_new(bool in_backend);
extern void access_list_reset(void);
extern void access_list_add_hook(void (*func)(struct access_list *));
extern void access_list_delete_hook(void (*func)(struct access_list *));
@@ -124,13 +125,13 @@ extern enum filter_type access_list_apply(struct access_list *access,
struct access_list *access_list_get(afi_t afi, const char *name);
void access_list_delete(struct access_list *access);
struct filter *filter_new(void);
-void access_list_filter_add(struct access_list *access,
- struct filter *filter);
+void access_list_filter_add(struct access_list *access, struct filter *filter);
void access_list_filter_delete(struct access_list *access,
struct filter *filter);
int64_t filter_new_seq_get(struct access_list *access);
extern const struct frr_yang_module_info frr_filter_info;
+extern const struct frr_yang_module_info frr_filter_cli_info;
/* filter_nb.c */
diff --git a/lib/filter_nb.c b/lib/filter_nb.c
index 1c436cc6f..eba4e421c 100644
--- a/lib/filter_nb.c
+++ b/lib/filter_nb.c
@@ -1785,3 +1785,35 @@ const struct frr_yang_module_info frr_filter_info = {
},
}
};
+
+const struct frr_yang_module_info frr_filter_cli_info = {
+ .name = "frr-filter",
+ .ignore_cfg_cbs = true,
+ .nodes = {
+ {
+ .xpath = "/frr-filter:lib/access-list/remark",
+ .cbs.cli_show = access_list_remark_show,
+ },
+ {
+ .xpath = "/frr-filter:lib/access-list/entry",
+ .cbs = {
+ .cli_cmp = access_list_cmp,
+ .cli_show = access_list_show,
+ }
+ },
+ {
+ .xpath = "/frr-filter:lib/prefix-list/remark",
+ .cbs.cli_show = prefix_list_remark_show,
+ },
+ {
+ .xpath = "/frr-filter:lib/prefix-list/entry",
+ .cbs = {
+ .cli_cmp = prefix_list_cmp,
+ .cli_show = prefix_list_show,
+ }
+ },
+ {
+ .xpath = NULL,
+ },
+ }
+};
diff --git a/mgmtd/mgmt_main.c b/mgmtd/mgmt_main.c
index 9340d3d10..bd0a9895c 100644
--- a/mgmtd/mgmt_main.c
+++ b/mgmtd/mgmt_main.c
@@ -170,7 +170,7 @@ const struct frr_yang_module_info zebra_route_map_info = {
* MGMTd.
*/
static const struct frr_yang_module_info *const mgmt_yang_modules[] = {
- &frr_filter_info,
+ &frr_filter_cli_info,
&frr_interface_info,
&frr_route_map_cli_info,
&frr_routing_info,
diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c
index 5aca6a8ef..5dd7be657 100644
--- a/mgmtd/mgmt_vty.c
+++ b/mgmtd/mgmt_vty.c
@@ -564,6 +564,7 @@ void mgmt_vty_init(void)
/*
* Library based CLI handlers
*/
+ filter_cli_init();
route_map_cli_init();
/*
diff --git a/python/xref2vtysh.py b/python/xref2vtysh.py
index 36e37e323..edaa2945c 100644
--- a/python/xref2vtysh.py
+++ b/python/xref2vtysh.py
@@ -33,8 +33,8 @@ frr_top_src = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
daemon_flags = {
"lib/agentx.c": "VTYSH_ISISD|VTYSH_RIPD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA",
- "lib/filter.c": "VTYSH_ACL",
- "lib/filter_cli.c": "VTYSH_ACL",
+ "lib/filter.c": "VTYSH_ACL_SHOW",
+ "lib/filter_cli.c": "VTYSH_ACL_CONFIG",
"lib/if.c": "VTYSH_INTERFACE",
"lib/keychain.c": "VTYSH_KEYS",
"lib/mgmt_be_client.c": "VTYSH_MGMT_BACKEND",
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index 9081cab76..7671609e3 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -49,7 +49,17 @@ extern struct event_loop *master;
VTYSH_PIM6D | VTYSH_NHRPD | VTYSH_EIGRPD | VTYSH_BABELD | \
VTYSH_SHARPD | VTYSH_PBRD | VTYSH_STATICD | VTYSH_BFDD | \
VTYSH_FABRICD | VTYSH_VRRPD | VTYSH_PATHD | VTYSH_MGMTD
-#define VTYSH_ACL 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_RIPD|VTYSH_RIPNGD|VTYSH_VRRPD|VTYSH_ZEBRA
+#define VTYSH_ACL_CONFIG \
+ 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
+#define VTYSH_ACL_SHOW \
+ 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_RIPD | VTYSH_RIPNGD | VTYSH_VRRPD | VTYSH_ZEBRA
+
#define VTYSH_AFFMAP VTYSH_ZEBRA | VTYSH_ISISD
#define VTYSH_RMAP_CONFIG \
VTYSH_ZEBRA | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | VTYSH_BGPD | \