diff options
author | Ermal <eri@pfsense.org> | 2014-04-12 06:20:32 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-04-12 06:20:32 +0000 |
commit | f96b9a1830ee2b08c142207ebfa4f695d0628853 (patch) | |
tree | ee62a2a5a5e9779188b66b8a17b311becbcc3fc7 /etc/rc.newwanip | |
parent | d22169cfd68a26c04ca6d1aa997575f1b3e4cc80 (diff) | |
download | pfsense-f96b9a1830ee2b08c142207ebfa4f695d0628853.zip pfsense-f96b9a1830ee2b08c142207ebfa4f695d0628853.tar.gz |
Take care of the loops reported for OpenVPN in tap mode. Also fixes the problems of tap disappearing from bridge if its a member.
Diffstat (limited to 'etc/rc.newwanip')
-rwxr-xr-x | etc/rc.newwanip | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/etc/rc.newwanip b/etc/rc.newwanip index 2fa450c..df00148 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -62,7 +62,7 @@ $argument = str_replace("\n", "", $argv[1]); log_error("rc.newwanip: Informational is starting {$argument}."); -if(empty($argument)) { +if (empty($argument)) { $interface = "wan"; $interface_real = get_real_interface(); } else { @@ -70,13 +70,15 @@ if(empty($argument)) { $interface_real = $argument; } +$interface_descr = convert_friendly_interface_to_friendly_descr($interface); + /* If the interface is configured and not enabled, bail. We do not need to change settings for disabled interfaces. #3313 */ if (is_array($config['interfaces'][$interface]) && !isset($config['interfaces'][$interface]['enable'])) { log_error("Interface is disabled, nothing to do."); return; } -if(empty($argument)) +if (empty($argument)) $curwanip = get_interface_ip(); else { $curwanip = find_interface_ip($interface_real, true); @@ -88,14 +90,19 @@ else { } } -log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface}) (real interface: {$interface_real})."); +log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface_descr}[{$interface}]) (real interface: {$interface_real})."); -if($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) { +/* + * NOTE: Take care of openvpn and similar if you generate the event to reconfigure an interface. + * i.e. OpenVPN might be in tap mode and not have an ip. + */ +if (($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) && susbstr($interface_real, 0, 4) != "ovpn") { log_error("rc.newwanip: Failed to update {$interface} IP, restarting..."); send_event("interface reconfigure {$interface}"); exit; } +/* XXX: This really possible? */ if (empty($interface)) { filter_configure(); restart_packages(); @@ -110,7 +117,8 @@ if (file_exists("{$g['vardb_path']}/{$interface}_cacheip")) system_resolvconf_generate(true); /* write current WAN IP to file */ -file_put_contents("{$g['vardb_path']}/{$interface}_ip", $curwanip); +if (is_ipaddr($curwanip)) + @file_put_contents("{$g['vardb_path']}/{$interface}_ip", $curwanip); link_interface_to_vips($interface, "update"); @@ -180,7 +188,8 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface /* reconfigure our gateway monitor */ setup_gateways_monitor(); - file_put_contents("{$g['vardb_path']}/{$interface}_cacheip", $curwanip); + if (is_ipaddr($curnwanip)) + @file_put_contents("{$g['vardb_path']}/{$interface}_cacheip", $curwanip); /* perform RFC 2136 DNS update */ services_dnsupdate_process($interface); |