summaryrefslogtreecommitdiffstats
path: root/etc/rc.newwanip
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-09-21 21:17:39 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-09-21 21:17:39 +0000
commitbf091a775dbafa6b6360e6c0de6a7515ce4d16fe (patch)
treebc8add50318b5cf7031a3c215d6d88b19c4d7f31 /etc/rc.newwanip
parent9ea9cdaa188d42dc7cceb08b784541cc36c14cae (diff)
downloadpfsense-bf091a775dbafa6b6360e6c0de6a7515ce4d16fe.zip
pfsense-bf091a775dbafa6b6360e6c0de6a7515ce4d16fe.tar.gz
Correctly handle multiple WAN's.
Pointy-hat-to: GeekGod
Diffstat (limited to 'etc/rc.newwanip')
-rwxr-xr-xetc/rc.newwanip22
1 files changed, 15 insertions, 7 deletions
diff --git a/etc/rc.newwanip b/etc/rc.newwanip
index d9d42fa..83d2234 100755
--- a/etc/rc.newwanip
+++ b/etc/rc.newwanip
@@ -35,16 +35,22 @@
/* WAN IP address has changed */
- $curwanip = get_current_wan_address();
+ if($argv[1] <> "") {
+ $curwanip = find_interface_ip($argv[1]);
+ $interface = $argv[1];
+ } else {
+ $curwanip = get_current_wan_address();
+ $interface = "wan";
+ }
/* dhclient or MPD told us that the IP address has changed;
let's see if that's really true to avoid reloading things
when it's not really necessary (dhclient likes to
execute its dhclient-exit-hooks also on renewals)
*/
- if (file_exists("{$g['vardb_path']}/wanip")) {
- $oldwanip = chop(file_get_contents("{$g['vardb_path']}/wanip"));
-
+ if (file_exists("{$g['vardb_path']}/{$interface}_ip")) {
+ $oldwanip = chop(file_get_contents("{$g['vardb_path']}/{$interface}_ip"));
+ log_error("Informational: DHClient spawned /etc/rc.newwanip but the ip has not changed.");
if ($curwanip == $oldwanip)
return 0; /* nothing to do */
}
@@ -55,23 +61,25 @@
/* regenerate resolv.conf if DNS overrides are allowed or the BigPond
client is enabled */
if (isset($config['system']['dnsallowoverride']) ||
- ($config['interfaces']['wan']['ipaddr'] == "bigpond"))
+ ($config['interfaces'][$interface]['ipaddr'] == "bigpond"))
system_resolvconf_generate(true);
/* fire up the BigPond client, if necessary */
- if ($config['interfaces']['wan']['ipaddr'] == "bigpond")
+ if ($config['interfaces'][$interface]['ipaddr'] == "bigpond")
interfaces_wan_bigpond_configure($curwanip);
/* perform RFC 2136 DNS update */
services_dnsupdate_process();
/* write current WAN IP to file */
- $fd = @fopen("{$g['vardb_path']}/wanip", "w");
+ $fd = @fopen("{$g['vardb_path']}/{$interface}_ip", "w");
if ($fd) {
fwrite($fd, $curwanip);
fclose($fd);
}
+ log_error("Informational: DHClient spawned /etc/rc.newwanip and the new ip is {$curwanip}.");
+
/* after IP change, update DynDNS */
services_dyndns_configure();
OpenPOWER on IntegriCloud