summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/ifconfig/wireguard.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/wireguard.py b/python/vyos/ifconfig/wireguard.py
index fe5e9c519..58613813f 100644
--- a/python/vyos/ifconfig/wireguard.py
+++ b/python/vyos/ifconfig/wireguard.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,8 @@ from hurry.filesize import alternative
from vyos.ifconfig import Interface
from vyos.ifconfig import Operational
from vyos.template import is_ipv6
+from vyos.base import Warning
+
class WireGuardOperational(Operational):
def _dump(self):
@@ -184,7 +186,6 @@ class WireGuardIf(Interface):
base_cmd += f' private-key {tmp_file.name}'
base_cmd = base_cmd.format(**config)
-
if 'peer' in config:
for peer, peer_config in config['peer'].items():
# T4702: No need to configure this peer when it was explicitly
@@ -229,5 +230,12 @@ class WireGuardIf(Interface):
if psk_file != no_psk_file and os.path.exists(psk_file):
os.remove(psk_file)
+ try:
+ self._write_sysfs(f'/sys/devices/virtual/net/{self.ifname}/threaded',
+ '1' if 'threaded' in config else '0')
+ except Exception:
+ Warning(f'Update threaded status on interface "{config["ifname"]}" FAILED.\n'
+ f'An unexpected error occurred.')
+
# call base class
super().update(config)