Commit a99ed3ee authored by Franco Fichtner's avatar Franco Fichtner

rc: $configip for unified reload code later...

parent f305ecaf
...@@ -79,13 +79,15 @@ if ((empty($ip) || !is_ipaddr($ip)) && substr($interface_real, 0, 4) != 'ovpn') ...@@ -79,13 +79,15 @@ if ((empty($ip) || !is_ipaddr($ip)) && substr($interface_real, 0, 4) != 'ovpn')
return; return;
} }
$configip = $config['interfaces'][$interface]['ipaddr'];
$cacheip_file = "/var/db/{$interface}_cacheip"; $cacheip_file = "/var/db/{$interface}_cacheip";
$ipfile = "/var/db/{$interface}_ip"; $ip_file = "/var/db/{$interface}_ip";
/* write the current interface IP to file */ /* write the current interface IP to file */
/* used in src/sbin/dhclient-script.ext */ /* used in src/sbin/dhclient-script.ext */
if (is_ipaddr($ip)) { if (is_ipaddr($ip)) {
@file_put_contents($ipfile, $ip); @file_put_contents($ip_file, $ip);
} }
link_interface_to_vips($interface, "update"); link_interface_to_vips($interface, "update");
...@@ -155,7 +157,7 @@ $cacheip = @file_get_contents($cacheip_file); ...@@ -155,7 +157,7 @@ $cacheip = @file_get_contents($cacheip_file);
* Even with the same IP the VPN software is unhappy with the IP disappearing, and we * Even with the same IP the VPN software is unhappy with the IP disappearing, and we
* could be failing back in which case we need to switch IPs back anyhow. * could be failing back in which case we need to switch IPs back anyhow.
*/ */
if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($config['interfaces'][$interface]['ipaddr'])) { if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($configip)) {
@unlink($cacheip_file); @unlink($cacheip_file);
system_routing_configure($interface); system_routing_configure($interface);
......
...@@ -76,6 +76,8 @@ if ((empty($ip) || !is_ipaddr($ip)) && substr($interface_real, 0, 4) != 'ovpn') ...@@ -76,6 +76,8 @@ if ((empty($ip) || !is_ipaddr($ip)) && substr($interface_real, 0, 4) != 'ovpn')
return; return;
} }
$configip = $config['interfaces'][$interface]['ipaddrv6'];
$searchdomain_file = "/var/etc/searchdomain_v6{$interface}"; $searchdomain_file = "/var/etc/searchdomain_v6{$interface}";
$nameserver_file = "/var/etc/nameserver_v6{$interface}"; $nameserver_file = "/var/etc/nameserver_v6{$interface}";
$cacheip_file = "/var/db/{$interface}_cacheipv6"; $cacheip_file = "/var/db/{$interface}_cacheipv6";
...@@ -123,7 +125,7 @@ $cacheip = @file_get_contents($cacheip_file); ...@@ -123,7 +125,7 @@ $cacheip = @file_get_contents($cacheip_file);
* Even with the same IP the VPN software is unhappy with the IP disappearing, and we * Even with the same IP the VPN software is unhappy with the IP disappearing, and we
* could be failing back in which case we need to switch IPs back anyhow. * could be failing back in which case we need to switch IPs back anyhow.
*/ */
if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($config['interfaces'][$interface]['ipaddrv6'])) { if (!is_ipaddr($cacheip) || $ip != $cacheip || !is_ipaddr($configip)) {
if (is_ipaddr($ip)) { if (is_ipaddr($ip)) {
if ($ip == $cacheip) { if ($ip == $cacheip) {
if (in_array($config['interfaces'][$interface]['ipaddr'], array('l2tp', 'ppp', 'pppoe', 'pptp'))) { if (in_array($config['interfaces'][$interface]['ipaddr'], array('l2tp', 'ppp', 'pppoe', 'pptp'))) {
......
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