summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-08-06 12:04:12 -0400
committerjim-p <jimp@pfsense.org>2010-08-06 12:04:12 -0400
commit381e43e0065e60cf39ec32a8632bbd4f1a950c4a (patch)
treec964926e2b111514d297a2a0e15f7b421fe603b7
parent6b5a20abe87cff8562c0789396631c1dc0651350 (diff)
downloadpfsense-381e43e0065e60cf39ec32a8632bbd4f1a950c4a.zip
pfsense-381e43e0065e60cf39ec32a8632bbd4f1a950c4a.tar.gz
Restore DHCP leases on boot if they have been backed up.
-rw-r--r--etc/inc/services.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index a9e28dc..0c4c8de 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -84,6 +84,21 @@ function services_dhcpd_configure() {
fclose($fd);
mwexec("/bin/sh {$g['tmp_path']}/dhcpd.sh");
+ if ($g['booting']) {
+ if ($g['platform'] != "pfSense") {
+ /* restore the leases, if we have them */
+ if (file_exists("{$g['cf_conf_path']}/dhcpleases.tgz")) {
+ $dhcprestore = "";
+ $dhcpreturn = "";
+ exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcpleases.tgz 2>&1", $dhcprestore, $dhcpreturn);
+ $dhcprestore = implode(" ", $dhcprestore);
+ if($dhcpreturn <> 0) {
+ log_error("DHCP leases restore failed exited with $dhcpreturn, the error is: $dhcprestore\n");
+ }
+ }
+ }
+ }
+
$syscfg = $config['system'];
$dhcpdcfg = $config['dhcpd'];
$Iflist = get_configured_interface_list();
OpenPOWER on IntegriCloud