summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-15 18:35:04 +0200
committerGitHub <noreply@github.com>2020-04-15 18:35:04 +0200
commitb5de1daab68d223174476f653f5a591c1e0e4de6 (patch)
tree4360b7298c3f2067635abd8c64c0b4e15a389d17 /src
parent011bb3423567d659c5af87bb99fac357560d9368 (diff)
parentb32c568ba77bd2d684a0794b47f48b537251b271 (diff)
downloadvyos-1x-b5de1daab68d223174476f653f5a591c1e0e4de6.tar.gz
vyos-1x-b5de1daab68d223174476f653f5a591c1e0e4de6.zip
Merge pull request #346 from thomas-mangin/T31-vrf-exists
tunnel: T31: check that the assigned VRF exists
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-tunnel.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py
index c51048aeb..06c2ea29b 100755
--- a/src/conf_mode/interfaces-tunnel.py
+++ b/src/conf_mode/interfaces-tunnel.py
@@ -19,6 +19,7 @@ import netifaces
from sys import exit
from copy import deepcopy
+from netifaces import interfaces
from vyos.config import Config
from vyos.ifconfig import Interface, GREIf, GRETapIf, IPIPIf, IP6GREIf, IPIP6If, IP6IP6If, SitIf, Sit6RDIf
@@ -506,6 +507,12 @@ def verify(conf):
if ipv6_count and not IP6 in kls.ip:
print(f'Should not use IPv6 addresses on tunnel {iftype} {ifname}')
+ # vrf check
+
+ vrf = options['vrf']
+ if vrf and vrf not in interfaces():
+ raise ConfigError(f'VRF "{vrf}" does not exist')
+
# tunnel encapsulation check
convert = {