Commit 58e371d2 authored by Franco Fichtner's avatar Franco Fichtner

interfaces: properly pick up subnet6 for link-local scope

(cherry picked from commit b1161dfd)
parent ac9a263d
......@@ -302,16 +302,19 @@ function _legacy_getall_interface_addresses($ifs)
break;
case 'inet6':
$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) {
/* does not pick up link-local */
$addrs['subnetbits6'] = $mask;
$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;
case 'ether':
$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