Commit a206e8f6 authored by Ad Schellevis's avatar Ad Schellevis

missed the pfctl counters in www/widgets/api/plugins/interfaces.inc, for...

missed the pfctl counters in www/widgets/api/plugins/interfaces.inc, for https://github.com/opnsense/core/issues/1662
parent 89a81f3e
...@@ -32,15 +32,17 @@ function interfaces_api() ...@@ -32,15 +32,17 @@ function interfaces_api()
{ {
$result = array(); $result = array();
$ifsinfo = get_interfaces_info(); $ifsinfo = get_interfaces_info();
$pfctl_counters = json_decode(configd_run("filter list counters json"), true);
foreach (get_configured_interface_with_descr() as $ifdescr => $ifname) { foreach (get_configured_interface_with_descr() as $ifdescr => $ifname) {
$ifinfo = $ifsinfo[$ifdescr]; $ifinfo = $ifsinfo[$ifdescr];
$ifpfcounters = $pfctl_counters[$ifinfo['if']];
$interfaceItem = array(); $interfaceItem = array();
$interfaceItem['inpkts'] = $ifinfo['inpkts']; $interfaceItem['inpkts'] = $ifpfcounters['inpkts'];
$interfaceItem['outpkts'] = $ifinfo['outpkts']; $interfaceItem['outpkts'] = $ifpfcounters['outpkts'];
$interfaceItem['inbytes'] = $ifinfo['inbytes']; $interfaceItem['inbytes'] = $ifpfcounters['inbytes'];
$interfaceItem['outbytes'] = $ifinfo['outbytes']; $interfaceItem['outbytes'] = $ifpfcounters['outbytes'];
$interfaceItem['inbytes_frmt'] = format_bytes($ifinfo['inbytes']); $interfaceItem['inbytes_frmt'] = format_bytes($ifpfcounters['inbytes']);
$interfaceItem['outbytes_frmt'] = format_bytes($ifinfo['outbytes']); $interfaceItem['outbytes_frmt'] = format_bytes($ifpfcounters['outbytes']);
$interfaceItem['inerrs'] = isset($ifinfo['inerrs']) ? $ifinfo['inerrs'] : "0"; $interfaceItem['inerrs'] = isset($ifinfo['inerrs']) ? $ifinfo['inerrs'] : "0";
$interfaceItem['outerrs'] = isset($ifinfo['outerrs']) ? $ifinfo['outerrs'] : "0"; $interfaceItem['outerrs'] = isset($ifinfo['outerrs']) ? $ifinfo['outerrs'] : "0";
$interfaceItem['collisions'] = isset($ifinfo['collisions']) ? $ifinfo['collisions'] : "0"; $interfaceItem['collisions'] = isset($ifinfo['collisions']) ? $ifinfo['collisions'] : "0";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment