summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 23:24:52 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 23:24:52 +0300
commitac156aecb5f292f565ccd0aeafade4cc0cad6028 (patch)
treed84b2fdccb40b486b3d1ae80904d5ad53a7129b6 /lib/command.c
parenta28af47280aac1476672584309f9de70db392836 (diff)
lib, vtysh: Add `allow-reserved-ranges` global command
It will be used to allow/deny using IPv4 reserved ranges (Class E) for Zebra (configuring interface address) or BGP (allow next-hop to be from this range). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index cbecc81574..a23afb1e43 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -121,6 +121,11 @@ const char *cmd_version_get(void)
return host.version;
}
+bool cmd_allow_reserved_ranges_get(void)
+{
+ return host.allow_reserved_ranges;
+}
+
static int root_on_exit(struct vty *vty);
/* Standard command node structures. */
@@ -454,6 +459,9 @@ static int config_write_host(struct vty *vty)
if (name && name[0] != '\0')
vty_out(vty, "domainname %s\n", name);
+ if (cmd_allow_reserved_ranges_get())
+ vty_out(vty, "allow-reserved-ranges\n");
+
/* The following are all configuration commands that are not sent to
* watchfrr. For instance watchfrr is hardcoded to log to syslog so
* we would always display 'log syslog informational' in the config
@@ -2294,6 +2302,21 @@ DEFUN (no_banner_motd,
return CMD_SUCCESS;
}
+DEFUN(allow_reserved_ranges, allow_reserved_ranges_cmd, "allow-reserved-ranges",
+ "Allow using IPv4 (Class E) reserved IP space\n")
+{
+ host.allow_reserved_ranges = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN(no_allow_reserved_ranges, no_allow_reserved_ranges_cmd,
+ "no allow-reserved-ranges",
+ NO_STR "Allow using IPv4 (Class E) reserved IP space\n")
+{
+ host.allow_reserved_ranges = false;
+ return CMD_SUCCESS;
+}
+
int cmd_find_cmds(struct vty *vty, struct cmd_token **argv, int argc)
{
const struct cmd_node *node;
@@ -2483,6 +2506,7 @@ void cmd_init(int terminal)
host.lines = -1;
cmd_banner_motd_line(FRR_DEFAULT_MOTD);
host.motdfile = NULL;
+ host.allow_reserved_ranges = false;
/* Install top nodes. */
install_node(&view_node);
@@ -2552,6 +2576,8 @@ void cmd_init(int terminal)
install_element(CONFIG_NODE, &no_banner_motd_cmd);
install_element(CONFIG_NODE, &service_terminal_length_cmd);
install_element(CONFIG_NODE, &no_service_terminal_length_cmd);
+ install_element(CONFIG_NODE, &allow_reserved_ranges_cmd);
+ install_element(CONFIG_NODE, &no_allow_reserved_ranges_cmd);
log_cmd_init();
vrf_install_commands();