diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php b/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php index a0796160e..c0f790826 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php @@ -111,9 +111,10 @@ class OverviewController extends ApiControllerBase $cfg = Config::getInstance()->object(); $result = []; - /* quick information */ + /* abbreviated information */ $ifinfo = json_decode($backend->configdpRun('interface list ifconfig', [$interface]), true); $routes = json_decode($backend->configdRun('interface routes list -n json'), true); + $ifaddr = json_decode($backend->configdRun('interface address'), true); /* detailed information */ if ($detailed) { @@ -180,6 +181,11 @@ class OverviewController extends ApiControllerBase $tmp['description'] = !empty($config['descr']) ? $config['descr'] : strtoupper($config['identifier']); $tmp['enabled'] = !empty($config['enable']); $tmp['link_type'] = !empty($config['ipaddr']) ? $config['ipaddr'] : 'none'; + foreach ([4, 6] as $primary) { + $addr = $ifaddr[$config['identifier']][$primary != 4] ?? []; + $tmp['addr' . $primary] = !empty($addr['address']) ? + "{$addr['address']}/{$addr['bits']}" : ''; + } if (Util::isIpAddress($tmp['link_type'])) { $tmp['link_type'] = 'static'; } elseif (empty($config['ipaddr']) && !empty(!empty($config['ipaddrv6']))) { diff --git a/src/opnsense/www/js/widgets/Interfaces.js b/src/opnsense/www/js/widgets/Interfaces.js index 27ed166c8..c84813bf4 100644 --- a/src/opnsense/www/js/widgets/Interfaces.js +++ b/src/opnsense/www/js/widgets/Interfaces.js @@ -85,15 +85,8 @@ export default class Interfaces extends BaseTableWidget { `).prop('outerHTML')); - let ipv4 = ''; - let ipv6 = ''; - if ('ipv4' in intf_data && intf_data.ipv4.length > 0) { - ipv4 = intf_data.ipv4[0].ipaddr; - } - - if ('ipv6' in intf_data && intf_data.ipv6.length > 0) { - ipv6 = intf_data.ipv6[0].ipaddr; - } + let ipv4 = intf_data.addr4; + let ipv6 = intf_data.addr6; row.push($(`