diff options
author | aapostoliuk <a.apostoliuk@vyos.io> | 2023-08-02 15:20:20 +0300 |
---|---|---|
committer | aapostoliuk <a.apostoliuk@vyos.io> | 2023-08-07 11:32:22 +0300 |
commit | 0d54be778ba2bf1c918c43a525d7ef878a1cb9ea (patch) | |
tree | 6cc3c0cb7f70ff29c6df5fd77a2c3154e52e1242 /python/vyos/ifconfig | |
parent | f8cc7f8ee7c87bd95198dfe6c28c966e840ab571 (diff) | |
download | vyos-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 'python/vyos/ifconfig')
-rw-r--r-- | python/vyos/ifconfig/wireguard.py | 12 |
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) |