Commit 397c95f8 authored by Franco Fichtner's avatar Franco Fichtner

interfaces: better safe than sorry

parent e97c4f1d
...@@ -350,11 +350,11 @@ function legacy_get_interface_addresses($ifs) ...@@ -350,11 +350,11 @@ function legacy_get_interface_addresses($ifs)
{ {
$intf_details = legacy_interface_details($ifs); $intf_details = legacy_interface_details($ifs);
$addrs = array("macaddr" => $intf_details['macaddr']); $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['ipaddr'] = $intf_details['ipv4'][0]['ipaddr'];
$addrs['subnetbits'] = $intf_details['ipv4'][0]['subnetbits']; $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['ipaddr6'] = $intf_details['ipv6'][0]['ipaddr'];
$addrs['subnetbits6'] = $intf_details['ipv6'][0]['subnetbits']; $addrs['subnetbits6'] = $intf_details['ipv6'][0]['subnetbits'];
} }
......
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