Commit b1161dfd authored by Franco Fichtner's avatar Franco Fichtner

interfaces: properly pick up subnet6 for link-local scope

parent 01f3c129
...@@ -302,16 +302,19 @@ function _legacy_getall_interface_addresses($ifs) ...@@ -302,16 +302,19 @@ function _legacy_getall_interface_addresses($ifs)
break; break;
case 'inet6': case 'inet6':
$addr = strtok($stat[1], '%'); $addr = strtok($stat[1], '%');
/* throw error on ifconfig output scan fail: */
unset($mask);
for ($i = 0; $i < count($stat) - 1; ++$i) {
if ($stat[$i] == 'prefixlen') {
$mask = intval($stat[$i + 1]);
}
}
if (!isset($addrs['ipaddr6']) && strpos($addr, 'fe80:') !== 0) { if (!isset($addrs['ipaddr6']) && strpos($addr, 'fe80:') !== 0) {
/* does not pick up link-local */ /* does not pick up link-local */
$addrs['subnetbits6'] = $mask;
$addrs['ipaddr6'] = $addr; $addrs['ipaddr6'] = $addr;
for ($i = 0; $i < count($stat); ++$i) {
if ($stat[$i] == 'prefixlen') {
$addrs['subnetbits6'] = intval($stat[$i+1]);
}
}
$addrs['compat'][] = $addr . '/' . $addrs['subnetbits6'];
} }
$addrs['compat'][] = $addr . '/' . $mask;
break; break;
case 'ether': case 'ether':
$addrs['macaddr'] = $stat[1]; $addrs['macaddr'] = $stat[1];
......
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