interfaces: treat deprecated addresses as non-primary

This commit is contained in:
Franco Fichtner 2021-01-19 12:23:14 +01:00
parent 9ef6ff335f
commit 171d5cda9f
2 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2015-2020 Franco Fichtner <franco@opnsense.org>
* Copyright (C) 2015-2021 Franco Fichtner <franco@opnsense.org>
* Copyright (C) 2004-2008 Scott Ullrich <sullrich@gmail.com>
* Copyright (C) 2008-2009 Ermal Luçi
* Copyright (C) 2005 Espen Johansen
@ -4621,7 +4621,7 @@ function interfaces_primary_address6($interface, $realif = null, $ifconfig_detai
$interfaces_a = config_read_array('interfaces');
foreach (interfaces_addresses($realif, true, $ifconfig_details) as $tmpaddr => $info) {
if ($info['family'] != 'inet6') {
if ($info['family'] != 'inet6' || $info['deprecated']) {
continue;
}

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (c) 2015-2017 Franco Fichtner <franco@opnsense.org>
* Copyright (c) 2015-2021 Franco Fichtner <franco@opnsense.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -279,12 +279,19 @@ function legacy_interfaces_details($intf = null)
} elseif (strpos($line, "\tinet6 ") !== false) {
// IPv6 information
$addr = strtok($line_parts[1], '%');
$tmp = array('ipaddr' => $addr, 'link-local' => strpos($addr, 'fe80:') === 0, 'tunnel' => false);
$tmp = array(
'deprecated' => false,
'ipaddr' => $addr,
'link-local' => strpos($addr, 'fe80:') === 0,
'tunnel' => false,
);
for ($i = 0; $i < count($line_parts) - 1; ++$i) {
if ($line_parts[$i] == 'prefixlen') {
$tmp['subnetbits'] = intval($line_parts[$i + 1]);
} elseif ($line_parts[$i] == 'vhid') {
$tmp['vhid'] = $line_parts[$i + 1];
} elseif ($line_parts[$i] == 'deprecated') {
$tmp['deprectated'] = true;
}
if ($line_parts[$i] == '-->') {
$tmp['tunnel'] = true;