Make 'any' a reserved name for prefixlists

This commit is contained in:
Pim van Pelt
2023-01-16 14:20:07 +00:00
parent 8a7c690ee5
commit 0e4490fc06
3 changed files with 25 additions and 1 deletions

View File

@ -363,7 +363,7 @@ interfaces:
This construct allows to enumerate a list of IPv4 or IPv6 host addresses and/or networks. Each
prefixlist has a name which consists of anywhere between 1 and 56 characters, and it must start
with a letter. The syntax is straight forward:
with a letter. The prefixlist name `any` is reserved. The syntax is straight forward:
* ***description***: A string, no longer than 64 characters, and excluding the single quote '
and double quote ". This string is currently not used anywhere, and serves for enduser

View File

@ -113,6 +113,12 @@ def validate_prefixlists(yaml):
for plname, pl in yaml["prefixlists"].items():
logger.debug(f"prefixlist {plname}: {pl}")
if plname in ["any"]:
## Note: ACL 'source' and 'destination', when they are empty, will resolve
## to 'any', and can thus never refer to a prefixlist called 'any'.
msgs.append(f"prefixlist {plname} is a reserved name")
result = False
members = 0
for pl_member in pl["members"]:
members += 1

View File

@ -0,0 +1,18 @@
test:
description: "Some prefixlist names are reserved"
errors:
expected:
- "prefixlist any is a reserved name"
count: 1
---
prefixlists:
any:
description: "any is a reserved name"
members:
- 192.0.2.1
- 192.0.2.0/24
v6only:
members:
- 2001:db8::1
- 2001:db8::/64
- 2001:db8::/48