From 401036b4d1ff922ff8a6fe67d9cda96064f9cff4 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 24 Apr 2020 18:36:34 +0200 Subject: wireguard: T2375: if either peer address or port is present - so must be the other --- src/conf_mode/interfaces-wireguard.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf_mode/interfaces-wireguard.py b/src/conf_mode/interfaces-wireguard.py index 5ceceb592..01f84260d 100755 --- a/src/conf_mode/interfaces-wireguard.py +++ b/src/conf_mode/interfaces-wireguard.py @@ -222,6 +222,12 @@ def verify(wg): if not peer['pubkey']: raise ConfigError(f'Peer public-key required for peer "{peer_name}"!') + if peer['address'] and not peer['port']: + raise ConfigError(f'Peer "{peer_name}" port must be defined if address is defined!') + + if not peer['address'] and peer['port']: + raise ConfigError(f'Peer "{peer_name}" address must be defined if port is defined!') + def apply(wg): # init wg class -- cgit v1.2.3