summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-04-18 08:33:54 -0500
committerJohn Estabrook <jestabro@vyos.io>2024-04-18 09:21:02 -0500
commita43f1c00bdc5047eb20840ebb274418362612526 (patch)
treec1f2ea2be77584de0ef28c3f93a83c86bd1d31f1 /src
parent3a50e87584a89047d8a5644f1b1d7b4805ab8238 (diff)
downloadvyos-1x-a43f1c00bdc5047eb20840ebb274418362612526.tar.gz
vyos-1x-a43f1c00bdc5047eb20840ebb274418362612526.zip
openvpn: T6245: return 'n/a' if client info not available
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/openvpn.py7
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'