Commit cc145db9 authored by Franco Fichtner's avatar Franco Fichtner

Revert "(legacy) remove cache stuff from find_interface_ipv6_ll"

This reverts commit 5474af27.
parent 1ab17d31
...@@ -188,7 +188,7 @@ EOD; ...@@ -188,7 +188,7 @@ EOD;
if ($gateway['monitor'] == $gateway['gateway']) { if ($gateway['monitor'] == $gateway['gateway']) {
/* link locals really need a different src ip */ /* link locals really need a different src ip */
if (is_linklocal($gateway['gateway'])) { if (is_linklocal($gateway['gateway'])) {
$gwifip = find_interface_ipv6_ll($gateway['interface']); $gwifip = find_interface_ipv6_ll($gateway['interface'], true);
} else { } else {
$gwifip = find_interface_ipv6($gateway['interface']); $gwifip = find_interface_ipv6($gateway['interface']);
} }
......
...@@ -4528,20 +4528,29 @@ function find_interface_ipv6($interface) { ...@@ -4528,20 +4528,29 @@ function find_interface_ipv6($interface) {
/* /*
* find_interface_ipv6_ll($interface): return the interface ipv6 link local (first found) * find_interface_ipv6_ll($interface): return the interface ipv6 link local (first found)
*/ */
function find_interface_ipv6_ll($interface) { function find_interface_ipv6_ll($interface, $flush = false) {
$interface = trim($interface); global $interface_llv6_arr_cache;
if (does_interface_exist($interface)) { global $config;
$ifinfo = pfSense_getall_interface_addresses($interface);
foreach($ifinfo as $line) { $interface = str_replace("\n", "", $interface);
if (strstr($line, ":")) {
$parts = explode("/", $line); if (!does_interface_exist($interface))
if(is_linklocal($parts[0])) { return;
return $parts[0];
} /* Setup IP cache */
} if (!isset($interface_llv6_arr_cache[$interface]) or $flush) {
$ifinfo = pfSense_getall_interface_addresses($interface);
foreach($ifinfo as $line) {
if (strstr($line, ":")) {
$parts = explode("/", $line);
if(is_linklocal($parts[0])) {
$ifinfo['linklocal'] = $parts[0];
} }
}
} }
return null; $interface_llv6_arr_cache[$interface] = $ifinfo['linklocal'];
}
return $interface_llv6_arr_cache[$interface];
} }
function find_interface_subnet($interface, $flush = false) { function find_interface_subnet($interface, $flush = false) {
......
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