Commit 7b1f2d92 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) remove cache stuff from find_interface_subnetv6

(cherry picked from commit 48995d12)
parent d4f27bc4
...@@ -2839,7 +2839,6 @@ function interface_vlan_adapt_mtu($vlanifs, $mtu) { ...@@ -2839,7 +2839,6 @@ function interface_vlan_adapt_mtu($vlanifs, $mtu) {
function interface_configure($interface = 'wan', $reloadall = false, $linkupevent = false) function interface_configure($interface = 'wan', $reloadall = false, $linkupevent = false)
{ {
global $config; global $config;
global $interface_snv6_arr_cache;
$wancfg = $config['interfaces'][$interface]; $wancfg = $config['interfaces'][$interface];
...@@ -2954,9 +2953,6 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven ...@@ -2954,9 +2953,6 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
legacy_interface_flags($realhwif, interface_override_flags()); legacy_interface_flags($realhwif, interface_override_flags());
} }
/* invalidate interface/ip/sn cache */
unset($interface_snv6_arr_cache[$realif]);
$tunnelif = substr($realif, 0, 3); $tunnelif = substr($realif, 0, 3);
switch ($wancfg['ipaddr']) { switch ($wancfg['ipaddr']) {
case 'dhcp': case 'dhcp':
...@@ -3155,7 +3151,6 @@ function interface_track6_configure($interface = 'lan', $wancfg, $linkupevent = ...@@ -3155,7 +3151,6 @@ function interface_track6_configure($interface = 'lan', $wancfg, $linkupevent =
function interface_track6_6rd_configure($interface = 'lan', $lancfg) function interface_track6_6rd_configure($interface = 'lan', $lancfg)
{ {
global $config; global $config;
global $interface_snv6_arr_cache;
if (!is_array($lancfg)) if (!is_array($lancfg))
return; return;
...@@ -3205,7 +3200,6 @@ function interface_track6_6rd_configure($interface = 'lan', $lancfg) ...@@ -3205,7 +3200,6 @@ function interface_track6_6rd_configure($interface = 'lan', $lancfg)
$oip = find_interface_ipv6($lanif); $oip = find_interface_ipv6($lanif);
if (is_ipaddrv6($oip)) if (is_ipaddrv6($oip))
mwexec("/sbin/ifconfig {$lanif} inet6 {$oip} delete"); mwexec("/sbin/ifconfig {$lanif} inet6 {$oip} delete");
unset($interface_snv6_arr_cache[$lanif]);
log_error("rd6 {$interface} with ipv6 address {$rd6lan} based on {$lancfg['track6-interface']} ipv4 {$ip4address}"); log_error("rd6 {$interface} with ipv6 address {$rd6lan} based on {$lancfg['track6-interface']} ipv4 {$ip4address}");
mwexec("/sbin/ifconfig {$lanif} inet6 {$rd6lan} prefixlen 64"); mwexec("/sbin/ifconfig {$lanif} inet6 {$rd6lan} prefixlen 64");
...@@ -3215,7 +3209,6 @@ function interface_track6_6rd_configure($interface = 'lan', $lancfg) ...@@ -3215,7 +3209,6 @@ function interface_track6_6rd_configure($interface = 'lan', $lancfg)
function interface_track6_6to4_configure($interface = 'lan', $lancfg) function interface_track6_6to4_configure($interface = 'lan', $lancfg)
{ {
global $config; global $config;
global $interface_snv6_arr_cache;
if (!is_array($lancfg)) if (!is_array($lancfg))
return; return;
...@@ -3261,7 +3254,6 @@ function interface_track6_6to4_configure($interface = 'lan', $lancfg) ...@@ -3261,7 +3254,6 @@ function interface_track6_6to4_configure($interface = 'lan', $lancfg)
$oip = find_interface_ipv6($lanif); $oip = find_interface_ipv6($lanif);
if (is_ipaddrv6($oip)) if (is_ipaddrv6($oip))
mwexec("/sbin/ifconfig {$lanif} inet6 {$oip} delete"); mwexec("/sbin/ifconfig {$lanif} inet6 {$oip} delete");
unset($interface_snv6_arr_cache[$lanif]);
log_error("sixto4 {$interface} with ipv6 address {$sixto4lan} based on {$lancfg['track6-interface']} ipv4 {$ip4address}"); log_error("sixto4 {$interface} with ipv6 address {$sixto4lan} based on {$lancfg['track6-interface']} ipv4 {$ip4address}");
mwexec("/sbin/ifconfig {$lanif} inet6 {$sixto4lan} prefixlen 64"); mwexec("/sbin/ifconfig {$lanif} inet6 {$sixto4lan} prefixlen 64");
...@@ -4553,27 +4545,15 @@ function find_interface_subnet($interface) { ...@@ -4553,27 +4545,15 @@ function find_interface_subnet($interface) {
return null; return null;
} }
function find_interface_subnetv6($interface, $flush = false) { function find_interface_subnetv6($interface) {
global $interface_snv6_arr_cache; $interface = trim($interface);
if (does_interface_exist($interface)) {
if (!isset($interface_snv6_arr_cache) || !is_array($interface_snv6_arr_cache)) { $ifinfo = pfSense_get_interface_addresses($interface);
$interface_snv6_arr_cache = array(); if (isset($ifinfo['subnetbits6'])) {
} return $ifinfo['subnetbits6'];
}
$interface = str_replace("\n", "", $interface);
if (does_interface_exist($interface) == false)
return;
if (!isset($interface_snv6_arr_cache[$interface]['subnetbits6']) || $flush) {
$ifinfo = pfSense_get_interface_addresses($interface);
if (isset($ifinfo['subnetbits6'])) {
$interface_snv6_arr_cache[$interface] = $ifinfo['subnetbits6'];
} else {
return null ;
} }
} return null;
return $interface_snv6_arr_cache[$interface];
} }
function ip_in_interface_alias_subnet($interface, $ipalias) { function ip_in_interface_alias_subnet($interface, $ipalias) {
......
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