diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-24 18:36:34 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-24 18:36:34 +0200 |
commit | 401036b4d1ff922ff8a6fe67d9cda96064f9cff4 (patch) | |
tree | e833cc2ff281914fced3dc9f95aae2b871c94894 | |
parent | 63070fa61536687d18b1b4b962f54fa5c94d072f (diff) | |
download | vyos-1x-401036b4d1ff922ff8a6fe67d9cda96064f9cff4.tar.gz vyos-1x-401036b4d1ff922ff8a6fe67d9cda96064f9cff4.zip |
wireguard: T2375: if either peer address or port is present - so must be the other
-rwxr-xr-x | src/conf_mode/interfaces-wireguard.py | 6 |
1 files changed, 6 insertions, 0 deletions
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 |