summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-15 12:54:37 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-15 12:57:32 +0100
commitb32c568ba77bd2d684a0794b47f48b537251b271 (patch)
tree999468ef945ea53b9fa0665b07c4f0cc606abf72 /src
parent1e6dc1a45dd113dc49d24738d0b324bb67a8d11f (diff)
downloadvyos-1x-b32c568ba77bd2d684a0794b47f48b537251b271.tar.gz
vyos-1x-b32c568ba77bd2d684a0794b47f48b537251b271.zip
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 = {