summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-06-16 20:20:09 +0200
committerChristian Poessinger <christian@poessinger.com>2019-06-22 01:01:29 +0200
commit4fa93aefd1e4c525267f90b5fd7797157946c9bd (patch)
tree11094b586e89121b2e57c8cec07234c1d65b2d49 /src
parentecbe6c1c1b87792048512e3aa4913c1ce5b75c82 (diff)
downloadvyos-1x-4fa93aefd1e4c525267f90b5fd7797157946c9bd.tar.gz
vyos-1x-4fa93aefd1e4c525267f90b5fd7797157946c9bd.zip
bfd: T1183: IPv6 peers require explicit local address/interface
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/protocols_bfd.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py
index 7e137c484..51af67ff6 100755
--- a/src/conf_mode/protocols_bfd.py
+++ b/src/conf_mode/protocols_bfd.py
@@ -15,7 +15,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import sys
import copy
+import vyos.validate
+
+from vyos import ConfigError
from vyos.config import Config
default_config_data = {
@@ -33,7 +37,7 @@ def get_config():
for peer in conf.list_nodes('peer'):
conf.set_level('protocols bfd peer {0}'.format(peer))
bfd_peer = {
- 'peer': peer,
+ 'remote': peer,
'shutdown': False,
'local-interface': '',
'local-address': '',
@@ -53,16 +57,36 @@ def get_config():
bfd['peers'].append(bfd_peer)
- print(bfd)
return bfd
def verify(bfd):
+ if bfd is None:
+ return None
+
+ for peer in bfd['peers']:
+ # Bail out early if peer is shutdown
+ if peer['shutdown']:
+ continue
+
+ # IPv6 peers require an explicit local address/interface combination
+ if vyos.validate.is_ipv6(peer['remote']):
+ if not (peer['local-interface'] and peer['local-address']):
+ raise ConfigError("BFD IPv6 peers require explicit local address/interface setting")
+
+
return None
def generate(bfd):
+ if bfd is None:
+ return None
+
return None
def apply(bfd):
+ if bfd is None:
+ return None
+
+ print(bfd)
return None
if __name__ == '__main__':