diff options
author | Daniil Baturin <daniil@vyos.io> | 2020-07-26 14:02:47 +0300 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2020-07-26 14:03:53 +0300 |
commit | 920d87447ca479c311102260e5816ec0f5268a9b (patch) | |
tree | fdf6af4bd25f3936f797afc7ed48f66ab308ba15 /python | |
parent | eb6bfbd75bf61828af886b3c9a06384e49b451ae (diff) | |
download | vyos-1x-920d87447ca479c311102260e5816ec0f5268a9b.tar.gz vyos-1x-920d87447ca479c311102260e5816ec0f5268a9b.zip |
T1949: backport the IPv6 BFD validation improvements from PR#199
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/validate.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py index 8def0a510..ffe530ede 100644 --- a/python/vyos/validate.py +++ b/python/vyos/validate.py @@ -38,6 +38,18 @@ def is_ipv6(addr): else: return False +def is_ipv6_link_local(addr): + """ + Check addr if it is an IPv6 link-local address/network. Returns True/False + """ + + addr = addr.split('%')[0] + if is_ipv6(addr): + if ipaddress.IPv6Address(addr).is_link_local: + return True + + return False + def is_addr_assigned(addr): """ Verify if the given IPv4/IPv6 address is assigned to any interface on this |