diff options
author | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2025-04-23 16:32:43 +0200 |
---|---|---|
committer | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2025-04-25 19:37:53 +0200 |
commit | 2b009d420f28a61353cc373abdea957df0555d18 (patch) | |
tree | 6f67dfeb42ecb782b7c4451fc2e27d89d678fdbf /src | |
parent | 7cbaefe575331f28a5b6009f841bb0299576af13 (diff) | |
download | vyos-1x-2b009d420f28a61353cc373abdea957df0555d18.tar.gz vyos-1x-2b009d420f28a61353cc373abdea957df0555d18.zip |
wireguard: T7387: Optimise wireguard peer handling
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/interfaces_wireguard.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/conf_mode/interfaces_wireguard.py b/src/conf_mode/interfaces_wireguard.py index 192937dba..289414c83 100755 --- a/src/conf_mode/interfaces_wireguard.py +++ b/src/conf_mode/interfaces_wireguard.py @@ -145,19 +145,11 @@ def generate(wireguard): def apply(wireguard): check_kmod('wireguard') - if 'rebuild_required' in wireguard or 'deleted' in wireguard: - wg = WireGuardIf(**wireguard) - # WireGuard only supports peer removal based on the configured public-key, - # by deleting the entire interface this is the shortcut instead of parsing - # out all peers and removing them one by one. - # - # Peer reconfiguration will always come with a short downtime while the - # WireGuard interface is recreated (see below) - wg.remove() + wg = WireGuardIf(**wireguard) - # Create the new interface if required - if 'deleted' not in wireguard: - wg = WireGuardIf(**wireguard) + if 'deleted' in wireguard: + wg.remove() + else: wg.update(wireguard) domain_resolver_usage = '/run/use-vyos-domain-resolver-interfaces-wireguard-' + wireguard['ifname'] |