aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]config/Fit123/bin/date/index.abc23
-rwxr-xr-xconfig/Fit123/bin/dnssrv/system.abc10
-rw-r--r--config/Fit123/bin/ltsp/services.inc16
-rwxr-xr-x[-rw-r--r--]config/Fit123/bin/ltsp/services_dhcp.abc66
4 files changed, 80 insertions, 35 deletions
diff --git a/config/Fit123/bin/date/index.abc b/config/Fit123/bin/date/index.abc
index 73a81fa1..f63b7001 100644..100755
--- a/config/Fit123/bin/date/index.abc
+++ b/config/Fit123/bin/date/index.abc
@@ -170,10 +170,12 @@ $currentDate = $dateOutput[0];
built on <?php readfile("/etc/version.buildtime"); ?>
</td>
</tr>
+ <?php if(!$g['hideplatform']): ?>
<tr>
- <td width="25%" class="vncellt">Platform / Current Date </td>
- <td width="75%" class="listr"><?=htmlspecialchars($g['platform']);?> / <?=$currentDate;?></td>
+ <td width="25%" class="vncellt">Platform / Current Date</td>
+ <td width="75%" class="listr"><?=htmlspecialchars($g['platform']);?> / <?=$currentDate;?></td>
</tr>
+ <?php endif; ?>
<?php if ($hwcrypto): ?>
<tr>
<td width="25%" class="vncellt">Hardware crypto</td>
@@ -230,23 +232,10 @@ $currentDate = $dateOutput[0];
<tr>
<td width="25%" class="vncellt">SWAP usage</td>
<td width="75%" class="listr">
- <?php $swapusage = swap_usage(); ?>
+ <?php $swapUsage = swap_usage(); ?>
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" width="<?= $swapUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $swapUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
&nbsp;
- <input style="border: 0px solid white;" size="30" name="swapusagemeter" id="swapusagemeter" value="<?= $swapusage.'%'; ?>" />
- </td>
- </tr>
- <?php endif; ?>
-<?php
- if(has_temp()):
-?>
- <tr>
- <td width='25%' class='vncellt'>Temperature</td>
- <td width='75%' class='listr'>
- <?php $temp = get_temp(); ?>
- <img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" name="tempwidtha" id="tempwidtha" width="<?= $temp; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" name="tempwidthb" id="tempwidthb" width="<?= (100 - $temp); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
- &nbsp;
- <input style="border: 0px solid white;" size="30" name="tempmeter" id="tempmeter" value="<?= $temp."C"; ?>" />
+ <input style="border: 0px solid white;" size="30" name="swapusagemeter" id="swapusagemeter" value="<?= $swapUsage.'%'; ?>" />
</td>
</tr>
<?php endif; ?>
diff --git a/config/Fit123/bin/dnssrv/system.abc b/config/Fit123/bin/dnssrv/system.abc
index 5f3bf59d..898505b9 100755
--- a/config/Fit123/bin/dnssrv/system.abc
+++ b/config/Fit123/bin/dnssrv/system.abc
@@ -30,8 +30,6 @@
*/
require("guiconfig.inc");
-if(!function_exists("filter_configure"))
- require_once("filter.inc");
$pconfig['hostname'] = $config['system']['hostname'];
$pconfig['domain'] = $config['system']['domain'];
@@ -145,10 +143,10 @@ if ($_POST) {
$config['system']['dnsserver'][] = $_POST['dns1'];
if ($_POST['dns2'])
$config['system']['dnsserver'][] = $_POST['dns2'];
- if ($_POST['dns3'])
- $config['system']['dnsserver'][] = $_POST['dns3'];
- if ($_POST['dns4'])
- $config['system']['dnsserver'][] = $_POST['dns4'];
+ if ($_POST['dns3'])
+ $config['system']['dnsserver'][] = $_POST['dns3'];
+ if ($_POST['dns4'])
+ $config['system']['dnsserver'][] = $_POST['dns4'];
$olddnsallowoverride = $config['system']['dnsallowoverride'];
diff --git a/config/Fit123/bin/ltsp/services.inc b/config/Fit123/bin/ltsp/services.inc
index a788a2b3..f999868a 100644
--- a/config/Fit123/bin/ltsp/services.inc
+++ b/config/Fit123/bin/ltsp/services.inc
@@ -61,6 +61,7 @@ function services_dhcpd_configure() {
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/etc\n");
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr/local/sbin\n");
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/var/db\n");
+ fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/var/run\n");
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr\n");
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/lib\n");
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/run\n");
@@ -278,9 +279,9 @@ EOD;
$dhcpdconf .= " next-server {$dhcpifconf['next-server']};\n";
$dhcpdconf .= " filename \"{$dhcpifconf['filename']}\";\n";
}
- if ($dhcpifconf['rootpath'] <> "") {
- $dhcpdconf .= " option root-path \"{$dhcpifconf['rootpath']}\";\n";
- }
+ if ($dhcpifconf['rootpath'] <> "") {
+ $dhcpdconf .= " option root-path \"{$dhcpifconf['rootpath']}\";\n";
+ }
}
$dhcpdconf .= <<<EOD
}
@@ -635,7 +636,7 @@ function services_dnsmasq_configure() {
//}
/* run dnsmasq */
- mwexec("/usr/local/sbin/dnsmasq {$args}");
+ mwexec("/usr/local/sbin/dnsmasq --all-servers {$args}");
if ($g['booting'])
echo "done.\n";
@@ -927,7 +928,10 @@ EOD;
fclose($fd);
/* generate update instructions */
- $upinst = "update delete {$config['dnsupdate']['host']} A\n";
+ $upinst = "";
+ if ($config['dnsupdate']['server'])
+ $upinst .= "server {$config['dnsupdate']['server']}\n";
+ $upinst .= "update delete {$config['dnsupdate']['host']} A\n";
$upinst .= "update add {$config['dnsupdate']['host']} {$config['dnsupdate']['ttl']} A {$wanip}\n";
$upinst .= "\n"; /* mind that trailing newline! */
@@ -936,7 +940,7 @@ EOD;
fclose($fd);
/* invoke nsupdate */
- $cmd = "/usr/sbin/nsupdate -k {$g['varetc_path']}/K{$keyname}+157+00000.key";
+ $cmd = "/usr/bin/nsupdate -k {$g['varetc_path']}/K{$keyname}+157+00000.key";
if (isset($config['dnsupdate']['usetcp']))
$cmd .= " -v";
$cmd .= " {$g['varetc_path']}/nsupdatecmds";
diff --git a/config/Fit123/bin/ltsp/services_dhcp.abc b/config/Fit123/bin/ltsp/services_dhcp.abc
index 89548502..7a203491 100644..100755
--- a/config/Fit123/bin/ltsp/services_dhcp.abc
+++ b/config/Fit123/bin/ltsp/services_dhcp.abc
@@ -31,6 +31,57 @@
require("guiconfig.inc");
+/* Fix failover DHCP problem
+ * http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
+ */
+ini_set("memory_limit","64M");
+
+/* This function will remove entries from dhcpd.leases that would otherwise
+ * overlap with static DHCP reservations. If we don't clean these out,
+ * then DHCP will print a warning in the logs about a duplicate lease
+ */
+function dhcp_clean_leases() {
+ global $g, $config;
+ $leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases";
+ if (!file_exists($leasesfile))
+ return;
+ /* Build list of static MACs */
+ $staticmacs = array();
+ foreach($config['interfaces'] as $ifname => $ifarr)
+ if (is_array($config['dhcpd'][$ifname]['staticmap']))
+ foreach($config['dhcpd'][$ifname]['staticmap'] as $static)
+ $staticmacs[] = $static['mac'];
+ /* Read existing leases */
+ $leases_contents = explode("\n", file_get_contents($leasesfile));
+ $newleases_contents = array();
+ $i=0;
+ while ($i < count($leases_contents)) {
+ /* Find a lease definition */
+ if (substr($leases_contents[$i], 0, 6) == "lease ") {
+ $templease = array();
+ $thismac = "";
+ /* Read to the end of the lease declaration */
+ do {
+ if (substr($leases_contents[$i], 0, 20) == " hardware ethernet ")
+ $thismac = substr($leases_contents[$i], 20, 17);
+ $templease[] = $leases_contents[$i];
+ $i++;
+ } while ($leases_contents[$i-1] != "}");
+ /* Check for a matching MAC address and if not present, keep it. */
+ if (! in_array($thismac, $staticmacs))
+ $newleases_contents = array_merge($newleases_contents, $templease);
+ } else {
+ /* It's a line we want to keep, copy it over. */
+ $newleases_contents[] = $leases_contents[$i];
+ $i++;
+ }
+ }
+ /* Write out the new leases file */
+ $fd = fopen($leasesfile, 'w');
+ fwrite($fd, implode("\n", $newleases_contents));
+ fclose($fd);
+}
+
$if = $_GET['if'];
if ($_POST['if'])
$if = $_POST['if'];
@@ -225,7 +276,7 @@ if ($_POST) {
$config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
$config['dhcpd'][$if]['filename'] = $_POST['filename'];
- $config['dhcpd'][$if]['rootpath'] = $_POST['rootpath'];
+ $config['dhcpd'][$if]['rootpath'] = $_POST['rootpath'];
write_config();
@@ -236,6 +287,9 @@ if ($_POST) {
$retvaldhcp = 0;
$retvaldns = 0;
config_lock();
+ /* Stop DHCP so we can cleanup leases */
+ killbyname("dhcpd");
+ dhcp_clean_leases();
/* dnsmasq_configure calls dhcpd_configure */
/* no need to restart dhcpd twice */
if (isset($config['dnsmasq']['regdhcpstatic'])) {
@@ -302,7 +356,7 @@ function enable_change(enable_over) {
document.iform.netboot.disabled = endis;
document.iform.nextserver.disabled = endis;
document.iform.filename.disabled = endis;
- document.iform.rootpath.disabled = endis;
+ document.iform.rootpath.disabled = endis;
document.iform.denyunknown.disabled = endis;
}
@@ -544,10 +598,10 @@ function show_netboot_config() {
<p>
<input name="filename" type="text" class="formfld" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
Enter the filename used for network booting.<br />
- Note: You need both a filename and a boot server configured for this to work!<br />
- <p>
- <input name="rootpath" type="text" class="formfld" id="rootpath" size="20" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
- Enter option root-path.
+ Note: You need both a filename and a boot server configured for this to work!<br />
+ <p>
+ <input name="rootpath" type="text" class="formfld" id="rootpath" size="20" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
+ Enter option root-path.
</div>
</td>
</tr>