summaryrefslogtreecommitdiff
path: root/src/validators
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-18 09:06:10 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-18 09:06:10 +0200
commit63b755f85afb12ae6b609d76ef7d1b4cc2ff5a98 (patch)
tree8ccf40829917afb468dcc13e56c5cfbfee0a214b /src/validators
parent053f586fa7a5a69b3b6be81339c73d8550d67fc6 (diff)
downloadvyos-1x-63b755f85afb12ae6b609d76ef7d1b4cc2ff5a98.tar.gz
vyos-1x-63b755f85afb12ae6b609d76ef7d1b4cc2ff5a98.zip
policy: T2425: import exact Perl match criteria for large-community-list
Diffstat (limited to 'src/validators')
-rwxr-xr-xsrc/validators/large-community-list13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/validators/large-community-list b/src/validators/large-community-list
index 6c9a3a148..c07268e81 100755
--- a/src/validators/large-community-list
+++ b/src/validators/large-community-list
@@ -29,13 +29,8 @@ if __name__ == '__main__':
if not len(value) == 3:
sys.exit(1)
- # Check if the first string is an IPv4 address
- if is_ipv4(value[0]):
- if value[1].isdigit() and value[2].isdigit():
- sys.exit(0)
- # If first string is not an IP address it must be a number
- else:
- if value[0].isdigit() and value[1].isdigit() and value[2].isdigit():
- sys.exit(0)
+ if not (re.match(pattern, sys.argv[1]) and
+ (is_ipv4(value[0]) or value[0].isdigit()) and value[1].isdigit()):
+ sys.exit(1)
- sys.exit(1)
+ sys.exit(0)