diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-03-24 13:31:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-24 13:31:22 +0200 |
| commit | 45757aef36075b1706ae71b78aec072b952af26c (patch) | |
| tree | 0ea5000ce49ca0c0b24dcb26b1487b81fc4573ed /src/validators/ipv6-eui64-prefix | |
| parent | e66c23ddf1f70fd7aa31fbc696a361a376ea15d1 (diff) | |
| parent | 36b73f909857f3d8327af73bfd4332c639d0da2f (diff) | |
| download | vyos-1x-45757aef36075b1706ae71b78aec072b952af26c.tar.gz vyos-1x-45757aef36075b1706ae71b78aec072b952af26c.zip | |
Merge pull request #5070 from natali-rs1985/T8384
validators: T8384: ipv6-eui64-prefix: unhandled exception on eui-64 address validation
Diffstat (limited to 'src/validators/ipv6-eui64-prefix')
| -rwxr-xr-x | src/validators/ipv6-eui64-prefix | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/validators/ipv6-eui64-prefix b/src/validators/ipv6-eui64-prefix index d7f262633..73ef9b29e 100755 --- a/src/validators/ipv6-eui64-prefix +++ b/src/validators/ipv6-eui64-prefix @@ -2,6 +2,8 @@ # Validator used to check if given IPv6 prefix is of size /64 required by EUI64 +import ipaddress + from sys import argv from sys import exit @@ -10,7 +12,14 @@ if __name__ == '__main__': exit(1) prefix = argv[1] - if prefix.split('/')[1] == '64': - exit(0) + + try: + network = ipaddress.ip_network(prefix) + if network.prefixlen == 64: + exit(0) + except ValueError: + print( + 'EUI64 prefix must be a valid IPv6 prefix in CIDR notation (e.g., 2001:db8::/64)' + ) exit(1) |
