summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 22:24:52 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 22:24:52 +0200
commitac156aecb5f292f565ccd0aeafade4cc0cad6028 (patch)
treed84b2fdccb40b486b3d1ae80904d5ad53a7129b6 /vtysh
parentdoc: Add `allow-reserved-ranges` global command (diff)
downloadfrr-ac156aecb5f292f565ccd0aeafade4cc0cad6028.tar.xz
frr-ac156aecb5f292f565ccd0aeafade4cc0cad6028.zip
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 'vtysh')
-rw-r--r--vtysh/vtysh.c17
-rw-r--r--vtysh/vtysh_config.c20
2 files changed, 29 insertions, 8 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index a52bd7b11..21bd2f488 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -3140,6 +3140,20 @@ DEFUN(vtysh_debug_uid_backtrace,
return err;
}
+DEFUNSH(VTYSH_ALL, vtysh_allow_reserved_ranges, vtysh_allow_reserved_ranges_cmd,
+ "allow-reserved-ranges",
+ "Allow using IPv4 (Class E) reserved IP space\n")
+{
+ return CMD_SUCCESS;
+}
+
+DEFUNSH(VTYSH_ALL, no_vtysh_allow_reserved_ranges,
+ no_vtysh_allow_reserved_ranges_cmd, "no allow-reserved-ranges",
+ NO_STR "Allow using IPv4 (Class E) reserved IP space\n")
+{
+ return CMD_SUCCESS;
+}
+
DEFUNSH(VTYSH_ALL, vtysh_service_password_encrypt,
vtysh_service_password_encrypt_cmd, "service password-encryption",
"Set up miscellaneous service\n"
@@ -4902,6 +4916,9 @@ void vtysh_init_vty(void)
install_element(CONFIG_NODE, &vtysh_service_password_encrypt_cmd);
install_element(CONFIG_NODE, &no_vtysh_service_password_encrypt_cmd);
+ install_element(CONFIG_NODE, &vtysh_allow_reserved_ranges_cmd);
+ install_element(CONFIG_NODE, &no_vtysh_allow_reserved_ranges_cmd);
+
install_element(CONFIG_NODE, &vtysh_password_cmd);
install_element(CONFIG_NODE, &no_vtysh_password_cmd);
install_element(CONFIG_NODE, &vtysh_enable_password_cmd);
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 3bd5489ee..a7ec2a93c 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -478,14 +478,18 @@ void vtysh_config_parse_line(void *arg, const char *line)
else if (strncmp(line, "rpki", strlen("rpki")) == 0)
config = config_get(RPKI_NODE, line);
else {
- if (strncmp(line, "log", strlen("log")) == 0
- || strncmp(line, "hostname", strlen("hostname")) == 0
- || strncmp(line, "domainname", strlen("domainname")) == 0
- || strncmp(line, "frr", strlen("frr")) == 0
- || strncmp(line, "agentx", strlen("agentx")) == 0
- || strncmp(line, "no log", strlen("no log")) == 0
- || strncmp(line, "no ip prefix-list", strlen("no ip prefix-list")) == 0
- || strncmp(line, "no ipv6 prefix-list", strlen("no ipv6 prefix-list")) == 0)
+ if (strncmp(line, "log", strlen("log")) == 0 ||
+ strncmp(line, "hostname", strlen("hostname")) ==
+ 0 ||
+ strncmp(line, "domainname", strlen("domainname")) ==
+ 0 ||
+ strncmp(line, "frr", strlen("frr")) == 0 ||
+ strncmp(line, "agentx", strlen("agentx")) == 0 ||
+ strncmp(line, "no log", strlen("no log")) == 0 ||
+ strncmp(line, "no ip prefix-list",
+ strlen("no ip prefix-list")) == 0 ||
+ strncmp(line, "no ipv6 prefix-list",
+ strlen("no ipv6 prefix-list")) == 0)
config_add_line_uniq(config_top, line);
else
config_add_line(config_top, line);