summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrf.py
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-07-12 08:39:36 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-07-12 15:23:07 +0000
commit70f42e308a6d5b671b78762048182e7e38fdb715 (patch)
tree949ed182d482e01647cee34e316e95d8c6d8cc1a /src/conf_mode/vrf.py
parent464af891335e14de3a9a76597da99d7e3543e7f2 (diff)
downloadvyos-1x-70f42e308a6d5b671b78762048182e7e38fdb715.tar.gz
vyos-1x-70f42e308a6d5b671b78762048182e7e38fdb715.zip
vrf: T4527: Prevent to create VRF with reserved names
VRF names: "add, all, broadcast, default, delete, dev, get, inet, mtu, link, type, vrf" are reserved and cannot be used for vrf name (cherry picked from commit 52342f389af2da2995b858d026e6fbcad5c8bfaa)
Diffstat (limited to 'src/conf_mode/vrf.py')
-rwxr-xr-xsrc/conf_mode/vrf.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index fb2182fff..def4cc70d 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -108,8 +108,14 @@ def verify(vrf):
f'static routes installed!')
if 'name' in vrf:
+ reserved_names = ["add", "all", "broadcast", "default", "delete", "dev", "get", "inet", "mtu", "link", "type",
+ "vrf"]
table_ids = []
for name, config in vrf['name'].items():
+ # Reserved VRF names
+ if name in reserved_names:
+ raise ConfigError(f'VRF name "{name}" is reserved and connot be used!')
+
# table id is mandatory
if 'table' not in config:
raise ConfigError(f'VRF "{name}" table id is mandatory!')