diff options
author | Benjamin M. Hughes <bmhughes@bmhughes.co.uk> | 2020-01-07 14:47:06 +0000 |
---|---|---|
committer | Benjamin M. Hughes <bmhughes@bmhughes.co.uk> | 2020-01-09 21:53:20 +0000 |
commit | 17dd50751d72079ff67c67b3b4143ec234793955 (patch) | |
tree | 348b89351bcef82aec6df0ad0eccab404f5a487c /python/vyos | |
parent | c05063bc831047a0afebaca74508479ee4af278c (diff) | |
download | vyos-1x-17dd50751d72079ff67c67b3b4143ec234793955.tar.gz vyos-1x-17dd50751d72079ff67c67b3b4143ec234793955.zip |
bfd: T1949: fix verification logic for IPv6 BFD peers
IPv6 BFD peers only require a source address unless link-local addresses are used.
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/validate.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py index 1ce5a8467..8ffef64fa 100644 --- a/python/vyos/validate.py +++ b/python/vyos/validate.py @@ -52,6 +52,17 @@ def is_ipv6(addr): return False +def is_ipv6_link_local(addr): + """ + Check addr if it is an IPv6 link-local address/network. Returns True/False + """ + + if is_ipv6(addr): + if ipaddress.IPv6Address(addr).is_link_local: + return True + + return False + def is_intf_addr_assigned(intf, addr): """ Verify if the given IPv4/IPv6 address is assigned to specific interface. |