diff --git a/src/opnsense/scripts/openvpn/ovpn_status.py b/src/opnsense/scripts/openvpn/ovpn_status.py index 7d6613364..cdd7d17df 100755 --- a/src/opnsense/scripts/openvpn/ovpn_status.py +++ b/src/opnsense/scripts/openvpn/ovpn_status.py @@ -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