Skip to content

Commit

Permalink
VPN: OpenVPN: Connection Status - missing mapping for client stats, c…
Browse files Browse the repository at this point in the history
…loses #6464
  • Loading branch information
AdSchellevis committed Apr 2, 2023
1 parent 96120d6 commit a5c4de0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/opnsense/scripts/openvpn/ovpn_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ def ovpn_status(filename):
return {'status': 'failed'}

header_def = []
client_fieldnames = {'read_bytes': 'bytes_received', 'write_bytes': 'bytes_sent'}
target_struct = None
for line in buffer.split('\n'):
if line.startswith('TCP/UDP'):
line = line.split(',')
response[line[0][8:].replace(' ', '_')] = line[1].strip()
fieldname = line[0][8:].replace(' ', '_')
if fieldname in client_fieldnames:
fieldname = client_fieldnames[fieldname]
response[fieldname] = line[1].strip()
continue
line = line.split('\t')
if line[0] == 'HEADER':
Expand Down Expand Up @@ -100,7 +104,7 @@ def ovpn_state(filename):
response['timestamp'] = int(tmp[0])
response['status'] = tmp[1].lower()
response['virtual_address'] = tmp[3] if len(tmp) > 3 else ""
response['remote_host'] = tmp[4] if len(tmp) > 4 else ""
response['real_address'] = tmp[4] if len(tmp) > 4 else ""

return response

Expand Down

0 comments on commit a5c4de0

Please sign in to comment.