mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
VPN: OpenVPN: Connection Status - missing mapping for client stats, closes https://github.com/opnsense/core/issues/6464
This commit is contained in:
parent
96120d6fe3
commit
a5c4de07b0
@ -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':
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user