Skip to content

Commit f66a3c7

Browse files
committed
wireguard: T7166: Call vxlan dependency if interface exist
1 parent 4ce3b92 commit f66a3c7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

data/config-mode-dependencies/vyos-1x.json

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"vxlan": ["interfaces_vxlan"],
1515
"wlan": ["interfaces_wireless"]
1616
},
17+
"interfaces_wireguard": {
18+
"vxlan": ["interfaces_vxlan"]
19+
},
1720
"load_balancing_wan": {
1821
"conntrack": ["system_conntrack"]
1922
},

src/conf_mode/interfaces_wireguard.py

+16
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from vyos.config import Config
2020
from vyos.configdict import get_interface_dict
2121
from vyos.configdict import is_node_changed
22+
from vyos.configdict import is_source_interface
23+
from vyos.configdep import set_dependents
24+
from vyos.configdep import call_dependents
2225
from vyos.configverify import verify_vrf
2326
from vyos.configverify import verify_address
2427
from vyos.configverify import verify_bridge_delete
@@ -35,6 +38,7 @@
3538
from pathlib import Path
3639
airbag.enable()
3740

41+
3842
def get_config(config=None):
3943
"""
4044
Retrive CLI config as dictionary. Dictionary can never be empty, as at least the
@@ -61,8 +65,15 @@ def get_config(config=None):
6165
if 'disable' not in peer_config and 'host_name' in peer_config:
6266
wireguard['peers_need_resolve'].append(peer)
6367

68+
# Check if interface is used as source-interface on VXLAN interface
69+
if 'deleted' not in wireguard:
70+
tmp = is_source_interface(conf, ifname, 'vxlan')
71+
if tmp:
72+
set_dependents('vxlan', conf, tmp)
73+
6474
return wireguard
6575

76+
6677
def verify(wireguard):
6778
if 'deleted' in wireguard:
6879
verify_bridge_delete(wireguard)
@@ -119,9 +130,11 @@ def verify(wireguard):
119130

120131
public_keys.append(peer['public_key'])
121132

133+
122134
def generate(wireguard):
123135
return None
124136

137+
125138
def apply(wireguard):
126139
check_kmod('wireguard')
127140

@@ -157,8 +170,11 @@ def apply(wireguard):
157170
domain_action = 'stop'
158171
call(f'systemctl {domain_action} vyos-domain-resolver.service')
159172

173+
call_dependents()
174+
160175
return None
161176

177+
162178
if __name__ == '__main__':
163179
try:
164180
c = get_config()

0 commit comments

Comments
 (0)