summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-04-18 08:33:54 -0500
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-04-18 17:25:30 +0000
commit3976eebd3d107c14e22426ff2cdb66dc31e9be20 (patch)
tree022d026a77fa80638ffba56147814c3481f324ee /src
parentcc2458dfc74a55034a022f362d95e340b89f5ecd (diff)
downloadvyos-1x-3976eebd3d107c14e22426ff2cdb66dc31e9be20.tar.gz
vyos-1x-3976eebd3d107c14e22426ff2cdb66dc31e9be20.zip
openvpn: T6245: return 'n/a' if client info not available
(cherry picked from commit a43f1c00bdc5047eb20840ebb274418362612526)
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'