interfaces: better safe than sorry

This commit is contained in:
Franco Fichtner 2017-01-09 08:59:09 +01:00
parent e97c4f1d11
commit 397c95f89c

View File

@ -350,11 +350,11 @@ function legacy_get_interface_addresses($ifs)
{
$intf_details = legacy_interface_details($ifs);
$addrs = array("macaddr" => $intf_details['macaddr']);
if (!empty($intf_details['ipv4'])) {
if (!empty($intf_details['ipv4'][0])) {
$addrs['ipaddr'] = $intf_details['ipv4'][0]['ipaddr'];
$addrs['subnetbits'] = $intf_details['ipv4'][0]['subnetbits'];
}
if (!empty($intf_details['ipv6']) && empty($intf_details['ipv6'][0]['link-local'])) {
if (!empty($intf_details['ipv6'][0]) && empty($intf_details['ipv6'][0]['link-local'])) {
$addrs['ipaddr6'] = $intf_details['ipv6'][0]['ipaddr'];
$addrs['subnetbits6'] = $intf_details['ipv6'][0]['subnetbits'];
}