summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/services.inc6
-rw-r--r--etc/inc/xmlparse.inc2
-rwxr-xr-xusr/local/www/guiconfig.inc2
-rwxr-xr-xusr/local/www/services_dnsmasq.php69
4 files changed, 69 insertions, 10 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 238e82b..ef4b21e 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -383,6 +383,12 @@ function services_dnsmasq_configure() {
" -s {$config['system']['domain']}";
}
+ if (isset($config['dnsmasq']['domainoverrides']) && is_array($config['dnsmasq']['domainoverrides'])) {
+ foreach($config['dnsmasq']['domainoverrides'] as $override) {
+ $args .= ' --server=/' . $override['domain'] . '/' . $override['ip'];
+ }
+ }
+
/* run dnsmasq */
mwexec("/usr/local/sbin/dnsmasq {$args}");
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index 5028837..1e0a9e9 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -34,7 +34,7 @@
$listtags = explode(" ", "row config package columnitem option item fieldname field rule user key subqueue " .
"dnsserver winsserver encryption-algorithm-option hash-algorithm-option hosts tunnel " .
"onetoone staticmap route alias pipe queue shellcmd earlyshellcmd mobilekey " .
- "servernat proxyarpnet passthrumac allowedip wolentry vlan menu");
+ "servernat proxyarpnet passthrumac allowedip wolentry vlan menu domainoverrides");
function startElement($parser, $name, $attrs) {
global $parsedcfg, $depth, $curpath, $havedata, $listtags;
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 3c8d5f3..0c0f8d0 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -52,7 +52,7 @@ $d_filterconfdirty_path = $g['varrun_path'] . "/filter.conf.dirty";
$d_ipsecconfdirty_path = $g['varrun_path'] . "/ipsec.conf.dirty";
$d_shaperconfdirty_path = $g['varrun_path'] . "/shaper.conf.dirty";
$d_pptpuserdirty_path = $g['varrun_path'] . "/pptpd.user.dirty";
-$d_hostsdirty_path = $g['varrun_path'] . "/hosts.dirty";
+$d_dnsmasqdirty_path = $g['varrun_path'] . "/dnsmasq.dirty";
$d_staticmapsdirty_path = $g['varrun_path'] . "/staticmaps.dirty";
$d_staticroutesdirty_path = $g['varrun_path'] . "/staticroutes.dirty";
$d_aliasesdirty_path = $g['varrun_path'] . "/aliases.dirty";
diff --git a/usr/local/www/services_dnsmasq.php b/usr/local/www/services_dnsmasq.php
index 66c3a35..f488958 100755
--- a/usr/local/www/services_dnsmasq.php
+++ b/usr/local/www/services_dnsmasq.php
@@ -38,8 +38,14 @@ $pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']);
if (!is_array($config['dnsmasq']['hosts'])) {
$config['dnsmasq']['hosts'] = array();
}
+
+if (!is_array($config['dnsmasq']['domainoverrides'])) {
+ $config['dnsmasq']['domainoverrides'] = array();
+}
+
hosts_sort();
$a_hosts = &$config['dnsmasq']['hosts'];
+$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
if ($_POST) {
@@ -65,14 +71,27 @@ if ($_POST) {
}
if ($_GET['act'] == "del") {
- if ($a_hosts[$_GET['id']]) {
- unset($a_hosts[$_GET['id']]);
- write_config();
- touch($d_hostsdirty_path);
- header("Location: services_dnsmasq.php");
- exit;
- }
+ if ($_GET['type'] == 'host') {
+ if ($a_hosts[$_GET['id']]) {
+ unset($a_hosts[$_GET['id']]);
+ write_config();
+ touch($d_dnsmasqdirty_path);
+ header("Location: services_dnsmasq.php");
+ exit;
+ }
+ }
+ elseif ($_GET['type'] == 'doverride') {
+ if ($a_domainOverrides[$_GET['id']]) {
+ unset($a_domainOverrides[$_GET['id']]);
+ write_config();
+ touch($d_dnsmasqdirty_path);
+ header("Location: services_dnsmasq.php");
+ exit;
+ }
+ }
}
+
+
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
@@ -171,7 +190,41 @@ if ($_GET['act'] == "del") {
<td valign="middle"><a href="services_dnsmasq_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
</tr>
</table>
- </tr>
+<!-- update to enable domain overrides -->
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td><p>Below you can override an entire domain by specifying an
+ authoritative dns server to be queried for that domain.</p></td>
+ </tr>
+ </table>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="35%" class="listhdrr">Domain</td>
+ <td width="20%" class="listhdrr">IP</td>
+ <td width="35%" class="listhdr">Description</td>
+ <td width="10%" class="list"></td>
+ </tr>
+ <?php $i = 0; foreach ($a_domainOverrides as $doment): ?>
+ <tr>
+ <td class="listlr">
+ <?=strtolower($doment['domain']);?>&nbsp;
+ </td>
+ <td class="listr">
+ <?=$doment['ip'];?>&nbsp;
+ </td>
+ <td class="listbg">
+ <?=htmlspecialchars($doment['descr']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list"> <a href="services_dnsmasq_domainoverride_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" bord
+er="0"></a>
+ &nbsp;<a href="services_dnsmasq.php?act=del&type=doverride&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this domain overrid
+e?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="3"></td>
+ <td class="list"> <a href="services_dnsmasq_domainoverride_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
OpenPOWER on IntegriCloud