diff options
author | John Estabrook <jestabro@vyos.io> | 2024-04-18 12:29:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 12:29:23 -0500 |
commit | 63eb47d62eff7a294e06b438a26f2c2997c53f5b (patch) | |
tree | 022d026a77fa80638ffba56147814c3481f324ee | |
parent | cc2458dfc74a55034a022f362d95e340b89f5ecd (diff) | |
parent | 3976eebd3d107c14e22426ff2cdb66dc31e9be20 (diff) | |
download | vyos-1x-63eb47d62eff7a294e06b438a26f2c2997c53f5b.tar.gz vyos-1x-63eb47d62eff7a294e06b438a26f2c2997c53f5b.zip |
Merge pull request #3331 from vyos/mergify/bp/sagitta/pr-3330
openvpn: T6245: return 'n/a' if client info not available (backport #3330)
-rwxr-xr-x | src/op_mode/openvpn.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/op_mode/openvpn.py b/src/op_mode/openvpn.py index d54a67199..092873909 100755 --- a/src/op_mode/openvpn.py +++ b/src/op_mode/openvpn.py @@ -48,9 +48,12 @@ def _get_tunnel_address(peer_host, peer_port, status_file): # 10.10.2.0/25,client1,... lst = [l for l in lst[1:] if '/' not in l.split(',')[0]] - tunnel_ip = lst[0].split(',')[0] + if lst: + tunnel_ip = lst[0].split(',')[0] - return tunnel_ip + return tunnel_ip + + return 'n/a' def _get_interface_status(mode: str, interface: str) -> dict: status_file = f'/run/openvpn/{interface}.status' |