interfaces: work harder to match ifconfig output #5008

This commit is contained in:
Franco Fichtner 2021-06-07 08:51:12 +02:00
parent 89922cc191
commit 735dbfa7f6

View File

@ -4629,12 +4629,15 @@ function interfaces_primary_address6($interface, $realif = null, $ifconfig_detai
$addrparts = explode('/', $tmpaddr);
foreach (config_read_array('virtualip', 'vip') as $vip) {
if (
$vip['interface'] == $interface && $vip['mode'] == 'ipalias' &&
Net_IPv6::compress($vip['subnet']) == $addrparts[0]
) {
/* do not care about alias */
continue 2;
if ($vip['interface'] == $interface && $vip['mode'] == 'ipalias' && strpos($vip['subnet'], ':') !== false) {
/*
* Since we do not know what subnet value was given by user
* uncompress/compress to match correctly compressed system
* value. Matchig alias cannot be primary address.
*/
if (Net_IPv6::compress(Net_IPv6::uncompress($vip['subnet'])) == $addrparts[0]) {
continue 2;
}
}
}