interfaces: fix origin of bad read

'track6' might be shown as IPv6 address.
This commit is contained in:
Franco Fichtner 2023-05-22 13:00:08 +02:00
parent 4d9b8f0f4e
commit 41e5d0b79f
2 changed files with 8 additions and 9 deletions

View File

@ -3872,6 +3872,9 @@ function get_interfaces_info($include_unlinked = false)
$ifinfo['status'] = in_array($ifinfo['if'], $ifup) ? 'up' : 'down';
$ifinfo['statusv6'] = in_array($ifinfo['ifv6'], $ifup) ? 'up' : 'down';
/* undesired side effect of legacy_config_get_interfaces() */
$ifinfo['ipaddr'] = $ifinfo['ipaddrv6'] = null;
if (!empty($all_intf_details[$ifinfo['if']])) {
if (
isset($all_intf_details[$ifinfo['if']]['status']) &&
@ -4041,6 +4044,7 @@ function get_interfaces_info($include_unlinked = false)
$ifinfo['bridgeint'] = $bridge;
}
}
$result[$ifdescr] = $ifinfo;
}

View File

@ -237,16 +237,11 @@ include("head.inc");
<tr>
<td><?= gettext("IPv4 address") ?></td>
<td>
<?=$ifinfo['ipaddr'];?>/<?=$ifinfo['subnet'];?>
<?php
foreach($ifinfo['ipv4'] as $ipv4):
if ($ipv4['ipaddr'] != $ifinfo['ipaddr']):?>
<br/>
<?php foreach($ifinfo['ipv4'] as $ipv4): ?>
<i class="fa fa-plus-square-o" aria-hidden="true"></i>
<?=$ipv4['ipaddr'];?>/<?=$ipv4['subnetbits'];?> <?= !empty($ipv4['vhid']) ? 'vhid ' . $ipv4['vhid'] : "" ;?>
<?php
endif;
endforeach;?>
<br/>
<?php endforeach ?>
</td>
</tr>
<?php
@ -265,7 +260,7 @@ include("head.inc");
</tr>
<?php
endif;
if (!empty($ifinfo['ipaddrv6'][0]) && !$ifinfo['ipaddrv6'][0]['link-local']): ?>
if (!empty($ifinfo['ipaddrv6']) && !empty($ifinfo['ipv6'][0]) && !$ifinfo['ipv6'][0]['link-local']): ?>
<tr>
<td><?= gettext("IPv6 address") ?></td>
<td>