diff options
author | Ermal <eri@pfsense.org> | 2011-03-04 17:37:32 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-03-04 17:37:32 +0000 |
commit | 9ccecb65d8b9b8b58c719fec7746c934717c1164 (patch) | |
tree | 4bcd12794aa344b5fd6bb5a51f40ddb8ee2e6fcb | |
parent | 1b761f36b7c2c484f894e6412a1efad769533696 (diff) | |
download | pfsense-9ccecb65d8b9b8b58c719fec7746c934717c1164.zip pfsense-9ccecb65d8b9b8b58c719fec7746c934717c1164.tar.gz |
If the interface triggering rc.newwanip is not assigned just reload packages and the filter and exit.
-rwxr-xr-x | etc/rc.newwanip | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/etc/rc.newwanip b/etc/rc.newwanip index b85d102..f4e59c7 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -45,8 +45,16 @@ require_once("openvpn.inc"); if($g['booting']) exit; -/* Interface IP address has changed */ +function restart_packages() { + global $oldip, $curwanipi, $g; + + /* restart packages */ + mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh"); + log_error("{$g['product_name']} package system has detected an ip change $oldip -> $curwanip ... Restarting packages."); + mwexec_bg("/etc/rc.start_packages"); +} +/* Interface IP address has changed */ $argument = str_replace("\n", "", $argv[1]); log_error("rc.newwanip: Informational is starting {$argument}."); @@ -71,6 +79,12 @@ if($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) { exit; } +if (empty($interface)) { + filter_configure(); + restart_packages(); + exit; +} + $oldip = "0.0.0.0"; if (file_exists("{$g['vardb_path']}/{$interface}_cacheip")) $oldip = file_get_contents("{$g['vardb_path']}/{$interface}_cacheip"); @@ -124,9 +138,6 @@ if (substr($interface_real, 0, 4) != "ovpn") /* reload graphing functions */ enable_rrd_graphing(); -/* restart packages */ -mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh"); -mwexec_bg("/etc/rc.start_packages"); -log_error("{$g['product_name']} package system has detected an ip change $oldip -> $curwanip ... Restarting packages."); +restart_packages(); ?> |