Skip to content

Commit

Permalink
openvpn: T6245: return 'n/a' if client info not available
Browse files Browse the repository at this point in the history
  • Loading branch information
jestabro committed Apr 18, 2024
1 parent 3a50e87 commit a43f1c0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/op_mode/openvpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit a43f1c0

Please sign in to comment.