summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authoraapostoliuk <a.apostoliuk@vyos.io>2023-08-02 15:20:20 +0300
committeraapostoliuk <a.apostoliuk@vyos.io>2023-08-07 11:32:22 +0300
commit0d54be778ba2bf1c918c43a525d7ef878a1cb9ea (patch)
tree6cc3c0cb7f70ff29c6df5fd77a2c3154e52e1242 /src/conf_mode
parentf8cc7f8ee7c87bd95198dfe6c28c966e840ab571 (diff)
downloadvyos-1x-0d54be778ba2bf1c918c43a525d7ef878a1cb9ea.tar.gz
vyos-1x-0d54be778ba2bf1c918c43a525d7ef878a1cb9ea.zip
wireguard: T5409: Added 'set interfaces wireguard wgX threaded'
Added 'set interfaces wireguard wgX threaded' command. Process traffic from each peer in a dedicated thread.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-wireguard.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-wireguard.py b/src/conf_mode/interfaces-wireguard.py
index 40404d091..ef0fdae15 100755
--- a/src/conf_mode/interfaces-wireguard.py
+++ b/src/conf_mode/interfaces-wireguard.py
@@ -90,7 +90,7 @@ def verify(wireguard):
# run checks on individual configured WireGuard peer
public_keys = []
-
+ peer_enabled = False
for tmp in wireguard['peer']:
peer = wireguard['peer'][tmp]
@@ -110,8 +110,15 @@ def verify(wireguard):
if 'disable' not in peer and is_wireguard_key_pair(wireguard['private_key'], peer['public_key']):
raise ConfigError(f'Peer "{tmp}" has the same public key as the interface "{wireguard["ifname"]}"')
+ if 'disable' not in peer:
+ peer_enabled = True
+
public_keys.append(peer['public_key'])
+ #Threaded can be enabled only if one enabled peer exists.
+ if not peer_enabled and 'threaded' in wireguard:
+ raise ConfigError(f'Set threaded on interface "{wireguard["ifname"]}" FAILED.\nNo enabled peers are configured')
+
def apply(wireguard):
tmp = WireGuardIf(wireguard['ifname'])
if 'deleted' in wireguard: